Wifi doesn't work after resume from suspend in Ubuntu 15.04 (Dell Latitude E4310)
Posted by Admin • Sunday, May 17. 2015 • Category: Linux
Although toggling the hardware Wi-Fi switch usually fixed this issue, it was decidedly annoying for the non-technical user of this laptop. Googling for a well-known solution turned up several, but none of these worked. I found that either running
usually worked, so I tried to stick that into /etc/pm/sleep.d - but that script was never used. I then discovered that in 15.04 Ubuntu switched to systemd, which requires a service file in /etc/systemd/system/ In the end, it turns out that the problem is intermittent, therefore it is not possible to simply toggle networking blindly and hope for the best. Half the time it will not work. The ultimate solution turned out to be a combination of a toggle and a check, and both could be done via network manager, as follows:nmcli r wifi off nmcli r wifi on
Create a script
(doesn't matter where, but might as well throw it in here): /etc/pm/sleep.d/fix-wifi.shMake it executable#!/bin/sh # For some reason on the dell after suspend, wifi is on but really off.. case "${1}" in resume|thaw) logger -t wifidebug "Trying to restart wifi" until nm-online -t 5 ; do /etc/init.d/network-manager restart logger -t wifidebug "Wifi still no go" sleep 1 done ;; esac
Create a systemd service
/etc/systemd/system/fix-wifi-resume.service[Unit] Description=Toggle wifi because it doesn't come back on its own after resume After=suspend.target [Service] Type=simple ExecStart=-/etc/pm/sleep.d/fix-wifi.sh resume [Install] WantedBy=suspend.target
Enable the service:
systemctl enable fix-wifi-resume.serviceNow try to suspend/resume. You should see the log statements in your syslog - otherwise, your script is not running. Once you get it working you can remove the logging.
This worked for me on MacBookPro8,1 with Ubuntu 15.04. Thanks!!