wpa-supplicant terminates on connection loss

Bug #1442182 reported by mpw
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Raspbian
Expired
Undecided
Unassigned

Bug Description

Hello everybody,

my raspberry pi is not capable of keeping up a wifi connection. If it loses the connections once, wpa-supplicant terminates, no further connection attemps, pi will be offline.

Probably relevant parts of the syslog:

Apr 9 16:13:01 raspberrypi kernel: [164879.884780] wlan0: deauthenticated from 34:31:c4:15:4b:b8 (Reason: 6=CLASS2_FRAME_FROM_NONAUTH_STA)
Apr 9 16:13:01 raspberrypi ifplugd(wlan0)[1853]: Link beat lost.
Apr 9 16:13:01 raspberrypi wpa_supplicant[16862]: wlan0: CTRL-EVENT-DISCONNECTED bssid=34:31:c4:15:4b:b8 reason=6
Apr 9 16:13:08 raspberrypi wpa_supplicant[16862]: wlan0: SME: Trying to authenticate with 34:31:c4:15:4b:b8 (SSID='NewZealand' freq=2447 MHz)
Apr 9 16:13:08 raspberrypi kernel: [164886.181976] wlan0: authenticate with 34:31:c4:15:4b:b8
Apr 9 16:13:08 raspberrypi kernel: [164886.314090] wlan0: send auth to 34:31:c4:15:4b:b8 (try 1/3)
Apr 9 16:13:08 raspberrypi wpa_supplicant[16862]: wlan0: Trying to associate with 34:31:c4:15:4b:b8 (SSID='NewZealand' freq=2447 MHz)
Apr 9 16:13:08 raspberrypi kernel: [164886.329531] wlan0: authenticated
Apr 9 16:13:08 raspberrypi kernel: [164886.333914] wlan0: associate with 34:31:c4:15:4b:b8 (try 1/3)
Apr 9 16:13:08 raspberrypi kernel: [164886.348426] wlan0: RX AssocResp from 34:31:c4:15:4b:b8 (capab=0x31 status=0 aid=1)
Apr 9 16:13:08 raspberrypi wpa_supplicant[16862]: wlan0: Associated with 34:31:c4:15:4b:b8
Apr 9 16:13:08 raspberrypi kernel: [164886.357101] wlan0: associated
Apr 9 16:13:08 raspberrypi wpa_supplicant[16862]: wlan0: WPA: Key negotiation completed with 34:31:c4:15:4b:b8 [PTK=CCMP GTK=CCMP]
Apr 9 16:13:08 raspberrypi wpa_supplicant[16862]: wlan0: CTRL-EVENT-CONNECTED - Connection to 34:31:c4:15:4b:b8 completed (reauth) [id=0 id_str=]
Apr 9 16:13:09 raspberrypi ifplugd(wlan0)[1853]: Link beat detected.
Apr 9 16:13:12 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Apr 9 16:13:13 raspberrypi dhclient: Listening on LPF/wlan0/b8:a3:86:04:ff:db
Apr 9 16:13:13 raspberrypi dhclient: Sending on LPF/wlan0/b8:a3:86:04:ff:db
Apr 9 16:13:13 raspberrypi dhclient: DHCPRELEASE on wlan0 to 192.168.178.1 port 67
Apr 9 16:13:17 raspberrypi kernel: [164895.306364] wlan0: deauthenticating from 34:31:c4:15:4b:b8 by local choice (Reason: 3=DEAUTH_LEAVING)
Apr 9 16:13:17 raspberrypi wpa_supplicant[16862]: wlan0: CTRL-EVENT-DISCONNECTED bssid=34:31:c4:15:4b:b8 reason=3

If this happens, there is referring to pgrep no wpa-supplicant running, and so the pi does not try to reconnect.

Workaround:

Create a skript, and run it as root cronjob every minute:

#!/bin/bash

TESTIP=192.168.178.1

ping -I wlan0 -c2 ${TESTIP} > /dev/null

if [ $? != 0 ]
then
 logger -t WLAN "No connection to ${TESTIP}, restart wifi"
 ifdown --force wlan0
 ifup wlan0
fi

I don't really get, why the pi acts so differently here compared to a x86 pc, where wpa-supplicant is completly capable of reestablishing the connection after a loss.

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
(wpa-roam doesn't work eitehr)

Thanks for reading!

Greetings
MPW

Revision history for this message
Diederik (didi-debian) wrote :

Do you get a kernel crash like in the other bug report?

It mostly looks like a power saving issue to me and your cronjob would prevent your device from going into sleep mode.
What is your wireless device? Post the USB ID which you can get through `lsusb`.
Do you load the needed kernel module with parameters (in /etc/modprobe for example). If so, which?
What is your kernel version (`uname -a`) and does the issue still occur?

Revision history for this message
Diederik (didi-debian) wrote :

While both bugs (https://bugs.launchpad.net/raspbian/+bug/1191939 and this one) indicate a problem with the WLAN device, the symptoms are very different in my opinion.
I have therefor removed the duplicate status and marked this bug as incomplete until further info is provided.

Changed in raspbian:
status: New → Incomplete
Revision history for this message
mpw (matthiaspeterw) wrote :
Download full text (7.6 KiB)

Hi,

maybe you're right about that energy saving mode. Sometimes the connections lasts for days, sometimes my script resets it every 5 minutes. Maybe it depends on weather data is transferred. (The device stores my backups.)

It's an

Bus 001 Device 007: ID 07d1:3a09 D-Link System DWA-160 802.11abgn Xtreme N Dual Band Adapter(rev.A2) [Atheros AR9170+AR9104]

Linux raspberrypi 4.1.10+ #821 PREEMPT Sat Oct 10 00:12:23 BST 2015 armv6l GNU/Linux

The issues occured quite often the 8th january, but no on the 9th:

# grep -i gestartet syslog.2
Jan 7 23:20:12 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:21:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:22:05 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:23:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:24:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:25:05 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:26:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:27:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:28:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:29:05 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:30:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:31:05 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:32:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:33:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:34:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:35:05 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:36:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:37:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:38:05 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:39:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:40:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:41:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:42:05 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:43:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:44:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:45:05 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:46:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:47:04 raspberrypi WLAN: Keine Verbindung zu 192.168.178.1, WLAN wird neu gestartet
Jan 7 23:48:05 raspberrypi WLAN: Keine Verbindung z...

Read more...

Revision history for this message
mpw (matthiaspeterw) wrote :

And I do not load the driver manually. I just installed the needed firmware package once.

Revision history for this message
Diederik (didi-debian) wrote :

According to https://wireless.wiki.kernel.org/en/users/drivers/carl9170 the power save mode functionality is implemented, but buggy.
These may also be of help: https://wiki.debian.org/ar9170usb and http://www.linux-hardware-guide.com/2014-06-06-d-link-dwa-160-usb-wifi-300mbps-ieee-802-11abg

From what I've read, this device seems to be from the draft-N period and it is therefor likely it will never work 100%.
What you can do is update your kernel (a newer version is available) and see whether that improves the situation as the driver for your device is in the kernel (source) itself. And as such any fixes should come from the (upstream) kernel itself.

But there isn't anything raspbian(.org) can do about it any fixes need to come from upstream.

Revision history for this message
mpw (matthiaspeterw) wrote :

Hello Diederik,

thanks for looking into this. I just thought, this might be Raspberry related, as I don't have this problem with desktop linux machines. I think the network-manager just restarts wpa_supplicant. I thought that you should generally restart the wpa_supplicant if it crashes. Dropping a network connection just because it fails for a few seconds doesn't end in a reliable system in my opinion.

I'll try to upgrade the kernel. But not remotely. I don't have physical access to the device, but I'll report when I haven and upgraded the kernel.

Bye
Matthias

Revision history for this message
Diederik (didi-debian) wrote :

If the same device is working properly on other linux machines, then it I suggest you look closely at the differences in package (versions) used and the configuration.
One thing I noticed is the part from /etc/network/interfaces which is slightly different then I use:

========================================================
allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
========================================================

Note the 'manual' part (and the line below wpa-roam)

My /etc/wpa_supplicant/wpa_supplicant.conf:

========================================================
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="<my-ssid>"
        psk="<my-psk>"
}
========================================================

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Raspbian because there has been no activity for 60 days.]

Changed in raspbian:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.