You have upgraded to the latest LTS version of Ubuntu, and like many you have been having problems with Wi-Fi. You experienced loss of Wi-Fi on resuming from suspend. This was due to bug 1574347, bug 1311257 or some combination of the two. You found a workaround that worked. However when you switch networks you again lose Wi-Fi connectivity with NetworkManager not seeing any Wi-Fi access points. What should you do?
The following is the approach I would recommend.
- Research the problem
- Ask for help
- Raise a bug report
- Seriously consider whether you need the latest LTS version of Ubuntu
- Try an alternative to GNOME Network Manager
- Control your Wi-Fi from the terminal.
Step 1 You tried researching the problem. You did not find anything about this issue on the internet.
Step 2 You posted this question on Ask Ubuntu. You posted the results of running the Ubuntu Forums WiFi diagnosis script and a screenshot of your screen. When you did not get a response you posted a bounty on the question. All great moves on your part. We have chatted about your problem and I have analysed your WiFi script results in detail. Apart from a couple of kernel error messages apparently related to the suspend/ resume issue the results show working Wi-Fi that is just not connected to an Access Point.
Step 3 This is clearly a bug in GNOME Network Manager so create a bug report. The developers need bug reports to find an eliminate errors in the code. You do this by typing ubuntu-bug network-manager
in a terminal.
Step 4. Seriously consider reverting to your previous version of Ubuntu. Adding LTS to the name of a release does not make it of higher quality than any other release. What creates the quality is the amount of testing it has undergone. LTS releases are used by much greater numbers of users than development releases so once they are live they are much more thoroughly tested. As 16.04 LTS has been live for less than a month it will have far more bugs than say 14.04 LTS. On Windows my policy was never to use an operating system release until it had been live for at least a year so other people found the bugs. In your case you need a recent kernel to solve another issue so you want to stick with 16.04.
Step 5. Looking at the bug list for GNOME network manager it is clear that they are actively working on a significant number of bugs. It is going to take some time for them to address all the serious ones. Consider replacing the GNOME network manager with another one. Wicd
does not appear to be being actively developed but network management standards have been stable for years. I would recommend trying this as it does not depend on GNOME and is unlikely to have the same issue. You have tried Wicd
in the past and have issues with it so you would like an alternative approach.
Step 6. You don't actually need a network manager to get Wi-Fi connectivity. You can use a terminal. Detailed instructions are here. Connecting to WPA Wi-Fi from the terminal
Solved! Thanks @WinEunuuchs2Unix, it seems that by applying a similar method than the one described here WiFi signal icon switches to Ethernet icon (up down arrows) after Suspend?, I managed to solve the problem.
The conditions were not exactly the same, and I had to adapt the solution. Basically, restarting network-manager doesn't fix the problem, but unloading the reloading the kernel module worked!
So here is how I adapted the script:
#!/bin/sh
# NAME: /lib/systemd/system-sleep/wifi-reset
# DESC: Resets Realtek WiFi after a long suspend.
# DATE: Aug 25, 2017. Modified Aug 25, 2017.
MYNAME=$0
DRIVER=rtl8192ee
restart_wifi() {
/usr/bin/logger $MYNAME 'restart_wifi BEGIN'
/sbin/modprobe -v -r $DRIVER # This removes the driver
/sbin/modprobe -v $DRIVER # This starts the driver
#systemctl restart NetworkManager.service # network manager restart disabled as not needed
/usr/bin/logger $MYNAME 'restart_wifi END'
}
/usr/bin/logger $MYNAME 'case=[' ${1}' ]'
case "${1}/${2}" in
hibernate|suspend|pre*)
;;
resume|thaw|post*)
restart_wifi;;
esac
It works perfectly now :)
Thanks guys!
Best Answer
16.04 runs on systemd. Try the following:
If this works, you can create a script to automate it.
Open a terminal and type the following:
sudo nano /etc/systemd/system/wifi-resume.service
Now paste the script in there with a right click. Exit with CTRL + X and press Y to save. Now to activate it:sudo systemctl enable wifi-resume.service
Script:
Hope this helps. It works on my laptop.