I had success in being able to suspend without any hangs and the wifi on using the following.
Using your favorite text editor add the following text to the following two files
File at
Code:
/usr/lib/systemd/system-sleep/wlan_stop.sh
Code:
#!/bin/bash
if [ "$1" = "post" ]; then
echo "Post: $(date +%T)" >> /tmp/suspend
/usr/bin/nmcli radio wifi on
# /usr/sbin/modprobe bes2600
elif [ "$1" = "pre" ]; then
echo "Pre: $(date +%T)" >> /tmp/suspend
/usr/bin/nmcli radio wifi off
# /usr/sbin/modprobe -r bes2600
fi
exit 0
and again for shutdowns
add a file at
Code:
/usr/lib/systemd/system-shutdown/wlan_stop.sh
Code:
#!/bin/bash
# stops the wifi before shutting down, otherwise the current driver implementation hangs
/usr/bin/nmcli radio wifi off
exit 0
Also make sure that both files are executable
Code:
% sudo chmod +x /usr/lib/systemd/system-shutdown/wlan_stop.sh
% sudo chmod +x /usr/lib/systemd/system-sleep/wlan_stop.sh
I have tested it a couple of times and it seem to work so far. I can let the pinetab2 go to suspend and wake up again, and wifi pops back into working.
You know that the script is working for suspend when the file /tmp/suspend exists and has timestamps for when it suspended. If that file isn't created then the problem is that the file /usr/lib/systemd/system-sleep/wlan_stop.sh isn't running.
Code:
% cat /tmp/suspend
Pre: 12:35:31
Post: 12:35:35
Pre: 12:36:41
Post: 12:36:45
(02-23-2024, 08:43 PM)frtodd Wrote: Wilmeri: that's a good find. Placing it in `/usr/lib/systemd/system-sleep/` isn't working for me. But a simple `nnmcli radio wifi off ; systemctl suspend` works nicely, followed by a corresponding "nmcli radio wifi on" when it wakes.
Which led me to check: simply disconnecting wifi by hitting the "Wi-Fi" button in the pull-down menu (the always-available one where you control screen brightness at the bottom) seems to be sufficient to let me suspend and restore gracefully. It's not perfect, but it's not difficult.
Thanks for pointing the way, Wilmeri!
Not sure why it did't work for you, as I see it is very similar to what works well for me.
Perhaps you need to have the full path to nmcli?