Skip to main content
Topic: Solution for WiFi problems after hibernate (Read 195 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Solution for WiFi problems after hibernate

I noticed my WiFi module (mt7921e) was not functioning every time my Framework 16 woke from hibernation and I had no internet. I found out that you can make pre-post sleep scripts in /etc/elogind/system-sleep. I made one to disable my WiFi module pre-hibernation and enable post-hibernation.

/etc/elogind/system-sleep/hibernate-pre-post.sh

Code: [Select]
#!/bin/bash

# This script is for non-systemd based systems.
# You should place this script in '/etc/elogind/system-sleep' and make it executable.
# See 'man 1 loginctl', section 'Hook directories' for more information.
#
# Some devices do not function after hibernate, this script can solve that problem.
# It disables kernel module(s) pre-hibernate and enables kernel module(s) post-hibernate.
# You can add "hybrid-sleep" in the script too, if you use that.
#
#
# Module name(s): see output of 'lspci -knn'. Change below value to match your system.
# Add more modules if needed (and in the script below too).
WiFiModule=mt7921e

case "$1 $2" in
  "pre hibernate" | "pre suspend-then-hibernate")
    modprobe -r $WiFiModule
    ;;
  "post hibernate" | "post suspend-then-hibernate")
    modprobe $WiFiModule
    ;;
  *)
    :
    ;;
esac