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 :-)