Resume script back from hibernation with systemd for wifi problem

I wrote a simple article which I found in my own opinion usefull ! I still need user manual when I use systemd and I still remember init.d command :-/

Since systemd, I am in an annoying situation when my desktop computer come back from hibernation :
- Network is unresponsive, Network Manager icon on mate desktop show a disable network,
- Command line on desktop and tty are working but you could send a command but never get this command sending to system. It's like freezing but system is still here !

The only workaround in a first time is to detach my TP-LINK TL-WN722N and to reconnect it. No error message in logs about chipset of this usb wifi device which is from Atheros and uses ath9k driver.

Next step to debug is to simulate behaviour but the only thing what I can do is disable ath9k driver before hibernation and renabling them after resume.
For those how wanted to know commands are like that :
Before hibernation disable modules :
rmmod ath9k_htc
rmmod ath9k_common
rmmod ath9k_hw
rmmod ath

And after resume enable modules : 
modprobe ath
modprobe ath9k
modprobe ath9k_hw
modprobe ath9k_common
modprobe ath9k_htc

To do that automatically, it's easy to use pm-utils but since systemd, pm-utils is not working and we have to use systemd scripts.

So here is my working script with this driver :

Edit in
nano /usr/lib/systemd/system-sleep/wifi_hibernate_resume.sh
And put this :

#!/bin/sh
case $1/$2 in
  pre/*)
    rmmod ath9k_htc
    rmmod ath9k_common
    rmmod ath9k_hw
    rmmod ath
    ;;
  post/*)
     modprobe ath
     modprobe ath9k
     modprobe ath9k_hw
     modprobe ath9k_common
     modprobe ath9k_htc
    ;;
esac


Then make it executable with :

chmod +x /usr/lib/systemd/system-sleep/wifi_hibernate_resume.sh

No need to reboot, it works directly.

Commentaires

Posts les plus consultés de ce blog

How-to run QGIS 2 and QGIS 3 at the same time in Archlinux or Manjaro

Disposer du support de l'ECW sous Ubuntu

Mise à jour Paquet ECW pour Ubuntu