Ubuntu – Ubuntu 18.04 – Dell XPS13 9370 no longer suspends on lid close

18.04suspendxps

This was working perfectly on 17.10 but after upgrading to 18.04 yesterday, when the lid is closed the screen turns off but doesn't suspend properly.

I travel around a lot and immediately noticed the heat (and battery draining) when taking it out of the travel case.

I've tried uncommenting these lines in /etc/systemd/logind.conf

HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend

and restarted but didn't make any difference.

Best Answer

  • I think I managed to figure out what was going on, thanks to these two sources: Dell XPS 13 (9370) ArchLinux Install notes and Arch Linux Forum.

    For some reason, the laptop is not going in deep sleep anymore, but rather an s2idle mode which is merely a screen off type of suspend.

    Diagnosis of the issue

    To confirm whether this is the case for your system, suspend the laptop using your favorite method (close the lid, hit Fn+End, write pm-suspend in a terminal if you have pm-utils installed, or hit the Windows key type suspend and hit the Enter key).

    Wake up from suspend mode and type in a terminal: sudo journalctl | grep "PM: suspend" | tail -2. If the output is

    May 13 18:41:00 mex kernel: PM: suspend entry (s2idle)
    May 13 20:52:36 mex kernel: PM: suspend exit
    

    Then you are not entering deep sleep. You can also check cat /sys/power/mem_sleep which should return

    [s2idle] deep
    

    which confirms that the default suspend mode is s2idle (since it is highlighted with brackets).

    Temporary fix

    To try a temporary fix, do echo deep > /sys/power/mem_sleep as a root user. Check that it was successful by looking at the output of cat /sys/power/mem_sleep which should be

    s2idle [deep]
    

    then suspend the laptop and wake up again. If sudo journalctl | grep "PM: suspend" | tail -2 returns

    May 13 18:41:00 mex kernel: PM: suspend entry (deep)
    May 13 20:52:36 mex kernel: PM: suspend exit
    

    then the issue should be fixed. You can put your computer to sleep for a couple of hours and check whether the battery drain improved.

    Permanent fix

    To make it permanent, you have to edit your bootloader cmdline. To do so, edit as root user the file /etc/default/grub, by running for example sudo -H gedit /etc/default/grub. Replace the line

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    

    with

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mem_sleep_default=deep"
    

    and regenerate your grub configuration (run sudo grub-mkconfig -o /boot/grub/grub.cfg).