Upgraded Ubuntu 16.04 sometimes fails to sleep
I upgraded my system from 15.10 (Ubuntu + xfce = XUbuntu) to 16.04 and afterwards it happens 50% that when I send system to Sleep through "start menu > turn off > sleep" that screens go blank and hardware keeps running (I hear fans are turning). I can't change to console (ctrl + alt + f2) or do anything else. I'm looking for way how to trace this problem down. I did not find anytihng in following logs:
/var/log/syslog.1
May 1 01:05:01 lampa CRON[7380]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 1 01:14:27 lampa NetworkManager[884]: <info> [1462058067.4749] manager: sleep requested (sleeping: no enabled: yes)
May 1 01:14:27 lampa NetworkManager[884]: <info> [1462058067.4749] manager: sleeping...
May 1 01:14:27 lampa whoopsie[796]: [01:14:27] offline
May 1 01:14:27 lampa NetworkManager[884]: <info> [1462058067.4750] manager: NetworkManager state is now ASLEEP
May 1 01:14:27 lampa systemd[1]: Reached target Sleep.
May 1 01:14:27 lampa systemd[1]: Starting Suspend...
May 1 01:14:27 lampa systemd-sleep[7497]: Failed to connect to non-global ctrl_ifname: (nil) error: No such file or directory
May 1 01:14:27 lampa systemd-sleep[7499]: /lib/systemd/system-sleep/wpasupplicant failed with error code 255.
May 1 01:14:27 lampa systemd-sleep[7497]: Suspending system...
/var/log/pm-suspend.log.1
Last line is too old, from: Tue Apr 26 19:44:13 CEST 2016: Finished. File 'pm-suspend.log' is empty.
/var/log/kern.log
...
Apr 30 21:26:34 lampa kernel: [ 8420.249061] Key type cifs.idmap registered
May 1 01:14:27 lampa NetworkManager[884]: <info> [1462058067.4749] manager: sleep requested (sleeping: no enabled: yes)
May 1 01:14:27 lampa NetworkManager[884]: <info> [1462058067.4749] manager: sleeping...
May 1 01:14:27 lampa NetworkManager[884]: <info> [1462058067.4750] manager: NetworkManager state is now ASLEEP
May 1 08:01:21 lampa kernel: [ 0.000000] Initializing cgroup subsys cpuset
...
I was looking for a Xorg log, but I don't know which log lines belong to this moment in time. When I lookged on it by file date (files Xorg.0.log and Xorg.0.log.old) these files are quite short and without errors, they end up with:
[ 11.084] (II) This device may have been added with another device file.
[ 12.912] (II) RADEON(0): Allocate new frame buffer 2048x768 stride 2048
[ 12.912] (II) RADEON(0): VRAM usage limit set to 931309K
[ 1258.032] (II) AIGLX: Suspending AIGLX clients for VT switch
[ 1259.227] (II) AIGLX: Resuming AIGLX clients after VT switch
and
[ 10.176] (II) RADEON(0): Allocate new frame buffer 2048x768 stride 2048
[ 10.176] (II) RADEON(0): VRAM usage limit set to 931309K
dmesg
I can't find dmesg.0 on my system, I see only 'dmesg' and it is empty.
Where to look next?
Edit: I found that it happends only after I run 'wine emulator with battle.net a game StarCraft 2'. I tried to kill all those processes that spawn and remain after I play the game. I'm wondering if my graphic card does not switch to some mode that can't sleep.
I still have this problem, but have tested many possible fixes. The essence of the problem is that the suspend job fails, hangs.
I've tried fishing through kernel logs line by line, still don't know for sure what is causing this. I thought problem was video, but now suspect it is network and/or USB-C support.
When the suspend fails, log in again, open a terminal. If in ps aux output, you see something like this, then you are in same situation.
$ ps aux | grep sus
root 22926 0.0 0.0 8668 840 ? Ss 23:07 0:00 /lib/systemd/systemd-sleep suspend
That job, 22926, can be killed, which will cause the PC to suspend immediately.
$ sudo kill -9 22926
This week, I've found a pretty good way to avoid this. Create a script file like this:
sudo /etc/init.d/network-manager stop
sudo /etc/init.d/networking stop
sudo systemctl suspend
For me, this reduces the delay when suspending and it has never failed yet
When you restart, you need to remember to re-start network manually.
sudo /etc/init.d/network-manager stop
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
sudo /etc/init.d/network-manager start
This again tells network to close down, just for fun, and restarts it.
This is a high level solution. I've been into the weeds, changing lots of details within suspend scripts. Nothing has worked as well as this.
The other interesting thread I found on this was that the hardware devices are malfunctioning and causing a false wakeup. I tried that, but no benefit. I do not think the suspend job would still be failed if this were the real issue.
Quite a few people have this same problem, seems like there might be many possible causes. Check out this Ask Ubuntu search. Some of my favorites:
- 16.04 - systemd suspends system but upon resume kernel then enters sleep and wake-up
- laptop fails to suspend or hibernate (wakes up after 2-5 seconds without user interaction)
- Immediate wake up from suspend caused by USB 3.0 devices
- wakeup - How do I prevent immediate wake up from suspend and/or hibernation?
- 14.04 - Ubuntu wakes up after few seconds of sleep
You are likely experiencing this bug.
To fix, try installing a new kernel.
Commands for 64 bit system:
cd /tmp wget \ kernel.ubuntu.com/~kernel-ppa/mainline/v4.5.2-wily/linux-headers-4.5.2-040502_4.5.2-040502.201604200335_all.deb \ kernel.ubuntu.com/~kernel-ppa/mainline/v4.5.2-wily/linux-headers-4.5.2-040502-generic_4.5.2-040502.201604200335_amd64.deb \ kernel.ubuntu.com/~kernel-ppa/mainline/v4.5.2-wily/linux-image-4.5.2-040502-generic_4.5.2-040502.201604200335_amd64.deb sudo dpkg -i linux-headers-4.5*.deb linux-image-4.5*.deb
source: Padraig Galvin, bug report comment #26