I can not find a way to connect to the wifi network either using WPA supplicant or Connman. I've tried in 3 different ways (see below) none of these worked:
- with WPA supplicant on /etc/
- with Connman using various commands targeting /storage/.cache/connman/
- on the Kodi UI
WPA supplicant attempts
When trying to configure the wifi settings via SSH with commands it seems most of the file system is read-only (i.e. I can not write on /etc/).
These commands:
mkdir -p /etc/wpa_supplicant/
wpa_passphrase {{wifi_ssid}} {{wifi_psw}} > /etc/wpa_supplicant/wpa_supplicant.conf
Give this output:
mkdir: can't create directory '/etc/wpa_supplicant/': Read-only file system
can't create /etc/wpa_supplicant/wpa_supplicant.conf: nonexistent directory
However I am able to enable/restart the SyestemD daemon with:
systemctl enable wpa_supplicant
systemctl restart wpa_supplicant
systemctl status wpa_supplicant
Also: from the Kodi UI I can see a list of wifi networks (although I can not find commonly available commands like wpa_cli or iwlist).
Connman attempts
I later realised I had to use Connman. I can see there is a conf file: /storage/.cache/connman/settings
containing:
- I enabled the wifi thing with the command: connmanctl enable wifi.
- I found the wifi network unique ID with the command: connmanctl scan wifi && connmanctl services. It should be something like: wifi_<some_unique_id>_<some_other_unique_id>_managed_psk
- I created this settings file at: /storage/.cache/connman/wifi_<some_unique_id>_<some_other_unique_id>_managed_psk/settings with the content:
[wifi_<some_unique_id>_<some_other_unique_id>_managed_psk]
Name={{ my_wifi_ssid }}
AutoConnect=true
Type=wifi
Security=wpa2
Passphrase={{ my_wifi_password }}
where {{ my_wifi_ssid }} is the usual name of the wifi network you would see from anywhere e.g. from your phone.
- I restarted the SystemD service for Connman with: systemctl restart connman.
- I checked the status with systemctl status connman and the logs with journalctl -u connman but I did not see anything suspicious like error messages or warnings. The only strange thing I've seen is a message saying wlan0 {newlink} index 3 operstate 5 <DORMANT>, but that’s the network interface and it’s been up and enabled because I can see it from the output of ifconfig. Also I can see it’s enabled from the output of: /storage/.cache/connman/settings.
Connecting via the UI
The first time I tried this, when choosing the wifi network on the Kodi menus from the list, after typing the password, I've seen the system trying to connect because there was a label that changed from idle to connect (or connecting don’t remember). After a few seconds I've briefly seen it becoming failed, then going back to idle.
Checking the logs at /storage/.kodi/temp/kodi.log I've seen the following Connman error message:
connman::dbus_error_handler
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken
The second time I tried this (after a few reboots, the day after) I first enabled some DBUS logs as when searching for the previous error message I found people saying that would have helped to get more information, so I've done this:
# dbus-launch
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-QqCdchGh2c,guid=da98deee70458042f51c70ee5de3a89d
DBUS_SESSION_BUS_PID=3139
# export $(dbus-launch)
# dbus-monitor
signal time=1575201002.773722 sender=org.freedesktop.DBus -> destination=:1.0 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.0"
signal time=1575201002.773953 sender=org.freedesktop.DBus -> destination=:1.0 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
string ":1.0"
However when later I tried manually from the UI to connect, then I did not see log statements in here (not sure why as I am not familiar with these tools). I could see some extra logs on the Kodi logs, I could see this message:
But when checking the wifi interface with ifconfig I can not see an IP address assigned to it, so it's not "already connected".
- How can I connect to the wifi?
- What's the relationship between WPA supplicant and Connman? Do I have to configure both?
- Is there a way to automate this configuration process via some commands that could be included in a bash script via SSH?