markusi72
Posts: 4
Joined: Wed Aug 28, 2019 5:28 pm

Endless Wifi / WPA_Supplicant reconnect loop

Fri Sep 13, 2019 10:44 pm

Hi all,

I found many people having similar issues but I was not able to deduct any help for my problem from them.

Situation
After boot, wifi connection works like a charm and is stable.
But at least once a day, wifi connection breaks and then it seems like wpa_supplicant gets stuck in an endless connect, connected, disconnect, reconnect loop... sometimes for hours.
Then, suddenly, everything seems to be back to normal.
Until after a few hours, the issue reappears.

Good to know
- Raspi Zero W
- Newest Firmware
- Newest Linux (update / upgrade / dist-upgrade)
- reproducible with 5 different routers (HW & firmware) --> so I suppose it's no router issue
- tried with different wpa_supplicant.conf settings
- Wifi powersave is off
- Wifi setup with repeaters (issue occurs with same SSID(mesh) and different SSID), central DHCP server
- Main router running AsusWRT, repeaters DD-WRT or powerlan (issue can be observed when connecting to either router/repeater)
- Seems like issue can be reproduced by force when powering off and on the repeater Raspi currently connected to

The wpa-supplicant reason codes seem to hint to a repeatedly locally generated disconnect, but I have no clue, what is going on, nor what I could do to fix it.

Anyone who can help?
It would be very, very appreciated!

Thanks in advance,
Markus

From daemon.log:

Code: Select all

--> It seems always to start with reason=7 and the continue with reason=3
Sep 13 23:42:57 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:18:f8:db:44:05 [b]reason=7 locally_generated=1[/b]
Sep 13 23:42:57 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Sep 13 23:42:57 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=DE
Sep 13 23:42:58 raspberrypi wpa_supplicant[476]: wlan0: Trying to associate with SSID ''
Sep 13 23:42:59 raspberrypi wpa_supplicant[476]: wlan0: Associated with 00:18:f8:db:44:05
Sep 13 23:42:59 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Sep 13 23:42:59 raspberrypi wpa_supplicant[476]: wlan0: WPA: Key negotiation completed with 00:18:f8:db:44:05 [PTK=CCMP GTK=CCMP]
Sep 13 23:42:59 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-CONNECTED - Connection to 00:18:f8:db:44:05 completed [id=0 id_str=]
Sep 13 23:42:59 raspberrypi dhclient[6834]: Killed old client process
Sep 13 23:43:00 raspberrypi dhclient[6834]: Internet Systems Consortium DHCP Client 4.3.5
Sep 13 23:43:00 raspberrypi dhclient[6834]: Copyright 2004-2016 Internet Systems Consortium.
Sep 13 23:43:00 raspberrypi dhclient[6834]: All rights reserved.
Sep 13 23:43:00 raspberrypi dhclient[6834]: For info, please visit https://www.isc.org/software/dhcp/
Sep 13 23:43:00 raspberrypi dhclient[6834]: 
Sep 13 23:43:00 raspberrypi dhclient[6834]: Listening on LPF/wlan0/b8:27:eb:c6:8e:11
Sep 13 23:43:00 raspberrypi dhclient[6834]: Sending on   LPF/wlan0/b8:27:eb:c6:8e:11
Sep 13 23:43:00 raspberrypi dhclient[6834]: Sending on   Socket/fallback
Sep 13 23:43:00 raspberrypi dhclient[6834]: DHCPRELEASE on wlan0 to 192.168.1.1 port 67
Sep 13 23:43:01 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:18:f8:db:44:05 [b]reason=3 locally_generated=1[/b]
Sep 13 23:43:01 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Sep 13 23:43:01 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=DE
Sep 13 23:43:01 raspberrypi dhclient[7139]: Internet Systems Consortium DHCP Client 4.3.5
Sep 13 23:43:01 raspberrypi dhclient[7139]: Copyright 2004-2016 Internet Systems Consortium.
Sep 13 23:43:01 raspberrypi dhclient[7139]: All rights reserved.
Sep 13 23:43:01 raspberrypi dhclient[7139]: For info, please visit https://www.isc.org/software/dhcp/
Sep 13 23:43:01 raspberrypi dhclient[7139]: 
Sep 13 23:43:01 raspberrypi wpa_supplicant[476]: wlan0: Trying to associate with SSID ''
Sep 13 23:43:02 raspberrypi dhclient[7139]: Listening on LPF/wlan0/b8:27:eb:c6:8e:11
Sep 13 23:43:02 raspberrypi dhclient[7139]: Sending on   LPF/wlan0/b8:27:eb:c6:8e:11
Sep 13 23:43:02 raspberrypi dhclient[7139]: Sending on   Socket/fallback
Sep 13 23:43:02 raspberrypi dhclient[7139]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
Sep 13 23:43:02 raspberrypi wpa_supplicant[476]: wlan0: Associated with 00:18:f8:db:44:05
Sep 13 23:43:02 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Sep 13 23:43:02 raspberrypi wpa_supplicant[476]: wlan0: WPA: Key negotiation completed with 00:18:f8:db:44:05 [PTK=CCMP GTK=CCMP]
Sep 13 23:43:02 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-CONNECTED - Connection to 00:18:f8:db:44:05 completed [id=0 id_str=]
Sep 13 23:43:06 raspberrypi dhclient[7139]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
Sep 13 23:43:06 raspberrypi dhclient[7139]: DHCPREQUEST of 192.168.1.230 on wlan0 to 255.255.255.255 port 67
Sep 13 23:43:06 raspberrypi dhclient[7139]: DHCPOFFER of 192.168.1.230 from 192.168.1.1
Sep 13 23:43:06 raspberrypi dhclient[7139]: DHCPACK of 192.168.1.230 from 192.168.1.1
Sep 13 23:43:07 raspberrypi dhclient[7139]: bound to 192.168.1.230 -- renewal in 35102 seconds.
Sep 13 23:43:07 raspberrypi systemd[1]: Reloading OpenBSD Secure Shell server.
Sep 13 23:43:08 raspberrypi systemd[1]: Reloaded OpenBSD Secure Shell server.
Sep 13 23:43:10 raspberrypi dhclient[8003]: Killed old client process
Sep 13 23:43:10 raspberrypi dbus[231]: [system] Reloaded configuration
Sep 13 23:43:11 raspberrypi dhclient[8003]: Internet Systems Consortium DHCP Client 4.3.5
Sep 13 23:43:11 raspberrypi dhclient[8003]: Copyright 2004-2016 Internet Systems Consortium.
Sep 13 23:43:11 raspberrypi dhclient[8003]: All rights reserved.
Sep 13 23:43:11 raspberrypi dhclient[8003]: For info, please visit https://www.isc.org/software/dhcp/
Sep 13 23:43:11 raspberrypi dhclient[8003]: 
Sep 13 23:43:11 raspberrypi dhclient[8003]: Listening on LPF/wlan0/b8:27:eb:c6:8e:11
Sep 13 23:43:11 raspberrypi dhclient[8003]: Sending on   LPF/wlan0/b8:27:eb:c6:8e:11
Sep 13 23:43:11 raspberrypi dhclient[8003]: Sending on   Socket/fallback
Sep 13 23:43:11 raspberrypi dhclient[8003]: DHCPRELEASE on wlan0 to 192.168.1.1 port 67
Sep 13 23:43:12 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:18:f8:db:44:05 [b]reason=3 locally_generated=1[/b]
Sep 13 23:43:12 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Sep 13 23:43:12 raspberrypi wpa_supplicant[476]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=DE
Sep 13 23:43:13 raspberrypi wpa_supplicant[476]: wlan0: Trying to associate with SSID ''
--> this now will continue for minutes or hours
wpa_supplicant.conf

Code: Select all

country=DE 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 
update_config=1 
network={
     bssid=##:##:##:DB:44:05
     scan_ssid=1
     psk="#####"
     key_mgmt=WPA-PSK
     priority=3
}
network={
     ssid="###"
     scan_ssid=1
     psk="#####"
     key_mgmt=WPA-PSK
     priority=1
}
network={
     ssid="###"
     scan_ssid=1
     psk="#####"
     key_mgmt=WPA-PSK
     priority=2
}
iwconf output

Code: Select all

wlan0     IEEE 802.11  ESSID:"###"  
          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:18:F8:DB:44:05   
          Bit Rate=54 Mb/s   Tx-Power=31 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=59/70  Signal level=-51 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.

markusi72
Posts: 4
Joined: Wed Aug 28, 2019 5:28 pm

Re: Endless Wifi / WPA_Supplicant reconnect loop

Sat Sep 14, 2019 2:17 pm

Could it be due to any issue with dhclient?

User avatar
DougieLawson
Posts: 35836
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Endless Wifi / WPA_Supplicant reconnect loop

Sat Sep 14, 2019 3:20 pm

Is your AP hidden? If not you won't need bssid=... . If it is hidden, unhide it, hidden SSIDs don't improve security and just make it a PITA to connect.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

markusi72
Posts: 4
Joined: Wed Aug 28, 2019 5:28 pm

Re: Endless Wifi / WPA_Supplicant reconnect loop

Sat Sep 14, 2019 5:59 pm

No, it's not hidden - but due to the mesh (multiple routers with same SSID) I thought this could help connection stability by telling the PI which repeater to take... but it did not help at all...

Issue persists even if only one router emits the ssid

markusi72
Posts: 4
Joined: Wed Aug 28, 2019 5:28 pm

Re: Endless Wifi / WPA_Supplicant reconnect loop

Sun Sep 15, 2019 7:49 pm

Seems I solved it...
dhclient was interfering with interfaces config.
I thought, dhclient would ignore interfaces when configured as dhcp but it ignores everything if any interface is flagged as dhcp in interfaces config.
I removed all dhcp config from interfaces and that it worked...

Strange though, that dhclient (even though reporting to be not running) started to interfere and caused to connection to be dropped.
Anyway. That seems to be history now :-)

User avatar
rpdom
Posts: 15030
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Endless Wifi / WPA_Supplicant reconnect loop

Mon Sep 16, 2019 6:08 am

markusi72 wrote:
Sun Sep 15, 2019 7:49 pm
Seems I solved it...
dhclient was interfering with interfaces config.
I thought, dhclient would ignore interfaces when configured as dhcp but it ignores everything if any interface is flagged as dhcp in interfaces config.
I removed all dhcp config from interfaces and that it worked...

Strange though, that dhclient (even though reporting to be not running) started to interfere and caused to connection to be dropped.
Anyway. That seems to be history now :-)
If you mean the /etc/network/interfaces file, you shouldn't use that any more (as the warning in the file states).

dhclient isn't used either. Instead networking is handled by dhcpcd and all configuration should be done in /etc/dhcpcd.conf

Return to “Troubleshooting”