Installing OSMC on RPi4B but fail to set WiFi connect

I have received a new RPi4B-2GB unit, which I intend to use as my OSMC/Kodi player at my summer home. It will replace an old RPi2B device, which has reached EOL.
So I used the RaspberryPiImager to create the SDcard for the RPi4B device with the latest OSMC image and started the RPi4 with this card. I have connected a wireless keyboard via a USB dongle to the RPi4 as well.
After a while the Kodi display showed up and I could navigate through the menus in the usual fashion.
So the next step is to enable and connect WiFi to my home network, which uses the same SSID/passphrase as the one on my summer home.

But no matter what I do in either the Settings or via the MyOSMC program it refuses to connect to my WiFi network. The UI to do this is really confusing but I have managed to get to a place where it asks if I want to connect to the SSID of my home Wifi and then when I hit OK nothing happens for a while and then a dialog pops up where I enter the passphrase. Then another wait and a message “failed to connect to myssid”, then nothing.

So in the end I had to pull out a long network cable and hook it up wired to my LAN. Then I could access it via SSH and do some simple stuff like setting up the user environment with the correct keyboard layout, edit /etc/fstab to connect to my media file store etc.
But I had thought that there would be the /etc/wpa_supplicant/ dir with the conf file where I could enter the WiFi network data…
But not…

Please advice how to actually switch OSMC to connect by WiFi to my LAN!

With the network cable attached I have been able to connect by SSH and change the user login for osmc.
I could modify the Kodi network connections in the ~/.kodi/userdata/sources.xml to include my external media shares and this works fine.

I have found this:
Old thread concerning WiFi

And here they describe writing the file /var/lib/connman/wifi.service and add the connect data there:

[service_wifi]
Type = wifi
Name = SSIDName
Passphrase = secret
IPv4 = 192.168.2.2/255.255.255.0/192.168.2.1

But the content in that file seems wrong because it also specifies the IP address for the WiFi connection, which surely usually is provided via DHCP from the router, right…

In my case the OSMC device has to connect to the SSID and get its address from the DHCP server and then just work, like all other RPi units I have used over the years.
I have the same ssid at the summer home as in my main home but different IP address ranges.

What to do?

NOTE:
If I use an SDcard with PiOS Bullseye on this device WiFi works just fine as does ethernet.
But OSMC seems to have an issue of some kind because when I use MyOSMC to enable networking it works OK for Ethernet, but NOT for WiFi. I have tried entering the passphrase via a remote control and via a keyboard, same result - it fails to connect.
Same passphrase is used on ALL of my other RPi devices without issues.

Use the backup option in the My OSMC add-on on your old device. Reinstall OSMC on the RPi 4’s SD card using the OSMC installer and don’t configure the network during setup. Once you boot the RPi 4 into the now clean install you can configure your network and restore from backup. There are differences with the newer RPi’s that don’t allow for just swapping the SD like you could with some of the previous models.

I did not swap any SDcard, I just created it using the RaspberryPiImager application…

OK, so it is better if if I download a disk image from here?

And then write it to an SDcard using for example Balena Etcher (what I did previously before Raspberry Pi Imager) and plug it into the RPi4 and start?

The old system is running via WiFi right now here at home so I have access to it.
Do I use MyOSMC to create and save a backup to file and then copy that backup over to the new system using for example scp once it has started running?
OOPS!
That method will not work if the WiFi connection is not coming up…
Then I have to make the system use a wired network again with a LAN cable???..

What exactly will be transferred via the backup?

  • Kodi settings will probably all be there, I guess…
  • Kodi add-ons like the menu editor?
  • Connections to network sources?
  • Connections created via /etc/fstab entries?
  • But what about system settings like customizations of Kodi and the WiFi connection etc?

Sorry, when you mentioned the old RPi in my head I was hearing cloning the SD from the old which isn’t supported. The download page now has working programs for making the disks for Windows, OSX, and Linux so you don’t have to use a different imager program anymore. Although I’m not sure if preseeding for the network is currently working or not.

As for the wifi I’m sure if you post up some logs someone stronger on the topic than me will happen along to see what they can find. As a general rule though I’d make sure your not trying to connect to a mixed 2.4/5ghz ssid and if using 5ghz the channel is lower than 100 as this seems to be the least problematic.

As for the backup the wifi will not transfer but My OSMC has options you can enable/disable for all of Kodi’s userdata as well as for system mounts created via fstab and autofs. You also select where it transfers to so using the network or USB storage is up to you. When you restore it will restore whatever is selected in that same window so if you (for example) enabled backup of the addons folder (which backs up the addons themselves as opposed to their preferences) you will have to enable that on the new system as well for it to also restore that option.

I have now struggled for a long time trying to make a backup from the running OSMC installation but cannot make it happen…

I have set the backup location, first by using the browse function which brings me to the NAS holding the media files and when that did not work I figured I should use the “type” entry method and decided to simplify things by entering /home/osmc/backup, which is a folder I created.

But in both instances when I try to “backup now” I can see the target folder path on screen but MyOSMC shows an error message:

Location for backup not provided.
Set the backup folder in MyOSMC

But for heavens sake, I have just set it and I am all the time inside MyOSMC when doing it…

There must be some general misunderstanding on how one navigates and commands OSMC at play here…

This is how I set up the backup folder:

And this is what happens when I try to make a manual backup settings run:

Why is there an error like this?
And it is the same result if I browse for a folder on the NAS where the media files are saved…

I would try deleting everything in ~/.kodi/temp and try again. If your backing up your Thumbnails folder you might also want to not do that. Note that the backup program in My OSMC creates the backup in that folder first and then copies it to the chosen location. If there is a lack of free space or some other issue it doesn’t necessarily have anything to do with the destination. If all else fails you could always just manually copy ~/.kodi and the file/files for your system mount. On the new system you would just systemctl stop mediacenter remove .kodi and then manually copy that folder then start Kodi up again. Going from RPi to RPi there should be no issue with this. If going cross platform you would have need to remove guisettings.xml before starting Kodi up again.

OK thanks!
Removing the content of the ~/.kodi/temp dir after shutting down the mediacenter service and then starting mediacenter again had the wanted effect.
The backup now did not fail but ran for a while mostly saving addons, then finished with a file like this:
-rw-r--r-- 1 osmc osmc 108325785 2023-06-10 22:19 OSMCBACKUP_2023_06_10_22_18_26.tar.gz

So I guess I am good so far, next I have to deal with the new system SDcard as discussed above.
Tomorrow…

1 Like

BACK TO BASICS…

Putting the KODI config via backup/restore aside and concentrating on the basic setup from scratch:

I now have two SDcards for the new system, one created using the “Raspberry Pi Imager” application and one created from a download of the “installer” disk image from OSMC and written to SDcard using Balena Etcher on Windows. Both are the most recent OSMC (June 2023).
Both start up OK and perform some initial tasks before showing the KODI interface screen.

And on both of these the WiFi connection from MyOSMC network config page fails in the same way.
Note that WiFi must be coming up because it lists all of the WiFi hotspots in the vicinity so I can select mine from that list.
But then after I have been asked to enter the password it fails to connect in both cases. :frowning:

My network is served by an ASUS RT-AC86U router with both 2.4 and 5 GHz radio.
On this my old OSMC boxes run just fine on WiFi using RPi3B and RPi3B+ from about 6 years back.
But my new RPi4B, which connects fine using PiOS rather than OSMC, will not connect to WiFi with OSMC.

Is this caused by a quirk in the OSMC f/w for RPi4B regarding the WiFi network???
If so is there a solution or should I just drop the whole upgrade idea?

I have googled the problem and it seems like I am not alone here…
These threads describe the problem too:
https://discourse.osmc.tv/t/wifi-connection-on-r-pi-4/93237
https://discourse.osmc.tv/t/august-update-and-wifi-channels-above-100-not-working/89996
And the solution would seem to be:

sudo apt update
sudo apt install iw crda
iw reg get
#No real output
sudo iw reg set SE <= My region should be SE?
iw reg get
#Now SE is shown as the region, so make persistent:
sudo nano /etc/default/crda
#Add the correct domain:
REGDOMAIN=SE

Then reboot and try connecting.
But unfortunately I am STILL getting the fail to connect error message.
I have now also tried to connect to my guest network on 2.4 GHz but the exact same happens.

But I see this:

$ iw reg get
global
country SE: DFS-ETSI
        (2400 - 2483 @ 40), (N/A, 20), (N/A)
        (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
        (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
        (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
        (5725 - 5875 @ 80), (N/A, 13), (N/A)
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)

phy#0
country 99: DFS-UNSET
        (2402 - 2482 @ 40), (6, 20), (N/A)
        (2474 - 2494 @ 20), (6, 20), (N/A)
        (5140 - 5360 @ 160), (6, 20), (N/A)
        (5460 - 5860 @ 160), (6, 20), (N/A)

Should it not work at this point???`??

Do you have WPA2+WPA3 enabled?

There is a wifi... directory for your SSID at /var/lib/connman/ which contains a settings file. Could you check whether this file contains the right passphrase?

I don’t know. Is there a setting for that in OSMC somewhere I have missed?

If you are talking about the router I do not see any such thing there.
However when looking I saw this:
image
where one can see that the “control channel” for 5G is set to 108.
Is that somehow a problem?
I think I have seen mention of channel numbers above 100 being problematic…

My dir contains this:

osmc@rpi4-osmc-aspo:/var/lib/connman$ ll
total 16
drwxr-xr-x  3 root root 4096 2023-06-11 09:32 .
drwxr-xr-x 18 root root 4096 2023-06-06 02:16 ..
drwx------  2 root root 4096 2023-06-11 09:35 ethernet_d83add1b611c_cable
-rw-------  1 root root  259 2023-06-11 07:16 settings

No sign of any wifi related directory…

The file /var/lib/connman/settings contains this only (I have had to disable WiFi to get a connection via the wired LAN so I can SSH into it):

OfflineMode=false

[Bluetooth]
Enable=false
Tethering=false
Tethering.Freq=2412

[WiFi]
Enable=false
Tethering=false
Tethering.Freq=2412

[Wired]
Enable=true
Tethering=false
Tethering.Freq=2412

[P2P]
Enable=false
Tethering=false
Tethering.Freq=2412

Apart from that there is a directory named ethernet_d83add1b611c_cable and it contains a settings file too but only with data for the wired LAN.

No I meant on the router. I would normally be in the area where you configure your Passphrase.

Yes, everything above 96 is controlled on a country base, but that would be fixed with CRDA if your country supports 108.

On the status page it looks like this:
image
So WPA2-Personal whatever that means…

I don’t know where that should be supported, but would lowering this channel number to say 64 (which is selectable) help?
Or should I set the OSMC WiFi region to EU instead of SE?
I set the router to control channel 64 but it did not change anything…

64 would be a save bet but this might not be your problem (considering CRDA set).

Have you tried to join wifi via command line

sudo connmanctl
agent on
scan wifi
services
connect <Put here the ID of your Wifi as shown in the services output>
1 Like

Very strange; even if you specify a wrong passphrase in MyOSMC, such directory should have been created :thinking:

Sure, your SD card is ok?

Same result with two different SDcards.
I have one created by RaspberryPiImager for RPi4 and I have also downloaded the OSMC “installer” image for RPi4 and put it on another SDcard. It is the active one now.
Same behaviour…

Question:
How do I switch on debug logging such that I can log what is happening? Sometimes I am greeted with a message about an exception when trying to connect.
The logging should only be done for the time when I test and I don’t know how to fix that. When I test WiFi I have to disconnect Ethernet so there is no way to send the log until I have managed to re-enable Ethernet.
PS:
Right now I am locked out from the TV, it is showing a golf tournament… :frowning:

Follow @fzinken’s instructions

If connection still fails, try dmesg | paste-log and send the URL.

If you can see the WiFi network you intend to connect to, it’s not CRDA related.

As the state of your system is now unknown, I would suggest a fresh installation and then following the instructions above.

Well, I tried but this is what happened:

$ sudo connmanctl
Error getting VPN connections: Unit connman-vpn.service not found.connmanctl>
connmanctl> agent on
Agent registered
connmanctl> scan wifi
Error /net/connman/technology/wifi: No carrier
connmanctl> services
*AO Wired                ethernet_d83add1b611c_cable

So when this was done WiFi was switched off in MyOSMC, it seems like only one or the other networking can be running at a given time.
Obviously since I use PuTTY to connect to a SSH shell on the device I cannot let Ethernet go down. I would not be able to issue any commands at all.

I tried getting info on the use of connmanctl:

$ man connmanctl
-bash: man: command not found

Then I tried using ifconfig to bring up WiFi but failed:

$ sudo ifconfig wlan0 up
SIOCSIFFLAGS: Operation not possible due to RF-kill

Why is this so complicated when it used to be basically plug-and-play?