Every time I open my notebook lid I have to wait a few seconds for wifi to reconnect. I remember that in Windows it was already connected. I need a way to prevent wifi from disconneting on suspend.
The closest answer I found was https://askubuntu.com/a/961460/613425 but it didn't work. I also tried the iwconfig wlan0 poweroff
in the answer but it didn't work even before reboot.
There are two ways of enabling WiFi after sleep. The first is a common patch to Network Manager as you can see I've made by listing the file:
Turn off or enable power savings as illustrated below:
WiFi.powersave
from2
to3
(Enable power saving).3
try setting it to2
(Disable power saving).sudo systemctl restart NetworkManager
The second is a
systemd
script which reloads the WiFi kernel module when resuming from suspend. It comes from this answer: Wifi available networks not showing up suddenly:This script is written for iwlwifi` which is the common Intel driver name. If your's is different change that name below:
NOTE: Sometimes simply resetting network manager is all that is needed. In that case un-comment the line above by removing
#
. Then comment out the two lines above it by putting#
at the beginning of those two lines.You'll need to create this script, called
iwlwifi-reset
, withsudo
powers and save it into the directory/lib/systemd/system-sleep
. Then mark it executable using:I think it is related to systemd. You can make a script that starts the wifi device after suspend. Just try to do so manually first.
First ceate a new script and make it executable.
Then edit the script
and make it look something like this.
to make sure that nmcli radio wifi on is the correct command, try to go into sleep mode, start the computer up and do
if your computer then connect to the correct wifi, then this might be a optional solution for you. your computer should auto-connect. to your saved wi-fi access point.