LibreELEC / Kodi doesn't reconnect automatically to wifi after a blackout

  • Hello,

    as I installed LibreELEC 9.x on a Raspberry 3b as an IPTV for my Mum, I ran into a problem:

    If the Raspberry is turned of by a switch socket (or e.g. after a blackout), on the new start the wifi will not connect automatically. I then have to access the option entry and manually connect to the wifi, which is quite impractical as I'm not always around if this happens.

    The goal is to use LibreELEC/Kodi as a turn-on-turn-off TV, which would be the perfect solution but with this issue it seems unpossible for now.

    Is this a known problem or do I miss something?

    Thank you for any advice!

  • Hi, Check if at "System-Libreelec-Connections-Yourconnection-Edit" the "Connect Automatically" is enabled.

    Many times when the network connection is edited, that changing to "off" and need to enabled again.

  • Hi, Check if at "System-Libreelec-Connections-Yourconnection-Edit" the "Connect Automatically" is enabled.

    Many times when the network connection is edited, that changing to "off" and need to enabled again.

    Hi VLouis,

    thank you very much for your idea.

    I found the option but it already was enabled.

    After a black-out/ hard shut-down the Pi, the wifi says "failure". After choosing the "connect" option manually, the wifi is marked as connected without any problem.

    Could you or anybody else please test it? Just switch off the power and on again, and see what it does?

    My Pi is newly setup with LibreELEC 9.2.4 which is the last recommended version for the 3B model.

  • Same problem on RasPi 4 with LubreELEC 11 and 12. Instead of manually connecting after a blackout, what also works is just rebooting from LibreELEC. So that makes it clear that autoconnect is still enabled. It's just that the hard shutdown causes some problem.

  • I think that is a result of the some "things", and one of them is the weak RPi wifi antenna on all versions.
    Two thing you should try:

    Install the latest LE nightly (LE12 - very stable, I'm using it too, or/and the LE13).

    Try to use a better connection. If you have any chance to use cable, forget the Wifi at RPi. If you can't, try to use a USB-wifi stick, one with a "bigger" antenna.

    I'm made a modification on my RPi3B to be able to connect an external wifi antenna, the wifi is far better, but for this it's need a really advanced soldering skill. With this and with the latest LE12 nightly, I didn't remember when I had a wifi issue last time.

  • Nope, definitely not the antenna, or it wouldn't be so reproducible. It's only after cold boot. Never after reboot. 100%. RPi is next to the AP.

    The problem exists since at least 11. Why would a nightly solve it? There's nothing in the changelogs.

    How would using a cable solve a WiFi problem? I am not complaining about connectivity issues, but about a WiFi problem.

    It's more likely a problem with iwd and/or the WiFi driver.

  • I had some similar issues in the past, and just added a small script to crontab to force a connman restart when there's no connection.

    Something like this:

    in crontab (each 3 minute of the hour, test connection. The --reset-network parameters restarts connman if needed):

    Code
    03 * * * * /storage/bin/network-connection-test.sh --reset-network

    the script:

  • The problem exists since at least 11

    This eliminates iwd from suspicion as LE11 uses wpa_supplicant and LE12 onwards uses iwd.

    So it's either something in ConnMan or perhaps the underlying brcmfmac kernel driver. I'd be thinking in the direction of ConnMan first as its responsible for managing connection state. Updating to an LE13 nightly will bump ConnMan (and the kernel driver) to the latest versions available. There no guarantee that solves anything, but it would be a local step forwards.

  • Hm, maybe both. (I have to add I am not so sure anymore about the behavior in 11.) Bc after cold boot it will also ask for the wifi password when I try to connect manually. However, as I said, after reboot it works fine again. So the password is still remembered. So it seems as if the system or ConnMan think that the authentication didn't work.

    I also tried the suggested script but it can't fix all issues. First, the 'systemctl restart connman' does fix the underlying problem: after running this command I can (manually) reconnect to the WiFi without having to enter the password, but it doesn't do so automatically. So manually is the issue, bc now all services complain after boot that there were obviously 'errors in name resolution'.

    I also tried putting the systemctl restart connman command to the autostart.sh script, but looks like the timing there isn't right. I can have it wait so that I at least can manually connect, but it won't do the auto connect, unfortunately (yes, auto connect is set to true!).

    Probably I could adjust the script to connect to the specific wifi profile, but that would lock it to my specific wifi. Well, would be good enough workaround but ideally I'd like to at least identify the underlying root cause!

  • Oh, did I make it clear enough that WiFi also works if I shut the RPi4 down before booting? So it's not EVERY cold boot, just cold boot after sudden power loss. Doesn't mean it can't be driver releated.

  • Doesn't mean it can't be driver releated.

    You got till now from two people the advice to install an LE13 nightly build and try it. So if you don't have a cheap, at least 8GB SDcard and a hour for this... I let you to keep wondering what could be wrong... Also keep in your mind, you aren't the single person who use an RPi3 with LE and wifi connection. So using the search function on this forum could help too.

  • Sudden power loss denies the OS (and services running) the opportunity to shut-down gracefully/cleanly so my uneducated guess is that some kind of session/state data is not cleared and it's presence during boot results in something like ConnMan not seeing that a new connection is required; as it believes one already exists or something of that nature.

    The way to investigate that kind of wild-ass theory s starting ConnMan in debug mode (add 'debugging' to boot params in cmdline.txt) and with persistent logging enabled from the settings add-on, as ConnMan debug output is quite verbose and the default system log size will result in log rotation before you've had a chance to login and look.

    ConnMan logs are somewhat human readable .. look for errors. Feel free to pastebin them somewhere (don't upload here please).

  • As I'm using almost same config, RPi3B, wifi (mod. for external antenna), and latest LE12 nightly. So I pulled of the power and connected back after few seconds. The LE booted without any wifi issue...

  • Also keep in your mind, you aren't the single person who use an RPi3 with LE and wifi connection. So using the search function on this forum could help too.

    Yeah, that's how I ended up in this thread! Although I am using RPi4.

    So I pulled of the power and connected back after few seconds. The LE booted without any wifi issue...

    And WiFi automatically connected to your AP after that?

    You got till now from two people the advice to install an LE13 nightly build and try it. So if you don't have a cheap, at least 8GB SDcard and a hour for this

    I will! But yeah, I actually don't have a spare card lying around :/.

    ConnMan logs are somewhat human readable .. look for errors. Feel free to pastebin them somewhere (don't upload here please).

    Will try looking at it! Always been a bit difficult for me figuring out where logfiles are with Kodi or LE in general. I also believe some state gets stuck for whatever weird reason.

    I'm using almost same config, RPi3B, wifi

    3B or 3B+? 3B uses a different WiFi chip (Broadcom BCM43438) than RPi3B+/RPi4 (both Cypress CYW43455). So that would also point to a driver-related issue.

  • And WiFi automatically connected to your AP after that?

    Exactly, and I tried again that (latest LE12 nightly on the card) still without wifi issue. And because last week I wanted to try the LE13 nightly, I still have it on a spare card. Using the LE13, I tried twice the same thing with power off then on, and no wifi issue. In the past, I had wifi issues: started the TV (the RPi it's always on), the LE asked for wifi password but didn't accepted or sometimes just started without wifi connected, after a reboot started without issue. Could be the same issue?

    3B or 3B+? 3B uses a different WiFi chip (Broadcom BCM43438) than RPi3B+/RPi4 (both Cypress CYW43455). So that would also point to a driver-related issue.

    Maybe yes, or maybe it's already fixed in the nightly builds whatever it was. If you don't have a spare card, you could make an LE backup, then update to latest LE12 nightly (because you can go back to LE12 stable if you will want it, the downgrade from LE13 not guaranteed) and try it...

    Nope, definitely not the antenna, or it wouldn't be so reproducible. It's only after cold boot. Never after reboot. 100%. RPi is next to the AP.

    If the RPi is next to your AP and you have any chance to use cable instead wifi, don't hesitate, change it. Far better speed, without issues. I have 3 RPi's with LE installed and at only one had wifi problems (no way to use cable in that place). The another two with cable connetion to my router, never had any network issue in the last years.