0

I have setup a Raspberry Pi 4 with a basic Home Assistant installation, and the RPi seems to drop the Wifi connection randomly - i.e. I am not able to connect to it from another device. I can "force" the RPi to properly connect to Wifi again, if I tell the DHCP server (in my router) to reconnect the RPi.

What would be the first thing to check (log files etc.) in the RPi to debug this?

EDIT: I think I found relevant information in /var/log/syslog as follows:

Feb 11 19:37:23 raspberrypi NetworkManager[340]: <warn>  [1581446243.2267] dhcp4 (veth16840be): request timed out
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.2268] dhcp4 (veth16840be): state changed unknown -> timeout
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.2926] dhcp4 (veth16840be): canceled DHCP transaction, DHCP client pid 1096
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.2927] dhcp4 (veth16840be): state changed timeout -> done
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.2941] device (veth16840be): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed')
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.2968] manager: NetworkManager state is now CONNECTED_LOCAL
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <warn>  [1581446243.2990] device (veth16840be): Activation: failed for connection 'Wired connection 6'
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3009] device (veth16840be): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Withdrawing address record for fe80::d50b:46d2:cac2:6689 on veth16840be.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Leaving mDNS multicast group on interface veth16840be.IPv6 with address fe80::d50b:46d2:cac2:6689.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Interface veth16840be.IPv6 no longer relevant for mDNS.
Feb 11 19:37:23 raspberrypi dhcpcd[593]: veth16840be: pid 340 deleted route to 169.254.0.0/16
Feb 11 19:37:23 raspberrypi dhcpcd[593]: veth45aca9d: adding default route
Feb 11 19:37:23 raspberrypi dhcpcd[593]: veth16840be: adding route to 169.254.0.0/16
---> Feb 11 19:37:23 raspberrypi dhcpcd[593]: wlan0: deleting route to 192.168.27.0/24
---> Feb 11 19:37:23 raspberrypi dhcpcd[593]: wlan0: deleting default route via 192.168.27.1
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Withdrawing address record for 169.254.107.61 on veth16840be.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Leaving mDNS multicast group on interface veth16840be.IPv4 with address 169.254.107.61.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Interface veth16840be.IPv4 no longer relevant for mDNS.
Feb 11 19:37:23 raspberrypi dhcpcd[593]: veth16840be: pid 340 deleted IP address 169.254.107.61/16
Feb 11 19:37:23 raspberrypi dhcpcd[593]: veth16840be: deleting route to 169.254.0.0/16
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3380] policy: auto-activating connection 'Wired connection 6' (e7dec89a-ed16-3768-b320-3b39f0e5ef0a)
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3424] device (veth16840be): Activation: starting connection 'Wired connection 6' (e7dec89a-ed16-3768-b320-3b39f0e5ef0a)
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3436] device (veth16840be): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3466] manager: NetworkManager state is now CONNECTING
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3473] device (veth16840be): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3491] device (veth16840be): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3500] dhcp4 (veth16840be): activation: beginning transaction (timeout in 45 seconds)
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3564] dhcp4 (veth16840be): dhclient started with pid 1117
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Joining mDNS multicast group on interface veth16840be.IPv6 with address fe80::81ef:965d:9273:bda4.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: New relevant interface veth16840be.IPv6 for mDNS.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Registering new address record for fe80::81ef:965d:9273:bda4 on veth16840be.*.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Withdrawing address record for fe80::81ef:965d:9273:bda4 on veth16840be.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Leaving mDNS multicast group on interface veth16840be.IPv6 with address fe80::81ef:965d:9273:bda4.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Interface veth16840be.IPv6 no longer relevant for mDNS.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Joining mDNS multicast group on interface veth16840be.IPv6 with address fe80::a028:68dd:91d:5fee.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: New relevant interface veth16840be.IPv6 for mDNS.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Registering new address record for fe80::a028:68dd:91d:5fee on veth16840be.*.
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3624] device (veth16840be): ipv6: duplicate address check failed for the fe80::81ef:965d:9273:bda4/64 lft forever pref forever lifetime 194827-0[4294967295,4294967295] dev 23 flags permanent,noprefixroute,tentative src kernel address
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Withdrawing address record for fe80::a028:68dd:91d:5fee on veth16840be.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Leaving mDNS multicast group on interface veth16840be.IPv6 with address fe80::a028:68dd:91d:5fee.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Interface veth16840be.IPv6 no longer relevant for mDNS.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Joining mDNS multicast group on interface veth16840be.IPv6 with address fe80::d50b:46d2:cac2:6689.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: New relevant interface veth16840be.IPv6 for mDNS.
Feb 11 19:37:23 raspberrypi avahi-daemon[319]: Registering new address record for fe80::d50b:46d2:cac2:6689 on veth16840be.*.
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <info>  [1581446243.3643] device (veth16840be): ipv6: duplicate address check failed for the fe80::a028:68dd:91d:5fee/64 lft forever pref forever lifetime 194827-0[4294967295,4294967295] dev 23 flags permanent,noprefixroute,tentative src kernel address
Feb 11 19:37:23 raspberrypi NetworkManager[340]: <warn>  [1581446243.3644] device (veth16840be): linklocal6: failed to generate an address: Too many DAD collisions
Feb 11 19:37:23 raspberrypi dhcpcd[593]: veth16840be: probing for an IPv4LL address
Feb 11 19:37:23 raspberrypi dhclient[1117]: DHCPDISCOVER on veth16840be to 255.255.255.255 port 67 interval 8

I marked two lines in the log above with "--->", which could be related to my question. I found three instances of these lines, which matches perfectly with the three times I have experienced the disconnections.

The log files are packed with sections like these (without the lines that I marked), which are repeated every minute or so. It seems NetworkManager is doing "something" to the ethernet (which is not connected) (??).

What could cause the deletion of the WLAN routes in the log, and can I stop NetworkManager from repeating these things with the ethernet?

Thanks :-)

4
  • 2
    Hello and welcome – By "drop the Wifi connection randomly", do you mean that the wireless connection has been failing? – And, "if I tell the DHCP server (in my router) to reconnect the RPi", how is it possible? Commented Feb 12, 2020 at 8:33
  • 1
    "What would be the first thing" ask a proper question with some information about what you did
    – Milliways
    Commented Feb 12, 2020 at 8:58
  • @m-rostami: Thank you. It means that I am unable to connect to the RPi from another device - until I "force" the RPi to reconnect, which is possible from Unifi (part of the Ubiquity line of products). I don't quite know how it works, but I guess the RPi is kicked from the network, and the RPi will then just reconnect.
    – JRHansen
    Commented Feb 12, 2020 at 9:21
  • "can I stop NetworkManager from repeating these things" YES delete NetworkManager
    – Milliways
    Commented Feb 12, 2020 at 11:42

2 Answers 2

3

You are using Raspbian. It does not support NetworkManager. At a first glance at the log it seems that default dhcpcd networking is fighting against NetworkManager. Maybe the Home Assistant installation isn't compatible with Raspbian and break its networking. Disable NetworkManager and look if it fix the problem.

2
  • I disabled NetworkManager with sudo systemctl disable NetworkManager and rebooted. I will get back to accept your reply as the answer, if the issue seems to disappear. Thanks in advance! :-)
    – JRHansen
    Commented Feb 12, 2020 at 12:15
  • Yes! 24 hours without any drop outs! Thanks for you help :-)
    – JRHansen
    Commented Feb 13, 2020 at 20:35
2

Kernel logs (dmesg) are a good place to start if you suspect a hardware problem. For WiFi connectivity issues, running wpa_supplicant manually with -d and -f options is quite helpful too.

There are tons of scripts already written (example) which periodically check for network status and force a reconnection if an anomaly is detected.

Looking at the log you have added, you seem to have Ethernet interface enabled and not connected to anything, so the network manager keeps on trying to get a DHCP lease and failing. Not sure if your WiFi troubles are related to it, but disabling it would at least keep your log clean and save you some CPU time.

1
  • Thanks for the answer, which pointed me in the direction of /var/log/syslog. I updated my question with additional information :-)
    – JRHansen
    Commented Feb 12, 2020 at 9:55

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.