Upgraded Ubuntu 16.04 sometimes fails to sleep

5,287

Solution 1

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

Solution 2

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:

Share:
5,287

Related videos on Youtube

MiroJanosik
Author by

MiroJanosik

Updated on September 18, 2022

Comments

  • MiroJanosik
    MiroJanosik over 1 year

    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.

  • MiroJanosik
    MiroJanosik almost 8 years
    Exactly. I have core 4.4.0-21. Fixed by rebooting into older available core (in my case '4.2.0-30').
  • storm
    storm almost 8 years
    Can you edit your answer and add how exactly you did it ?
  • MiroJanosik
    MiroJanosik over 7 years
    This would not help me because I was already using xscreensaver instead of light-locker. I did that change it before the problem.
  • pauljohn32
    pauljohn32 over 7 years
    This one solves the "I can't see my cursor after a suspend and resume cycle". It doesn't affect the problem that there hung program.
  • MiroJanosik
    MiroJanosik over 7 years
    Which version of kernel do you have? (you can find it out by "uname -a"), maybe you have also bugged 4.4.0-21?
  • pauljohn32
    pauljohn32 over 7 years
    After several months, I still have this problem, using all kinds of kernels... Linux delllap-16 4.8.0-32-generic #34-Ubuntu SMP Tue Dec 13 14:30:43 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • WinEunuuchs2Unix
    WinEunuuchs2Unix about 7 years
    Can't believe your lengthy research efforts had no up-votes. +1 and well done.