jakeday / linux-surface

Linux Kernel for Surface Devices
2.59k stars 242 forks source link

Surface Pro 3: Wifi not working after suspend, possible quick'n' dirty workaround. #583

Open Ra72xx opened 5 years ago

Ra72xx commented 5 years ago

I switched to qzed's kernel recently, as the Jakeday kernel seems no longer updated. Here I experience very often the problem that wifi is no longer working.

I seem to get around the problem by modifying /etc/systemd/system-sleep/sleep (additional delays with "sleep"):

!/bin/bash

case $1 in pre)

unload the modules before going to sleep

systemctl stop NetworkManager.service
modprobe -r intel_ipts
modprobe -r mei_me
modprobe -r mei
modprobe -r mwifiex_pcie
modprobe -r mwifiex
modprobe -r cfg80211
;;

post)

need to cycle the modules on a resume and after the reset is called, so unload...

sleep 2 #new
modprobe -r intel_ipts
modprobe -r mei_me
modprobe -r mei
modprobe -r mwifiex_pcie
modprobe -r mwifiex
modprobe -r cfg80211
# and reload
sleep 2 #new
modprobe -i intel_ipts
modprobe -i mei_me
modprobe -i mei
modprobe -i cfg80211
modprobe -i mwifiex
modprobe -i mwifiex_pcie
echo 1 > /sys/bus/pci/rescan
systemctl restart NetworkManager.service
systemctl restart wpa_supplicant.service #new
;;

esac

The restart of wpa_supplicant.service was, for me, already necessary with the Jakeday kernel.

Strange thing is that Gnome's systray afterwards still claims that the device is disconnected, but the connectivity is there.

Any better workarounds?

alturismo commented 5 years ago

thanks alot for this tipps, i ll try them on my SL1 with Linux Mint 19.2, i had no luck at all with kernels

5.2.x too, already tried "sleep 1", will try with sleep 2 AND systemctl restart wpa_supplicant.service

thats new to me, i ll report back and thanks again

alturismo commented 5 years ago

tested now Ubuntu 19.04 and Linux Mint 19.2

both didnt work with > 5.2 qzed kernels here and suspend, wifi is always dead afterwards.

only choice here, reboot ...

alturismo commented 5 years ago

@qzed here are 2 dmesg logs, one after a clean start, one after a resume from suspend

resume from suspend, wifi dead and a error pops up about gpu driver not found

may u see something here ;) dmesg.log dmesg_break.log

alturismo commented 5 years ago

small update, same behavior on kernel 5.3.6 on SL1 running Mint

resume from suspend, wifi dead, gpu mostly warning, sometimes completely dead (hard reset 10seconds power) needed to recover.

qzed commented 4 years ago

Hi, sorry for the late response. I yet have to check out the workaround myself, but good to hear that there is one.

@alturismo I can't see anything with regards to mwifiex in the second log, but there's a lot of errors relating to IPTS. You can try and comment out the lines in the suspend script relating to IPTS to fix that.

Can you both check if the logs contain something similar to what's been reported in https://github.com/qzed/linux-surface-kernel/issues/20, so we can maybe use that as main issue?

alturismo commented 4 years ago

@qzed

updated to 5.3.15 and commented out the 3 ipts lines from sleep script, same behavior. resume from suspend -> wifi dead, touchscreen dead, error message about gpu driver

rebooted now and kept running for some time, i actually cant reproduce the wifi crash while running referred in your post, i only had this issue when i remember when running ubuntu 19.10, but not in mint since then ... may thats the difference.

k0pernicus commented 4 years ago

Hi, I actually have this issue on ubuntu 19.10, running 5.3.15-surface kernel (with latest patches from @qzed). It seems an issue with wpa_supplicant, as handshake timedout...

Just in case, this is my log when trying to connect to wifi (which keeps asking my router password again and again...):

Dec 17 07:17:35 moon wpa_supplicant[11082]: wlp1s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Dec 17 07:17:35 moon wpa_supplicant[11082]: wlp1s0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=FR
Dec 17 07:17:36 moon NetworkManager[9741]: <info>  [1576563456.0265] device (wlp1s0): supplicant interface state: associating -> associated
Dec 17 07:17:36 moon NetworkManager[9741]: <info>  [1576563456.0266] device (p2p-dev-wlp1s0): supplicant management interface state: associating -> associated
Dec 17 07:17:36 moon NetworkManager[9741]: <info>  [1576563456.0267] device (wlp1s0): supplicant interface state: associated -> 4-way handshake
Dec 17 07:17:36 moon NetworkManager[9741]: <info>  [1576563456.0267] device (p2p-dev-wlp1s0): supplicant management interface state: associated -> 4-way handshake
Dec 17 07:17:43 moon wpa_supplicant[11082]: wlp1s0: CTRL-EVENT-DISCONNECTED bssid=7c:26:64:60:58:f0 reason=15
Dec 17 07:17:43 moon wpa_supplicant[11082]: wlp1s0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Dec 17 07:17:43 moon wpa_supplicant[11082]: wlp1s0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="<SSID>" auth_failures=1 duration=10 reason=WRONG_KEY
Dec 17 07:17:43 moon kernel: mwifiex_pcie 0000:01:00.0: info: successfully disconnected from <MAC_ADDR>: reason code 15
Dec 17 07:17:43 moon wpa_supplicant[11082]: wlp1s0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="<SSID>" auth_failures=2 duration=20 reason=CONN_FAILED
Dec 17 07:17:43 moon NetworkManager[9741]: <warn>  [1576563463.9883] sup-iface[0x555d6bfe6220,wlp1s0]: connection disconnected (reason 15)
Dec 17 07:17:43 moon wpa_supplicant[11082]: dbus: wpa_dbus_property_changed: no property SessionLength in object /fi/w1/wpa_supplicant1/Interfaces/0
Dec 17 07:17:43 moon wpa_supplicant[11082]: wlp1s0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Dec 17 07:17:43 moon NetworkManager[9741]: <info>  [1576563463.9941] device (wlp1s0): supplicant interface state: 4-way handshake -> disconnected
Dec 17 07:17:43 moon NetworkManager[9741]: <info>  [1576563463.9960] device (wlp1s0): Activation: (wifi) disconnected during association, asking for new key
Dec 17 07:17:43 moon NetworkManager[9741]: <info>  [1576563463.9962] device (wlp1s0): state change: config -> need-auth (reason 'supplicant-disconnect', sys-iface-state: 'managed')
Dec 17 07:17:43 moon NetworkManager[9741]: <info>  [1576563463.9977] device (p2p-dev-wlp1s0): supplicant management interface state: 4-way handshake -> disconnected
Dec 17 07:17:44 moon NetworkManager[9741]: <info>  [1576563464.0918] device (wlp1s0): supplicant interface state: disconnected -> inactive
Dec 17 07:17:44 moon NetworkManager[9741]: <info>  [1576563464.0919] device (p2p-dev-wlp1s0): supplicant management interface state: disconnected -> inactive
Dec 17 07:17:45 moon NetworkManager[9741]: <warn>  [1576563465.9954] device (wlp1s0): no secrets: User canceled the secrets request.
Dec 17 07:17:45 moon NetworkManager[9741]: <info>  [1576563465.9955] device (wlp1s0): state change: need-auth -> failed (reason 'no-secrets', sys-iface-state: 'managed')
Dec 17 07:17:45 moon NetworkManager[9741]: <info>  [1576563465.9966] manager: NetworkManager state is now DISCONNECTED

I have this after each suspend, and need to reboot each time :/

k0pernicus commented 4 years ago

So, for information, I took the bash script pointed by @Larx here, and saved it in /lib/systemd/system-sleep/ (I just called it reset_wifi.sh), on my surface pro 6 (ubuntu 19.10 - kernel 5.3.15-surface, with latest modifications from @qzed), after allowing it to be executed (using chmod).

Surprisingly, it works really well, and I can resume my work after long hours of sleep without any wifi issues (or black screen).

Thanks a lot! :)

waxamoto commented 4 years ago

So, for information, I took the bash script pointed by @Larx here, and saved it in /lib/systemd/system-sleep/ (I just called it reset_wifi.sh), on my surface pro 6 (ubuntu 19.10 - kernel 5.3.15-surface, with latest modifications from @qzed), after allowing it to be executed (using chmod).

Surprisingly, it works really well, and I can resume my work after long hours of sleep without any wifi issues (or black screen).

Thanks a lot! :)

Hi k0pernicus, I also have a Surface 6 pro, I installed Ubuntu 19.10 and tried with the method you suggested but I still have issues with the wifi being dead after suspend, could you please make me a step by step guide to fix the issue, in case I got something wrong, thanks very much!!!