Fix Ubuntu 16.04 No Wireless Connection After Suspend
Ubuntu has a ongoing problem. When you put your computer to sleep, and wake it up again, you might find that you are not connected to WiFi anymore. Or you are, but the list of available WiFi access points has disappeared.
This issue persists on Ubuntu 14.04, 14.10, 15.04, 15.10 and on 16.04. The workaround I will be showing here will work on any Ubuntu version that has systemd. In other words, this will only work on versions 15.04 and above.
As found in this post, the problems go away after you do “sudo service network-manager restart” after waking up from suspend. However, to manually reset the Network Manager every time you wake up the computer is quite annoying, so we are going to automate this by creating a script that runs every time the computer wakes up.
Step 1: Create a new script in the systemd system-sleep folder.
sudo nano /lib/systemd/system-sleep/reset_network.sh
Step 2: Copy and paste the following into the newly created script.
if [ $1 = post ] && [ $2 = suspend ]
then service network-manager restart
Step 3: Exit nano by pressing “Ctrl + X” and save it.
Step 4: Make the script executable.
sudo chmod +x /lib/systemd/system-sleep/reset_network.sh
I hope this helped!