No network after Ubuntu resumes from sleep/suspense

I use Ubuntu on my desktop and I really have a stupid annoying issue..

“No network after I resume from sleep/suspense”

I know that if I restart the network-manager, it will solve the issue. I actually created an alias in .bashrc file to make my life little easier – “sudo restart network-manager”.

But today, I’ve decided to make it even better. So I searched for “ubuntu script after resume” in Google and the first hit was exactly what I needed.

You can follow the link or just rely on my steps down below.

Tested on Ubuntu 14.04 LTS

Run the following commands in Terminal (I used 99 priority, netreload.sh as the script name, nano as the editor.. you can use your preferences if you’re a good Linux user)

sudo touch /etc/pm/sleep.d/99-netreload.sh
sudo chmod +x /etc/pm/sleep.d/99-netreload.sh
sudo nano /etc/pm/sleep.d/99-netreload.sh

Paste the following, save (Ctrl-O and then Enter) then exist (Ctrl-X):

#!/bin/bash
case "$1" in
 hibernate|suspend)
 ;;
 thaw|resume)
 restart network-manager
 ;;
 *)
 ;;
esac
exit $?

Comment if it helped or suggest a modification for alternative Linux favors or Ubuntu versions

Cheers

Leave a Reply