MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.81k stars 494 forks source link

WireGuard intermittent handshake succes #3669

Closed bbsixzz closed 4 years ago

bbsixzz commented 4 years ago

Hello,

I have a WireGuard setup that works intermittently over 4G (iPhone SE 2016 latest iOS) following this standard procedure https://www.vikash.nl/setup-wireguard-vpn-server/.

The server runs on a Pi Zero W using WiFi, the router is a Netgear Orbi (RBR850) and the throughout is very good (both LAN/WAN) without any neighboring networks.

When the connection fails the log shows this:

Handshake did not complete after 5 seconds, retrying (try 2)

I can see the client connecting to the WireGuard server each time in the router logs, but the handshake fails seemingly at random.

There are periods (say 10 min) when it connects with no issues, then there are other periods where the handshake fails and I give up only to have it work again 30 min later.

I move between 1 to 2 out of 5 4G bars but the connection is stable.

I bought this Pi Zero as a stopgap solution until https://github.com/MichaIng/DietPi/issues/3285 could be implemented.

Please help if you have any ideas, cheers

Joulinar commented 4 years ago

Hi,

many thanks for your report. Do you use IPv4 as well as IPv6? Or IPv4 only?

bbsixzz commented 4 years ago

The router has IPv6 disabled.

This is my wg0.conf

Address = 10.9.0.1/24
PrivateKey = XXX KXWs=
ListenPort = 51820

PreUp = /boot/dietpi/func/obtain_network_details
PostUp = sysctl net.ipv4.conf.%i.forwarding=1 net.ipv4.conf.$(mawk 'NR==3' /run/dietpi/.network).forwarding=1
PostUp = sysctl net.ipv6.conf.$(mawk 'NR==3' /run/dietpi/.network).accept_ra=2
PostUp = sysctl net.ipv6.conf.%i.forwarding=1 net.ipv6.conf.$(mawk 'NR==3' /run/dietpi/.network).forwarding=1
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o $(mawk 'NR==3' /run/dietpi/.network) -j MASQUERADE
PostUp = ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o $(mawk 'NR==3' /run/dietpi/.network) -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o $(mawk 'NR==3' /run/dietpi/.network) -j MASQUERADE
PostDown = ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o $(mawk 'NR==3' /run/dietpi/.network) -j MASQUERADE

# Client 1
[Peer]
PublicKey = XXX 3+Xg=
AllowedIPs = 10z.9.0.2/32

# Client 2
[Peer]
PublicKey = XXX Q1QA=
AllowedIPs = 10.9.0.3/32

# Client 3
[Peer]
PublicKey = XXX mNAY=
AllowedIPs = 10.9.0.4/32

This is my wg0-client.conf

Address = 10.9.0.2/24
PrivateKey = XXX gvFk=

# Comment the following to preserve the clients default DNS server, or force a desired one.
DNS = 192.168.1.1

# Kill switch: Uncomment the following, if the client should stop any network traffic, when disconnected from the VPN server
# NB: This requires "iptables" to be installed, thus will not work on most mobile phones.
#PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
#PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT

[Peer]
PublicKey = XXX 6hl4=
# Tunnel all network traffic through the VPN:
#       AllowedIPs = 0.0.0.0/0, ::/0
# Tunnel access to server-side local network only:
#       AllowedIPs = 192.168.1.0/24
# Tunnel access to VPN server only:
#       AllowedIPs = 192.168.1.3/32
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint =XXX.mynetgear.com:51820

# Uncomment the following, if you're behind a NAT and want the connection to be kept alive.
#PersistentKeepalive = 25

This is my wg output


interface: wg0
  public key: XXX 6hl4=
  private key: (hidden)
  listening port: 51820

peer: XXX 3+Xg=
  endpoint: XXX :64583
  allowed ips: 10.9.0.2/32
  latest handshake: 10 seconds ago
  transfer: 6.32 MiB received, 29.46 MiB sent

peer: XXX Q1QA=
  allowed ips: 10.9.0.3/32

peer: XXX mNAY=
  allowed ips: 10.9.0.4/32

Then maybe 10 min later I will have handshake issues, but only if I disconnect! The VPN is solid as long as it's kept on.

Joulinar commented 4 years ago

@bbsixzz

do you have issues with all clients? Because, only Client 1 has been connected since the last time Wireguard Server restarted.

The handshake issue, does it happen on client or server side? Just for testing, can you change on client device the Endpoint from xxx.mynetgear.com to your external IP address?

bbsixzz commented 4 years ago

Here's my second client connecting, it's a MacBook using the iPhone as a hotspot:

interface: wg0
  public key: XXX 6hl4=
  private key: (hidden)
  listening port: 51820

peer: XXX Q1QA=
  endpoint: XXX 155.39:38709
  allowed ips: 10.9.0.3/32
  latest handshake: 39 seconds ago
  transfer: 211.53 KiB received, 150.43 KiB sent

peer: XXX +Xg=
  endpoint: XXX 155.39:64976
  allowed ips: 10.9.0.2/32
  latest handshake: 1 minute, 43 seconds ago
  transfer: 6.90 MiB received, 30.09 MiB sent

peer: XXX mNAY=
  allowed ips: 10.9.0.4/32

As you can see they are using the same IP, both connect fine; for now.

I've tried changing the Endpoint to the external IP address with no success.

The handshake issue shows up in the iPhone WireGuard app log, I have no way of seeing the server side because I'm not on location to connect to it locally. I can see the connection being made in the router log because I can monitor it remotely, so whatever is wrong seems to be happening on the server and/or iOS. It's real tricky to troubleshoot.

I've also rebooted the router and Pi Zero multiple times.

[EDIT]

I copied client 3 config onto the iPhone (client 1), works fine.

If I have a handshake issue again I can test both on the iPhone and see if it makes a difference.

peer:XXX mNAY=
endpoint: XXX 155.39:61628
allowed ips: 10.9.0.4/32
latest handshake: 9 seconds ago
transfer: 340 B received, 572 B sent
Joulinar commented 4 years ago

question would be, if your MacBook will have similar issue at same time as your iPhone. Maybe there is a general connection/ internet access issue to your home at this moment? Hard to say. Usually you would need to do package capturing on your router, to see if packages are arriving from external

bbsixzz commented 4 years ago

Both MacBook and iPhone have the issue simultaneously after some testing.

I activated VPN server on the router which uses OVPN, it always works when WireGuard fails.

This leads me to believe there is either something wrong with WireGuard as a protocol, or DietPi.

Joulinar commented 4 years ago

hmm I'm using WireGuard without issues and atm you are the only one reporting it. Can you do some package tracing on your router. Would be good to see how network packages will looks like once issue occurs. You should see something like this if all goes fine

picture
bbsixzz commented 4 years ago

Actually I have something better, I just realized while connected to the router OVPN that I couldn't access the Pi Zero when WireGuard is failing handshakes.

When WireGuard works I can also access the machine using the router OVPN.

It seems for some reason the Wi-Fi on the Pi Zero is occasionally failing.

Any tips on how to check some logs so I can share here next time I have access?

[EDIT]

I've enabled auto reconnect for the Wi-Fi adapter, it was disabled by default. Is that really a good idea?

Maybe this will help, I'll do more testing today.

Joulinar commented 4 years ago

yes indeed a flapping WiFi is a good reason for connection issues.

bbsixzz commented 4 years ago

Well everything is rock solid now.

Why is auto reconnect disabled by default for the WiFi adapter? This was the culprit, shouldn't it be enabled by default?

On a tangent, are there logs on the Pi to spot the connection dropping? It would be great to have some actual proof.

MichaIng commented 4 years ago

IMO its good to not have auto-reconnect enabled by default. Its good for admins to know about unstable WiFi in the first place. Auto-reconnect checks connection every 10 seconds, so there are small time frames of failing requests which one can then associate. Also auto-reconnect causes issues when the WiFi is for local network connection only while the default gateway is on a different network adapter. We can reconsider when the planned network setup rework is done, which includes configuring adapters as main (internet) adapters or for other purpose (AP, LAN only, fallback internet adapter, ...) to enable auto-reconnect by default when a WiFi interface is setup as main internet interface.

bbsixzz commented 4 years ago

Very well!

What about logs I can check for disconnects on the Pi?

MichaIng commented 4 years ago
journalctl -u dietpi-wifi-monitor

If you use it, else without running some request log daemon not 100% sure, does wpasupplicant produce a log when the connection is lost? journalctl -u wpa_supplicant@wlan0

bbsixzz commented 4 years ago
root@DietPi:~# journalctl -u dietpi-wifi-monitor
-- Logs begin at Sat 2020-07-11 16:15:39 BST, end at Tue 2020-07-14 15:09:03 BST. --
Jul 14 03:25:54 DietPi systemd[1]: Starting DietPi-WiFi-Monitor...
Jul 14 03:25:54 DietPi systemd[1]: Started DietPi-WiFi-Monitor.
Jul 14 03:25:54 DietPi dietpi-wifi-monitor.sh[4626]: Checking connection for: wlan0 via ping to default gateway every 10 seconds
Jul 14 03:26:55 DietPi dietpi-wifi-monitor.sh[4626]: Detected connection loss: wlan0. Reconnecting...
Jul 14 03:26:55 DietPi dietpi-wifi-monitor.sh[4626]: ifdown: waiting for lock on /run/network/ifstate.wlan0
Jul 14 03:27:05 DietPi dhclient[4941]: Killed old client process
Jul 14 03:27:05 DietPi dietpi-wifi-monitor.sh[4626]: Killed old client process
Jul 14 03:27:06 DietPi dhclient[4941]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 03:27:06 DietPi dietpi-wifi-monitor.sh[4626]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 03:27:06 DietPi dietpi-wifi-monitor.sh[4626]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 03:27:06 DietPi dietpi-wifi-monitor.sh[4626]: All rights reserved.
Jul 14 03:27:06 DietPi dietpi-wifi-monitor.sh[4626]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 03:27:06 DietPi dietpi-wifi-monitor.sh[4626]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 03:27:06 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 03:27:06 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   Socket/fallback
Jul 14 03:27:06 DietPi dhclient[4941]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 03:27:06 DietPi dhclient[4941]: All rights reserved.
Jul 14 03:27:06 DietPi dhclient[4941]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 03:27:06 DietPi dhclient[4941]: 
Jul 14 03:27:06 DietPi dhclient[4941]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 03:27:06 DietPi dhclient[4941]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 03:27:06 DietPi dhclient[4941]: Sending on   Socket/fallback
Jul 14 03:27:06 DietPi dhclient[4941]: DHCPRELEASE of 192.168.1.3 on wlan0 to 192.168.1.1 port 67
Jul 14 03:27:06 DietPi dietpi-wifi-monitor.sh[4626]: DHCPRELEASE of 192.168.1.3 on wlan0 to 192.168.1.1 port 67
Jul 14 03:27:08 DietPi wpa_supplicant[5003]: Successfully initialized wpa_supplicant
Jul 14 03:27:09 DietPi wpa_supplicant[5028]: wlan0: Trying to associate with SSID 'XXX'
Jul 14 03:27:10 DietPi dhclient[5045]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 03:27:10 DietPi dhclient[5045]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 03:27:10 DietPi dietpi-wifi-monitor.sh[4626]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 03:27:10 DietPi dietpi-wifi-monitor.sh[4626]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 03:27:10 DietPi dietpi-wifi-monitor.sh[4626]: All rights reserved.
Jul 14 03:27:10 DietPi dietpi-wifi-monitor.sh[4626]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 03:27:10 DietPi dhclient[5045]: All rights reserved.
Jul 14 03:27:10 DietPi dhclient[5045]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 03:27:10 DietPi dhclient[5045]: 
Jul 14 03:27:10 DietPi dhclient[5045]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 03:27:10 DietPi dietpi-wifi-monitor.sh[4626]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 03:27:10 DietPi dhclient[5045]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 03:27:10 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 03:27:10 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   Socket/fallback
Jul 14 03:27:10 DietPi dietpi-wifi-monitor.sh[4626]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
Jul 14 03:27:10 DietPi dhclient[5045]: Sending on   Socket/fallback
Jul 14 03:27:10 DietPi dhclient[5045]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
Jul 14 03:27:10 DietPi wpa_supplicant[5028]: wlan0: Associated with 3c:37:86:f4:99:18
Jul 14 03:27:10 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-CONNECTED - Connection to 3c:37:86:f4:99:18 completed [id=0 id_str=]
Jul 14 03:27:10 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Jul 14 03:27:10 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=DE
Jul 14 03:27:15 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-DISCONNECTED bssid=3c:37:86:f4:99:18 reason=1 locally_generated=1
Jul 14 03:27:15 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Jul 14 03:27:15 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=SE
Jul 14 03:27:15 DietPi wpa_supplicant[5028]: wlan0: Trying to associate with SSID 'XXX'
Jul 14 03:27:15 DietPi dhclient[5045]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
Jul 14 03:27:15 DietPi dietpi-wifi-monitor.sh[4626]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
Jul 14 03:27:16 DietPi wpa_supplicant[5028]: wlan0: Associated with 3c:37:86:f4:c5:97
Jul 14 03:27:16 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-CONNECTED - Connection to 3c:37:86:f4:c5:97 completed [id=0 id_str=]
Jul 14 03:27:16 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Jul 14 03:27:16 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=DE
Jul 14 03:27:21 DietPi dhclient[5045]: No DHCPOFFERS received.
Jul 14 03:27:21 DietPi dietpi-wifi-monitor.sh[4626]: No DHCPOFFERS received.
Jul 14 03:27:21 DietPi dietpi-wifi-monitor.sh[4626]: No working leases in persistent database - sleeping.
Jul 14 03:27:21 DietPi dhclient[5045]: No working leases in persistent database - sleeping.
Jul 14 03:27:21 DietPi dietpi-wifi-monitor.sh[4626]: Completed
Jul 14 03:27:24 DietPi dhclient[5045]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
Jul 14 03:27:24 DietPi dhclient[5045]: DHCPOFFER of 192.168.1.3 from 192.168.1.1
Jul 14 03:27:24 DietPi dhclient[5045]: DHCPREQUEST for 192.168.1.3 on wlan0 to 255.255.255.255 port 67
Jul 14 03:27:25 DietPi dhclient[5045]: DHCPACK of 192.168.1.3 from 192.168.1.1
Jul 14 03:27:25 DietPi dhclient[5045]: bound to 192.168.1.3 -- renewal in 33103 seconds.
Jul 14 03:32:15 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-DISCONNECTED bssid=3c:37:86:f4:c5:97 reason=6 locally_generated=1
Jul 14 03:32:15 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Jul 14 03:32:15 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=SE
Jul 14 03:32:16 DietPi wpa_supplicant[5028]: wlan0: Trying to associate with SSID 'XXX'
Jul 14 03:32:17 DietPi wpa_supplicant[5028]: wlan0: Associated with 3c:37:86:f4:99:18
Jul 14 03:32:17 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-CONNECTED - Connection to 3c:37:86:f4:99:18 completed [id=0 id_str=]
Jul 14 03:32:17 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Jul 14 03:32:17 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=DE
Jul 14 06:06:07 DietPi dietpi-wifi-monitor.sh[4626]: Detected connection loss: wlan0. Reconnecting...
Jul 14 06:06:07 DietPi dhclient[9976]: Killed old client process
Jul 14 06:06:07 DietPi dietpi-wifi-monitor.sh[4626]: Killed old client process
Jul 14 06:06:08 DietPi dhclient[9976]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 06:06:08 DietPi dietpi-wifi-monitor.sh[4626]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 06:06:08 DietPi dietpi-wifi-monitor.sh[4626]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 06:06:08 DietPi dietpi-wifi-monitor.sh[4626]: All rights reserved.
Jul 14 06:06:08 DietPi dietpi-wifi-monitor.sh[4626]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 06:06:08 DietPi dietpi-wifi-monitor.sh[4626]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 06:06:08 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 06:06:08 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   Socket/fallback
Jul 14 06:06:08 DietPi dhclient[9976]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 06:06:08 DietPi dietpi-wifi-monitor.sh[4626]: DHCPRELEASE of 192.168.1.3 on wlan0 to 192.168.1.1 port 67
Jul 14 06:06:08 DietPi dhclient[9976]: All rights reserved.
Jul 14 06:06:08 DietPi dhclient[9976]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 06:06:08 DietPi dhclient[9976]: 
Jul 14 06:06:08 DietPi dhclient[9976]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 06:06:08 DietPi dhclient[9976]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 06:06:08 DietPi dhclient[9976]: Sending on   Socket/fallback
Jul 14 06:06:08 DietPi dhclient[9976]: DHCPRELEASE of 192.168.1.3 on wlan0 to 192.168.1.1 port 67
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-DISCONNECTED bssid=3c:37:86:f4:99:18 reason=3 locally_generated=1
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=SE
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or direc
tory
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: nl80211: Failed to set IPv4 unicast in multicast filter
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or direc
tory
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: nl80211: Failed to set IPv4 unicast in multicast filter
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: nl80211: deinit ifname=p2p-dev-wlan0 disabled_11b_rates=0
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: p2p-dev-wlan0: CTRL-EVENT-TERMINATING
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Jul 14 06:06:09 DietPi wpa_supplicant[5028]: wlan0: CTRL-EVENT-TERMINATING
Jul 14 06:06:10 DietPi wpa_supplicant[10010]: Successfully initialized wpa_supplicant
Jul 14 06:06:11 DietPi wpa_supplicant[10013]: wlan0: Trying to associate with SSID 'XXX'
Jul 14 06:06:12 DietPi dhclient[10019]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 06:06:12 DietPi dhclient[10019]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 06:06:12 DietPi dietpi-wifi-monitor.sh[4626]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 06:06:12 DietPi dietpi-wifi-monitor.sh[4626]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 06:06:12 DietPi dietpi-wifi-monitor.sh[4626]: All rights reserved.
Jul 14 06:06:12 DietPi dietpi-wifi-monitor.sh[4626]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 06:06:12 DietPi dhclient[10019]: All rights reserved.
Jul 14 06:06:12 DietPi dhclient[10019]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 06:06:12 DietPi dhclient[10019]: 
Jul 14 06:06:12 DietPi dhclient[10019]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 06:06:12 DietPi dietpi-wifi-monitor.sh[4626]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 06:06:12 DietPi dhclient[10019]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 06:06:12 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 06:06:12 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   Socket/fallback
Jul 14 06:06:12 DietPi dietpi-wifi-monitor.sh[4626]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Jul 14 06:06:12 DietPi dhclient[10019]: Sending on   Socket/fallback
Jul 14 06:06:12 DietPi dhclient[10019]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Jul 14 06:06:12 DietPi wpa_supplicant[10013]: wlan0: Associated with 3c:37:86:f4:99:18
Jul 14 06:06:12 DietPi wpa_supplicant[10013]: wlan0: CTRL-EVENT-CONNECTED - Connection to 3c:37:86:f4:99:18 completed [id=0 id_str=]
Jul 14 06:06:12 DietPi wpa_supplicant[10013]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Jul 14 06:06:12 DietPi wpa_supplicant[10013]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=DE
Jul 14 06:06:20 DietPi dhclient[10019]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Jul 14 06:06:20 DietPi dietpi-wifi-monitor.sh[4626]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Jul 14 06:06:20 DietPi dhclient[10019]: DHCPOFFER of 192.168.1.3 from 192.168.1.1
Jul 14 06:06:20 DietPi dietpi-wifi-monitor.sh[4626]: DHCPOFFER of 192.168.1.3 from 192.168.1.1
Jul 14 06:06:20 DietPi dietpi-wifi-monitor.sh[4626]: DHCPREQUEST for 192.168.1.3 on wlan0 to 255.255.255.255 port 67
Jul 14 06:06:20 DietPi dhclient[10019]: DHCPREQUEST for 192.168.1.3 on wlan0 to 255.255.255.255 port 67
Jul 14 06:06:21 DietPi dhclient[10019]: DHCPACK of 192.168.1.3 from 192.168.1.1
Jul 14 06:06:21 DietPi dietpi-wifi-monitor.sh[4626]: DHCPACK of 192.168.1.3 from 192.168.1.1
Jul 14 06:06:21 DietPi dhclient[10019]: bound to 192.168.1.3 -- renewal in 42946 seconds.
Jul 14 06:06:21 DietPi dietpi-wifi-monitor.sh[4626]: bound to 192.168.1.3 -- renewal in 42946 seconds.
Jul 14 06:06:21 DietPi dietpi-wifi-monitor.sh[4626]: Completed
Jul 14 10:30:27 DietPi dietpi-wifi-monitor.sh[4626]: Detected connection loss: wlan0. Reconnecting...
Jul 14 10:30:27 DietPi dhclient[18072]: Killed old client process
Jul 14 10:30:27 DietPi dietpi-wifi-monitor.sh[4626]: Killed old client process
Jul 14 10:30:28 DietPi dhclient[18072]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 10:30:28 DietPi dietpi-wifi-monitor.sh[4626]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 10:30:28 DietPi dietpi-wifi-monitor.sh[4626]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 10:30:28 DietPi dietpi-wifi-monitor.sh[4626]: All rights reserved.
Jul 14 10:30:28 DietPi dietpi-wifi-monitor.sh[4626]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 10:30:28 DietPi dhclient[18072]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 10:30:28 DietPi dietpi-wifi-monitor.sh[4626]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 10:30:28 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 10:30:28 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   Socket/fallback
Jul 14 10:30:28 DietPi dietpi-wifi-monitor.sh[4626]: DHCPRELEASE of 192.168.1.3 on wlan0 to 192.168.1.1 port 67
Jul 14 10:30:28 DietPi dhclient[18072]: All rights reserved.
Jul 14 10:30:28 DietPi dhclient[18072]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 10:30:28 DietPi dhclient[18072]: 
Jul 14 10:30:28 DietPi dhclient[18072]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 10:30:28 DietPi dhclient[18072]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 10:30:28 DietPi dhclient[18072]: Sending on   Socket/fallback
Jul 14 10:30:28 DietPi dhclient[18072]: DHCPRELEASE of 192.168.1.3 on wlan0 to 192.168.1.1 port 67
Jul 14 10:30:28 DietPi wpa_supplicant[10013]: wlan0: CTRL-EVENT-DISCONNECTED bssid=3c:37:86:f4:99:18 reason=3 locally_generated=1
Jul 14 10:30:28 DietPi wpa_supplicant[10013]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Jul 14 10:30:28 DietPi wpa_supplicant[10013]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=SE
Jul 14 10:30:28 DietPi wpa_supplicant[10013]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or dire
ctory
Jul 14 10:30:28 DietPi wpa_supplicant[10013]: nl80211: Failed to set IPv4 unicast in multicast filter
Jul 14 10:30:28 DietPi wpa_supplicant[10013]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or dire
ctory
Jul 14 10:30:28 DietPi wpa_supplicant[10013]: nl80211: Failed to set IPv4 unicast in multicast filter
Jul 14 10:30:28 DietPi wpa_supplicant[10013]: nl80211: deinit ifname=p2p-dev-wlan0 disabled_11b_rates=0
Jul 14 10:30:29 DietPi wpa_supplicant[10013]: p2p-dev-wlan0: CTRL-EVENT-TERMINATING
Jul 14 10:30:29 DietPi wpa_supplicant[10013]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Jul 14 10:30:29 DietPi wpa_supplicant[10013]: wlan0: CTRL-EVENT-TERMINATING
Jul 14 10:30:30 DietPi wpa_supplicant[18106]: Successfully initialized wpa_supplicant
Jul 14 10:30:31 DietPi wpa_supplicant[18109]: wlan0: Trying to associate with SSID 'XXX'
Jul 14 10:30:31 DietPi dhclient[18115]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 10:30:31 DietPi dhclient[18115]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 10:30:31 DietPi dietpi-wifi-monitor.sh[4626]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 10:30:31 DietPi dietpi-wifi-monitor.sh[4626]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 10:30:31 DietPi dietpi-wifi-monitor.sh[4626]: All rights reserved.
Jul 14 10:30:31 DietPi dietpi-wifi-monitor.sh[4626]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 10:30:31 DietPi dhclient[18115]: All rights reserved.
Jul 14 10:30:31 DietPi dhclient[18115]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 10:30:31 DietPi dhclient[18115]: 
Jul 14 10:30:31 DietPi dhclient[18115]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 10:30:31 DietPi dietpi-wifi-monitor.sh[4626]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 10:30:31 DietPi dhclient[18115]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 10:30:31 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 10:30:31 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   Socket/fallback
Jul 14 10:30:31 DietPi dietpi-wifi-monitor.sh[4626]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
Jul 14 10:30:31 DietPi dhclient[18115]: Sending on   Socket/fallback
Jul 14 10:30:31 DietPi dhclient[18115]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
Jul 14 10:30:31 DietPi wpa_supplicant[18109]: wlan0: Associated with 3c:37:86:f4:99:18
Jul 14 10:30:31 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-CONNECTED - Connection to 3c:37:86:f4:99:18 completed [id=0 id_str=]
Jul 14 10:30:31 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Jul 14 10:30:31 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=DE
Jul 14 10:30:36 DietPi dhclient[18115]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
Jul 14 10:30:36 DietPi dietpi-wifi-monitor.sh[4626]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
Jul 14 10:30:37 DietPi dhclient[18115]: DHCPOFFER of 192.168.1.3 from 192.168.1.1
Jul 14 10:30:37 DietPi dietpi-wifi-monitor.sh[4626]: DHCPOFFER of 192.168.1.3 from 192.168.1.1
Jul 14 10:30:37 DietPi dietpi-wifi-monitor.sh[4626]: DHCPREQUEST for 192.168.1.3 on wlan0 to 255.255.255.255 port 67
Jul 14 10:30:37 DietPi dhclient[18115]: DHCPREQUEST for 192.168.1.3 on wlan0 to 255.255.255.255 port 67
Jul 14 10:30:37 DietPi dhclient[18115]: DHCPACK of 192.168.1.3 from 192.168.1.1
Jul 14 10:30:37 DietPi dietpi-wifi-monitor.sh[4626]: DHCPACK of 192.168.1.3 from 192.168.1.1
Jul 14 10:30:37 DietPi dhclient[18115]: bound to 192.168.1.3 -- renewal in 35863 seconds.
Jul 14 10:30:37 DietPi dietpi-wifi-monitor.sh[4626]: bound to 192.168.1.3 -- renewal in 35863 seconds.
Jul 14 10:30:37 DietPi dietpi-wifi-monitor.sh[4626]: Completed
Jul 14 14:28:50 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-DISCONNECTED bssid=3c:37:86:f4:99:18 reason=1 locally_generated=1
Jul 14 14:28:50 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Jul 14 14:28:50 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=SE
Jul 14 14:28:51 DietPi wpa_supplicant[18109]: wlan0: Trying to associate with SSID 'XXX'
Jul 14 14:28:51 DietPi wpa_supplicant[18109]: wlan0: Associated with 3c:37:86:f4:c5:97
Jul 14 14:28:51 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-CONNECTED - Connection to 3c:37:86:f4:c5:97 completed [id=0 id_str=]
Jul 14 14:28:52 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Jul 14 14:28:52 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=DE
Jul 14 14:29:01 DietPi dietpi-wifi-monitor.sh[4626]: Detected connection loss: wlan0. Reconnecting...
Jul 14 14:29:01 DietPi dhclient[25689]: Killed old client process
Jul 14 14:29:01 DietPi dietpi-wifi-monitor.sh[4626]: Killed old client process
Jul 14 14:29:02 DietPi dhclient[25689]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 14:29:02 DietPi dietpi-wifi-monitor.sh[4626]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 14:29:02 DietPi dietpi-wifi-monitor.sh[4626]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 14:29:02 DietPi dietpi-wifi-monitor.sh[4626]: All rights reserved.
Jul 14 14:29:02 DietPi dietpi-wifi-monitor.sh[4626]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 14:29:02 DietPi dietpi-wifi-monitor.sh[4626]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 14:29:02 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 14:29:02 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   Socket/fallback
Jul 14 14:29:02 DietPi dhclient[25689]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 14:29:02 DietPi dhclient[25689]: All rights reserved.
Jul 14 14:29:02 DietPi dietpi-wifi-monitor.sh[4626]: DHCPRELEASE of 192.168.1.3 on wlan0 to 192.168.1.1 port 67
Jul 14 14:29:02 DietPi dhclient[25689]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 14:29:02 DietPi dhclient[25689]: 
Jul 14 14:29:02 DietPi dhclient[25689]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 14:29:02 DietPi dhclient[25689]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 14:29:02 DietPi dhclient[25689]: Sending on   Socket/fallback
Jul 14 14:29:02 DietPi dhclient[25689]: DHCPRELEASE of 192.168.1.3 on wlan0 to 192.168.1.1 port 67
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-DISCONNECTED bssid=3c:37:86:f4:c5:97 reason=3 locally_generated=1
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=SE
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or dire
ctory
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: nl80211: Failed to set IPv4 unicast in multicast filter
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or dire
ctorye--
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: nl80211: Failed to set IPv4 unicast in multicast filter
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: nl80211: deinit ifname=p2p-dev-wlan0 disabled_11b_rates=0
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: p2p-dev-wlan0: CTRL-EVENT-TERMINATING
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Jul 14 14:29:03 DietPi wpa_supplicant[18109]: wlan0: CTRL-EVENT-TERMINATING
Jul 14 14:29:04 DietPi wpa_supplicant[25722]: Successfully initialized wpa_supplicant
Jul 14 14:29:05 DietPi wpa_supplicant[25725]: wlan0: Trying to associate with SSID 'XXX'
Jul 14 14:29:06 DietPi dhclient[25731]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 14:29:06 DietPi dietpi-wifi-monitor.sh[4626]: Internet Systems Consortium DHCP Client 4.4.1
Jul 14 14:29:06 DietPi dietpi-wifi-monitor.sh[4626]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 14:29:06 DietPi dietpi-wifi-monitor.sh[4626]: All rights reserved.
Jul 14 14:29:06 DietPi dietpi-wifi-monitor.sh[4626]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 14:29:06 DietPi dhclient[25731]: Copyright 2004-2018 Internet Systems Consortium.
Jul 14 14:29:06 DietPi dhclient[25731]: All rights reserved.
Jul 14 14:29:06 DietPi dhclient[25731]: For info, please visit https://www.isc.org/software/dhcp/
Jul 14 14:29:06 DietPi dhclient[25731]: 
Jul 14 14:29:06 DietPi dhclient[25731]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 14:29:06 DietPi dietpi-wifi-monitor.sh[4626]: Listening on LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 14:29:06 DietPi dhclient[25731]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 14:29:06 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   LPF/wlan0/b8:27:eb:f6:99:9e
Jul 14 14:29:06 DietPi dietpi-wifi-monitor.sh[4626]: Sending on   Socket/fallback
Jul 14 14:29:06 DietPi dietpi-wifi-monitor.sh[4626]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Jul 14 14:29:06 DietPi dhclient[25731]: Sending on   Socket/fallback
Jul 14 14:29:06 DietPi dhclient[25731]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
Jul 14 14:29:06 DietPi wpa_supplicant[25725]: wlan0: Associated with 3c:37:86:f4:99:18
Jul 14 14:29:06 DietPi wpa_supplicant[25725]: wlan0: CTRL-EVENT-CONNECTED - Connection to 3c:37:86:f4:99:18 completed [id=0 id_str=]
Jul 14 14:29:06 DietPi wpa_supplicant[25725]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Jul 14 14:29:06 DietPi wpa_supplicant[25725]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=DE
Jul 14 14:29:14 DietPi dhclient[25731]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Jul 14 14:29:14 DietPi dietpi-wifi-monitor.sh[4626]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
Jul 14 14:29:15 DietPi dhclient[25731]: DHCPOFFER of 192.168.1.3 from 192.168.1.1
Jul 14 14:29:15 DietPi dietpi-wifi-monitor.sh[4626]: DHCPOFFER of 192.168.1.3 from 192.168.1.1
Jul 14 14:29:15 DietPi dietpi-wifi-monitor.sh[4626]: DHCPREQUEST for 192.168.1.3 on wlan0 to 255.255.255.255 port 67
Jul 14 14:29:15 DietPi dhclient[25731]: DHCPREQUEST for 192.168.1.3 on wlan0 to 255.255.255.255 port 67
Jul 14 14:29:15 DietPi dhclient[25731]: DHCPACK of 192.168.1.3 from 192.168.1.1
Jul 14 14:29:15 DietPi dietpi-wifi-monitor.sh[4626]: DHCPACK of 192.168.1.3 from 192.168.1.1
Jul 14 14:29:15 DietPi dhclient[25731]: bound to 192.168.1.3 -- renewal in 42555 seconds.
Jul 14 14:29:15 DietPi dietpi-wifi-monitor.sh[4626]: bound to 192.168.1.3 -- renewal in 42555 seconds.
Jul 14 14:29:15 DietPi dietpi-wifi-monitor.sh[4626]: Completed

Is there something wrong with the country code? I tried setting it to SE but DietPi gave me an error.

Tried it again now and it works.

I will monitor this log and see if it disconnects again, at least now with auto reconnect I can reliably get back in.

Joulinar commented 4 years ago

Yes you could switch to Static IP instead of DHCP. Maybe it will help to reduce time to start WiFi interface

bbsixzz commented 4 years ago

Well the Pi still disconnects from WiFi occasionally but always reconnects so WireGuard is always accessible.

That's what matters, I have no intention to troubleshoot further to find out the underlying WiFi issue.

The access point is a Netgear Orbi WiFi 6 router and the Pi is located not far away; there are no obstructions.

Joulinar commented 4 years ago

Ok can we consider to close the issue?

bbsixzz commented 4 years ago

I would like to append this finding, I don't know how carefully you read through my log there but the issue is identical.

https://github.com/NixOS/nixpkgs/issues/40089

It seems this error code causes the WiFi to drop:

wpa_supplicant[5028]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or direc
tory
wpa_supplicant[5028]: nl80211: Failed to set IPv4 unicast in multicast filter
wpa_supplicant[5028]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or direc
tory
wpa_supplicant[5028]: nl80211: Failed to set IPv4 unicast in multicast filter

Maybe you want to have a look at that, even though there is a "workaround".

MichaIng commented 4 years ago

Can you please paste:

systemctl status wpa_supplicant
systemctl cat wpa_supplicant
systemctl status wpa_supplicant@wlan0
systemctl cat wpa_supplicant@
bbsixzz commented 4 years ago
root@DietPi:~# systemctl status wpa_supplicant
● wpa_supplicant.service - WPA supplicant
   Loaded: loaded (/lib/systemd/system/wpa_supplicant.service; disabled; vendor 
preset: enabled)
   Active: inactive (dead)
root@DietPi:~# systemctl cat wpa_supplicant
# /lib/systemd/system/wpa_supplicant.service
[Unit]
Description=WPA supplicant
Before=network.target
After=dbus.service
Wants=network.target

[Service]
Type=dbus
BusName=fi.w1.wpa_supplicant1
ExecStart=/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant

[Install]
WantedBy=multi-user.target
Alias=dbus-fi.w1.wpa_supplicant1.service
root@DietPi:~# systemctl status wpa_supplicant@wlan0
● wpa_supplicant@wlan0.service - WPA supplicant daemon (interface-specific versi
on)
   Loaded: loaded (/lib/systemd/system/wpa_supplicant@.service; disabled; vendor
 preset: enabled)
   Active: inactive (dead)
root@DietPi:~# systemctl cat wpa_supplicant@
# /lib/systemd/system/wpa_supplicant@.service
[Unit]
Description=WPA supplicant daemon (interface-specific version)
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
Before=network.target
Wants=network.target

# NetworkManager users will probably want the dbus version instead.

[Service]
Type=simple
ExecStart=/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -Dnl
80211,wext -i%I

[Install]
Alias=multi-user.target.wants/wpa_supplicant@%i.service
MichaIng commented 4 years ago

Okay no conflicting service active, versions look fine, ifupdown invokes wpa_supplicant differently.

Does this error and unstable WiFi only happen when WireGuard is enabled or as well if not? And did you try to play with WiFi AP setting, enabling/disabling different modes?

Best match I found: https://archlinuxarm.org/forum/viewtopic.php?t=12267&p=57231 There is was a firmware issue. You're on latest kernel, right? apt update && apt full-upgrade

bbsixzz commented 4 years ago

DietPi v6.31.2 and I have run apt update && apt full-upgrade.

According to https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

Note that with the latest Buster Raspberry Pi OS release, you must ensure that the wpa_supplicant.conf file contains the following information at the top:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>

Country is missing in DietPi config, I have set country=SE now to see if it makes a difference.

I can't test without WG because I only have remote access currently (4G), I think it's unlikely to cause the WiFi issue however.

On a tangent, I checked the country setting in dietpi-config and it had reverted from SE to DE.

I set it to SE again only to have it revert to DE.

Maybe it's not important and makes no difference?

Screenshot 2020-07-20 at 02 12 51

P.S.

How do you mean I can toggle WiFi n support in wpa_supplicant.conf, isn't it on by default?

MichaIng commented 4 years ago

How do you mean I can toggle WiFi n support in wpa_supplicant.conf, isn't it on by default?

Ah lol sorry I had hostapd config in mind, wpa_supplicant.conf doesn't allow that. This is what our config head looks like:

# Grant all members of group "netdev" permissions to configure WiFi, e.g. via wpa_cli or wpa_gui
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
# Allow wpa_cli/wpa_gui to overwrite this config file
update_config=1
bbsixzz commented 4 years ago
global
country DE: DFS-ETSI
        (2400 - 2483 @ 40), (N/A, 20), (N/A)
        (5150 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR, AUTO-BW
        (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
        (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
        (5725 - 5875 @ 80), (N/A, 13), (N/A)
        (57000 - 66000 @ 2160), (N/A, 40), (N/A)

[EDIT]

nano /etc/default/crda does show SE however… why doesn't it stick?

Either way, DE or SE shouldn't really matter to keep the connection.

MichaIng commented 4 years ago

Hmm not sure, for debugging:

sed -i '/^exec/a\echo "Setting to \$REGDOMAIN" > /root/crda.log' /lib/crda/setregdomain

This script should be called on boot by /lib/udev/rules.d/60-crda.rules.

wpasupplicant can apply it as well, but it should be sufficient to do that once at boot. Interestingly the country setting is not even mentioned in the man pages 🤔: https://manpages.debian.org/wpa_supplicant.conf


And you can set it manually and check by times, e.g. WiFi reconnect, if it has changed: iw reg set SE

But

Either way, DE or SE shouldn't really matter to keep the connection.

I agree with that.