Wifi manually connect

Sometimes when my pi2 reboots, it wont connect to my wireless router. I have to go and select my network again and manually connect to it by putting the password again.
Before on my pi1 there was a /etc/network/interfaces file where i could manually connect to my network before the pi even boots to kodi.
How can i do this now ? I really dont trust osmc to do this for me…and because the pi is at my parents house, i cant keep going there to fix it.

Using the latest rc3 candidate.

My settings:
/var/lib/connman/settings

[global]
OfflineMode=false

[Wired]
Enable=false
Tethering=false

[WiFi]
Enable=true
Tethering=false

/var/lib/connman/wifi_xxx_managed_psk

[wifi_xxxx_managed_psk]
Name=My_Router
SSID=xxxxx
Frequency=2437
Favorite=true
AutoConnect=true
Modified=2015-06-15T13:56:53.798085Z
Passphrase=lalala
IPv4.method=manual
IPv6.method=auto
IPv6.privacy=disabled
Nameservers=8.8.8.8;8.8.4.4;
IPv4.DHCP.LastAddress=192.168.1.14
IPv4.netmask_prefixlen=24
IPv4.local_address=192.168.1.3
IPv4.gateway=192.168.1.1

They look fine to me…but is there a way to force the pi to reconnect to the above settings if there is no connection ?
I dont care if its a crontab or shell script…I just want the pi to autoconnect to the wifi router when it boots up or keep trying if it goes/or is down, because now…if i dont manually connect to it from the GUI, it will never connect on its own.

It will already periodically auto reconnect to a saved wifi network - you shouldn’t need to do anything.

If it doesn’t it’s either because you have ethernet plugged in as well (it won’t auto connect wifi with ethernet plugged in) or there is some connectivity problem that is preventing it getting a connection, such as a driver issue, signal issue or so on.

There is no /etc/network/interfaces support in OSMC at the moment, so don’t waste any time trying to use that.

BTW, Kodi loading is nothing to do with the network coming up - auto reconnection of wifi is handled by connman regardless of whether Kodi is even set to load or not.

Yeah i know, that kodi doesnt have anything to do with it. it just reads the conf files.
I dont have any ethernet cable connected to it. Just wifi. But is there any log file somewhere about the network to see why its failing to connect ? No matter how long i wait it wont autoconnect…I have to do it manually.

The router is literally 3m away, so its not a signal problem, and the wifi dongle was working fine with p1. Autoconnect and everything.

I do have an ethernet folder in my connman folder settings…But thats for when i bring the pi to my pc to do some stuff.
Should i delete it and just leave the wifi folder ? Does it matter ?
The settings file does have ethernet disabled.

Also based on the connman documentation: https://01.org/connman/documentation
there is a

[General]
PreferredTechnologies = ethernet,wifi,cellular

value, which i dont see in the settings file. Thats the autoconnect order. Maybe something like this is needed ??

The only place you’re likely to see log entries pertaining to auto connect are in the system journal and/or dmesg - upload those if you can so we can have a look.

It is there, are you sure your install is up to date ? Here is what you should have:

Preferred technologies sets the order of preference when multiple devices are attached - we set Ethernet to have higher priority, but wireless will auto connect if Ethernet is not plugged in.

Yeah ok, i have /etc/connman.conf and its exactly in that order you copy/pasted here. :slight_smile: I was looking for it in the connman folder.

I did 2 reboots now. In the first one the pi didnt connect. I tried to connect through the GUI and it wouldnt connect after i set my password. I tried disabling and reenabling the adapter and got the same thing…so i thought of going to the console and do a manual connect there…but by the time i openen a console and go through connman to manually connect, i saw that it had already connected to the net…so i went back to kodi and did a reboot again.
The second time it connected immediately. When i was back in kodi it was already connected to the wifi.

I saved both journal files…one during my failed attempts to connect from the GUI and a clean one after the 2nd reboot.
I only kept the 2nd dmesg log though…dont know if that helps :confused:

Here is the file: Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.

Thanks again.

ps: You might see some weird scripts running…i got a .tk domain name updater executing via crontab and i just installed php/mysql on the pi.

Hi, please upload your log using paste.osmc.io - we can’t download your file without signing into that site.

BTW you can upload any log file or conf file directly from ssh using the paste-log command. (Or use the log uploader GUI in OSMC settings)

oh, i didnt know about the paste.osmc.io, nice.

Here are the latest dmseg and journal. I cant copy/paste the old since since its not a clear text file :confused:

My dmseg: http://paste.osmc.io/esihidabin.coffee
The latest journal: http://paste.osmc.io/ruqekapafo.coffee