Fix No Wifi After Resume on Ubuntu

Similar to the issue I had on Fedora, when I resume from sleep on Ubuntu, my wifi connection looks like it is up, but I'm unable to access any network resources.

Unfortunately, unloading and reloading the wifi adapter kernel module didn't work this time around. I found that restarting the Network Manager service after resume made the network accessible. So, I created a script to restart it after the system was resumed.

Create the file /lib/systemd/system-sleep/network-manager.


# /lib/systemd/system-sleep/network-manager

# Restarts network-manager after sleep.
# This prevents the problem where the network is not
# available after resume.

case $1 in
        /usr/bin/sleep 10
        /usr/bin/systemctl restart network-manager

Make the file executable:

chmod 755 /lib/systemd/system-sleep/network-manager

I found that restarting immediately after resume didn't work, so I added the sleep command. I tried various values, but 10 seconds seemed to be the lowest value that made it work.

comments powered by Disqus