i am running a raspberry pi B+ headless and losing network connection irregulary. I am living with that since a few years, but now want to fix the problem. What would be a good approach to find out the reason?


  • ssh connection to PI not possible sometimes (today failing nearly constantly, otherwise every few days)
  • Active ssh connection aborted
  • PI cannot get internet data (pinging google fails)


  • Raspberry PI B+
  • WIFI USB Adapter EDIMAX EW 7811Un
  • My own app (digital picture frame) is running on python 3 and QT5.7

My countermeasures so far

  • self implemented software wachdog that checks some connection parameters and reboots if necessary (i would say works in 95% of the cases)
  • Auto PowerOff deactivated for the Wifi adapter by setting rtw_power_mgnt=0 and rtw_enusbss=0 in /etc/modprobe.d/8192cu.conf


  • My WIFI connection at home sometimes gets interrupted as well. But far less often than the connection to the PI fails
  • I know that similar questions have been asked before, but i was not able to adapt them to my specific problem, sorry.

Thanks for any directions


  • 1
    "checks some connection parameters and reboots if necessary" -> It can never be necessary to reboot just to fix a basic connection issue (with the exception of some driver bugs, but as far as I've noticed this is not a problem on the Pi using the built-in interfaces, and I believe 8192cu is also fine). Put another way: You need to determine how to start, stop, and restart networking connectivity properly. On current Rasbpian this should be as simple as sudo systemctl restart dhcpcd, but YMMV.
    – goldilocks
    Dec 15, 2019 at 20:11
  • @goldilocks: Thanks for the "hdcpcd restart command", i didn't know it and will try it. 1) Now, how would i detect, that the connection is broke and i should restart it? 2) How could i now find out the reason, so i can fix it and don't need a restart at all?
    – Ben
    Dec 16, 2019 at 12:44
  • Here's some suggestions about using ping by me from a few years ago. It's not a perfect technique (it is not very responsive as it means it can be offline for a minute depending on what you set the timings to, which is not such a big deal for a headless Pi on the LAN, but irritating if it is a laptop, etc). Currently I'm using dhcpcd hooks instead (see man dhcpcd-run-hooks), but that is probably a bit too technical.
    – goldilocks
    Dec 16, 2019 at 14:15
  • BTW, if you don't shell script but are comfortable coding in python or something, use that instead as shell has a lot of gotchas, which is a PITA when the context is a background thing that only does important things on occasion (not a good learning context). That said, the verbatim script from that answer is not too brittle, but it does use a non-standard form of networking (dhclient + wpa_supplicant, no corresponding system service) which you would probably want to replace with the current Raspbian norm (systemctl ____ dhcpcd).
    – goldilocks
    Dec 16, 2019 at 14:15
  • How did you verify that the problem is definitely the RasPi and not your home router, or any other component?
    – Ingo
    Dec 17, 2019 at 16:36

1 Answer 1


A few thoughts :-

  • This post shows a couple of possibilities. https://www.raspberrypi.org/forums/viewtopic.php?t=129021 MrEngman I gather wrote a helpful installer script for the Edmix range of Wifis. Research a bit more yourself before trying these perhaps.

    1) Remove ifplugd

    apt-get purge ifplugd

    2) Disable any conflicting drivers, read in more detail before doing anything, but e.g.

    blacklist rtl8192cu
    blacklist rtl8xxxu.conf
  • Have you tried updating your raspbian/kernel/firmware? It might help fix the situation. https://www.raspberrypi.org/documentation/raspbian/updating.md

    sudo apt update
    sudo apt full-upgrade
  • It may be possible that your power supply may be a bit too weak/unreliable to drive the USB wifi.

  • I remember my EDIMAX clone wifi being quite cheap and a pain to setup and use. Buying a different brand may help, though I notice the Pi brand can have this problem too.

  • Treat yourself to a newer Pi with built-in Wifi ;)

Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.