Ubuntu Wifi fix after suspend
I’m running a fresh install Ubuntu Gnome 16.10 on my XPS 15 and I noticed that whenever I put the laptop in suspend I was unable to connect to my WiFi network upon resume.
Looking online it appears that I am not alone with this problem. Following the discussion found that restarting the network-manager service fixed this.
sudo systemctl restart network-manager.service
You can automate this by creating a new systemd service which calls this whenever coming out of suspend, hibernate, or hybrid sleep.
First create the new service by sudo nano /etc/systemd/system/wifi-resume.service
and pasting the following content:
[Unit]
Description=Restart NetworkManager at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target
[Service]
ExecStart=/bin/systemctl --no-block restart network-manager.service
[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target
Credit go to the authors of the replies on ask ubuntu thread.
Save and exit nano and then enable the new systemd service:
sudo systemctl enable wifi-resume.service
You can substitute enable
with disable
to turn off the service and then remove the file if you find it’s not working as expected.