Ubuntu 16.04: Cannot prevent wifi sleep during screen lock
I've tried quite a few approaches to this but haven't been able to get a working solution.
On my laptop I noticed that the wifi 'sleeps' under screen lock which makes it impossible to leave it doing things that require an internet connection. For example: if a backup upload operation is running I would want to lock the laptop and leave it doing the upload.
I didn't see this issue with 15.10 so I'm guessing there's something either in device management or OS which I haven't figured out yet.
After spending a lot of time trying three different ways of turning off power management on the wireless interface I realised even that wasn't preventing the sleep.
For example:
sudo iwconfig wlp2s0 power off
Turns off the power management on the device until reboot but doesn't seem to affect the wireless-sleep-during-screen-lock feature. I've tried something similar with /etc/pm/config.d/wireless
containing a script to do the same command as above but no dice.
Hibernate, sleep and suspend are all turned off and the laptop is a Surface Pro 4 i7.
I'm probably just missing something simple but can't figure it out. Any ideas?
Update 21-06-2016
This morning I've noticed that when a second monitor is plugged in it is ignored on wake / return-from-lock-screen. By unplugging and plugging monitor connection back in all returns to normal.
I think that perhaps somehow the two issues are linked.
Update 10-8-2016 Didn't get anywhere with the links I found in my comment below but found this clue in syslog:
NetworkManager[21369]: <info> [1470826457.2514] manager: wake requested (sleeping: yes enabled: yes)
I left my desk for 10 mins and when I returned I thought the wifi had stayed up. But no - it looks like it had resumed by the time I'd logged back in - perhaps the question here should really be
How do you turn off sleep and wake capability in Ubuntu 16.04.1?
As the standard UI (inc. Gnome tweak) tools & settings don't appear to achieve the right result, turning acpi=off
has other consequences; what other safe methods are there?
Fixed it. Tested by locking and leaving laptop running whilst running a DR / backup - not only did the laptop immediately respond to keyboard unlock but the upload completed in the background.
I had to use the dconf editor after finding some more details on how to disable suspend options - I'm guessing this is only needed for the laptop (Surface Pro 4 i7) due to driver support issues as my desktop does not have this problem. Laptop has this issue even with ethernet connected via docking port so this isn't WiFi specific, it's Ubuntu suspend specific.
The solution is to disable suspend and hibernate altogether, which may seem a bit extreme but I don't have any scenarios where I want the laptop to hibernate under linux. I dual boot with W10 (can't be helped unfortunately) and that deals with the suspend capability very well.
Clues found here and here - they didn't exactly match the resolution but I used them to test out the settings changes.
I changed the settings in org.gnome.settings-daemon.plugins.power
a few times but the active=false
clinched it in the end.
Also tried setting sleep-inactive-ac-timeout
and sleep-inactive-battery-timeout
to 0
(i.e. never) but that didn't seem to effect it.
Had a terminal running with
sudo tail -f /var/log/syslog | grip networkmanager
(grip
is an alias of grep -i
) and once I'd changed active=false
the terminal went quiet all the way through to unlock.
N.B. As I'm using Ubuntu Gnome these settings may not directly match with other DM configurations.