WiFi lost, auto-reconnects only after minutes

  • I have read many posts talking about issues wirh pi4 and LE10, but if instead for you it's working, then why not giving it a try?

    It's an attempt I can do.

    I do not have a spare SD so I am backing it up (dd'ing) and once I am done, I will do a scratch install - anyway I don't think I am going to play with LE9 anymore....

    Thanks for your hint, I will play with it and report my findings.

    BTW, can I ise TVH 4.3.3 instead of 4.3.2 under LE10? I understood the "unstable" version of TVH is much more up-to-date but LE9 doesn't let me chose it.

  • I'm back, after doing various attempts.

    First of all, I backed up my LE9 SD card and I have to say that Win32 Disk Imager always gives me issues, so I used dd to copy the card to an image in my (old) mac. This takes around 3h.... Maybe there is a better way.

    Anyhow, I first installed LE10 and used TVH 4.3.3 as a server. Installation was smooth and all the tweaks I did in config.txt to make my TV work under LE9 weren't needed (actually, I initially copied them from LE9 to LE10 and I couldn't see anything in my TV, so I removed them and it all worked). I also checked the brcm firmware and was up-to-date, I could also update the BootLoader (I don't exactly know what it is, but I did it).

    WiFi looked very stable, I normally have wifi flapping apart from hard disconnection but I tested it for 4 hours and I never saw any disconnection.

    The problem is that TVH couldn't find the TV channels I was looking for. There is a mux at 626Mhz, where TVH could see 3 services but these weren't mapped to any channels. Here below, what I should get from 626Mhz

    As you see, TVH sees the mux, scan is OK, 4 services are found (why 4?), 0 are mapped to a channel

    If I go to the services tab, though, I do not see anything under the 626Mhz

    This means that I cannot record anything from Rai3 because I just cannot find it.

    I played quite a lot of time with the configuration but I couldn't do anything to solve the issue.

    I then uninstalled TVH 4.3.3 (also because the TV scans always stopped at 97%) and installed TVH 4.2.x. In this case, TV scan reached 100% but I couldn't find Rai3 either, so I gave up.

    I saved the image and went back to LE9 (dd took around 5 hours!) and this morning I run it again. I had forgotten the TVH Server GUI password, but after some research I have discovered it is uuencoded in the passwd folder, so I could enter it again.

    I did found Rai3 HD this time, I see the services and the channels, I see the EPG, I can watch the channel. Strange thing is that the mux scan shows "FAILURE"

    Anyhow, I see the channels (all the three services which are Rai2 HD, Rai3 HD and RaiSport+) and I can watch them.

    Of course I still had the network issue so this time I have given it a try and I have updated the brcm firmware

    Kodi GUI says that the bootloader is still updated to 2021 (I think the first time I used LE9 it was showing a different date, maybe upgrading it from LE10 made this change persistent? Maybe it's not SD dependent?), so there's nothing else I can upgrade.

    I will now leave the system on for a while to see if I lose connection. I have disabled the script that tried to reconnect automatically, so let's see.

    I will also report the TVH issue in the TVH forum to see what people say.

    I will keep you posted.

    [EDIT]

    So far, no wifi issues anymore. I will keep this configuration for a while, let's see.

    Case closed, for the moment.

    Thanks for helping!

    Edited once, last by ciclista71 (July 6, 2021 at 4:37 PM).

  • Well,

    it all happened again. Disconnections are way less frequent, but intrestingly, it looks like I lose connection when I am playing a video while it's been recorded. The server keeps recording and storing the video to the NAS but the client cannot connect to the server anymore.

    During August I will play with different configurations

  • Well,

    it all happened again. Disconnections are way less frequent, but intrestingly, it looks like I lose connection when I am playing a video while it's been recorded. The server keeps recording and storing the video to the NAS but the client cannot connect to the server anymore.

    During August I will play with different configurations

    Goes back to one of my early points, specifically about saturating the SDIO bus with the built-in WiFi. The built-in Wi-Fi is not usable for HD playback & recordings on the Raspberry Pi, in my opinion.

    I would suggest plugging in an ethernet cable, or moving your video recording to a machine that is on your network. I don't know what encoding or bitrates & resolutions your recordings are, but HD 1080p MPEG2 can run around 20Mb/s and probably higher for some scenes. I could see this easily saturating your SDIO bus and causing timeouts with WiFi, especially if your recording a few channels and playing back video.

  • frakkin64, I don't think the BUS gets saturated because I have issues only when playing the videos, but not when recording them.

    What I have noticed is instead something that may have nothing to do with WiFi, and I will explain why:

    If I play a video while it's being recorded, after around 30 minutes I get a client disconnection and from that moment on, least for 10 minutes, I cannot resume the connection even if I disable and re-enable the PVR Player.

    No matter what, the TV Program gets recorded without any issues and actually, I can watch it with VLC.

    If instead I play a video after it's been recorded, everything goes fine.

    I see this because every Wednesday I get the issue (and it's when I record the program) but on Thursday or in other days, it's all good.

    For this reason I will do the following attempts:

    - But back the latest LE + Kodi Release, record and play while recording to see if the new TVH client is better

    - While recording, use a different player (I have a FireTV with an older Kodi instance) to see if this leads to the same issues

    - While recording, play the video with a different player (Kodi, through the files section or VLC from my PC)

    According to what I find, I will decide what to do.

    I have read of other people having this issue of getting disconnected while playing a video being recorded and even if they used ethernet cable, still the problem wasn't solved. And actually, how can it be that the client cannot connect to the server if they are both on the same machine? It cannot be network dependent if the loopback is involved!

    I'm going on holiday tomorrow, so I will resume my analysis in August when I am back.

    That's a really tough issue... TV programs will switch to HD in September and I need to solve my problems by then, as my legacy PVR only supports SD and therefore I will have to rely only on my pi4.

  • OK,

    During the last week I upgraded from LE10 to LE10RC1, but the behaviour is basically the same:

    Whenever there is a short network loss, connmand removes the IP address and the routes (and the same is notified by avahi), and three things happen:

    - TVH Server keeps recording the video, which is prolly locally stored and then sent to the NAS as soon as network recovers (I don't lose any frames when I watch it later)

    - PVR Simple IPTV Client cannot reconnect because there is no interface to use (they have been removed) and will succeed quite late (I saw improvements in LE10RC1, but still it's 3 to 4 minutes)

    - If I go to the Network Section of LE with the remote ands check the IP address, I will not see it (it's blank) and LE hangs (I need to unplug it and re-plug it)

    So, for me the issue is the way connman or avahi work whenever a connection is lost. I would expect the IP to stay there, and instead the routes, and DNS, everything is teared down. Strangely enough, the TVH server keeps working (I think it's saving locally and then flushing to the NAS as soon as network is up again)

    I tried to configure a static IP, but still, interfaces are removed.

    The problem is that only that Rpi has connection problems. I lose SSH connectivity to it but I can perfectly browse the NAS from my Windows PC which is over the same WiFi.


    I can't think of any other workaround.....

    Edited once, last by ciclista71 (September 1, 2021 at 11:21 AM).

  • Three suggestions - in order of best to least-best:

    a) Switch to Ethernet

    b) Switch to Ethernet connection to a wireless bridge

    c) Fix the network so it doesn't have dropouts (harder than it sounds sometimes)

    In B .. because the Ethernet link to the bridge device remains up at all times you don't see a dropout which results in the connman 'teardown' that you see when the link is lost on the wireless connection.

  • Switching to ethernet is too complicated because I am just opposite the router and I would need to lay a cable across the room, not easy and not nice.

    However, I have done another attempt, which is bringing the wifi down and up programmatically on my FritzBox router. I have created a python script that does the job. WiFi is taken down for three seconds and then up again.

    Now, when this happens, wpa_supplicant sees a connection drop with valid reason codes (2, 3 or 6), still I can see the teardown of the interfaces but the system is not affected. The connection doesn't drop, I keep watching what I was watching, I keep recording what I was recording.

    I can bring down the wifi like that many times and still, the behaviour will be perfect.

    The issue occur when the wpa_supplicant throws an error with reason=0 locally_generated=1. In that case, the system doesn't recover

    reason=0 is not one of the valid wpa_supplicant codes, though....

  • ciclista71

    regarding chewitt option c)

    what do your fritzbox log's say (wifi connect/disconnect option regarding log's ON ?)

    alas in german from a FB 7590:

    - left side: "Ereignisse"

    - right side, Top box: choose "WLAN"

    => Option to log wifi connects/disconnects and wifi info's

    you know that FB's do wifi channel scans from time to time (RADAR) and that there were a lot of complains moon's ago esp. with elder router firmware ?

    for further reading/investigation:

    FRITZ!Box tot? Recover, Firmware Up-/ Downgrade | IP Phone Forum

    wifi problems are mostly on both ends: the router and the client.

    a router setting working for years means not to fit the need of today ([maybe] your neighbours are in the "wifi-game" too) !

    P.S.

    a long enough cable with usefull color could also be layed an the floor following the walls or hidden under/nailed on the "skirting board"

    Edited 2 times, last by GDPR-7 (September 2, 2021 at 8:09 PM).

  • The FritzBox tells me about connections and disconnections, but actually I see it also for other devices (for which I do not get any issues whatsoever)

    I am using Firmware 07.28, installed on the 30th of August. Sometimes the device gets de-registered, sometimes is de-registers itself.

    I see similar messages also for my iPhone and my IP Cameras but I do not suffer network outages, amnd anyway there is nothing I can do about it.

    The 5Ghz channel is set manually to 40 (because I need it for the FireTV to work properly with 5Ghz).

  • Hello.

    For me fix the WiFi freeze is sdio patch from this source:

    Community - Silicon Labs
    The Silicon Labs Community is ideal for development support through Q&A forums, articles, discussions, projects and resources.
    community.silabs.com

    Adapted patch for new linux kernel (5.10.xx):

    Copy these code as patch file to the project directory, for example libreelec-10.0/projects/Allwinner/patches/linux/ or other your specific platform.

    Also you must to add new flag mmc-reply-go-idle to the DTS file of your device in the mmc node (where is sdio-wifi connected).

    For example of my patch for my Orange-Pi Lite device:

    Good luck.

    Edited once, last by Deoptim (February 22, 2022 at 7:32 PM).

  • Time has passed and in the meantime I have upgraded to LE10, latest version (and I have to say I am extremely happy about the de-interlacing feature, wow!).

    WiFi drops are very rare and they don't affect performance or network connectivity, as they last between 4 to 6 seconds only and the connection doesn't drop. The latest version and firmware were key, I believe.

    But I have another big problem, that was present even before, I think: at least once a day I get the following error:

    Code
    LibreELEC kernel: nfs: server 192.168.1.120 not responding, still trying

    This occurs about 4 minutes after the connection with my NAS is lost and this status continues for about 10 minutes, when the router disconnects LibreELEC from the WiFi, reconnection takes place and the NFS FS comes up again

    Code
    Apr 03 21:13:55 Last data sent to InfluxDB (every 30s via a POST to a server located in a Raspberry at .132)
    
    
    Apr 03 21:17:06 LibreELEC kernel: nfs: server 192.168.1.120 not responding, still trying
    Apr 03 21:23:48 LibreELEC wpa_supplicant[509]: wlan0: CTRL-EVENT-DISCONNECTED bssid=dc:39:6f:xx:xx:xx reason=2
    Apr 03 21:23:53 LibreELEC wpa_supplicant[509]: wlan0: CTRL-EVENT-CONNECTED - Connection to dc:39:6f:xx:xx:xx completed [id=0 id_str=]
    Apr 03 21:24:03 LibreELEC kernel: nfs: server 192.168.1.120 OK
    
    
    Apr 03 21:24:07 Data recovered from InfluxDB

    The NAS is working properly and also the network connection, because I have other two RPi sending data to the server and at that very same time their connection was perfectly working. So it's not a server error. And, as you see, we would be talking about two servers going down: the NAS (at .120) and the Grafana server (at .133). The grafana server is not mounted, I just send a POST to it. The NFS instead is mounted, as per the documentation.

    I created some monitoring scripts and found out a strange behaviour:

    WiFi is seen as UP and connection with the Router is established; however, at a certain point, the ARP table can't find the MAC for the NAS (and also for the other Raspberry). When the WiFi gets disconnected and reconnected, everything comes back:

    Now,

    I wonder if I can decrease this long timeout between NFS down (4 minutes after the MAC Address is lost) and WiFi Reconnection (which takes places about 10 minutes after the down - wifi reconnection seems to solve the problem).

    During this time, if I am watching a recorded program, TVH client and server will fail and I will have to wait until it recovers.

    10 minutes is a very long time!

    Thanks for helping!