How to fix the Dell XPS 13 9370 (2018) not sleeping properly in Linux

I bought the Developer Edition of the Dell XPS 13 9370 (early 2018 model) a few months ago, which came with Ubuntu 18.04 LTS. I later installed Fedora Linux, which worked fine, except the laptop would always wake itself up from sleep mode or never actually sleep in the first place (just turn the screen off).

After a bit of digging, I found a solution across a few forum threads. It turned out that the laptop was never entering a “deep sleep” mode, instead using a “s2idle” (Suspend-To-Idle) mode. This bug was filed with the Linux kernel last year, but it has yet to be fixed. Since it’s a kernel-related bug, it affects pretty much every Linux distribution using a recent kernel release.

Note: I only tested this on a Dell XPS 13 9370 while running Fedora 29, Fedora 30 Beta, and Pop_OS 19.04. I have no idea if this works with other laptops or Linux distributions, and most of it was copy-pasted from Ask Ubuntu and Ask Fedora.

Diagnosing the problem

To confirm that the ‘s2idle’ mode is what is causing your laptop’s sleep issues, first close the lid (or put the laptop to sleep using another method). Then wake the laptop up and run this Terminal command:

cat /sys/power/mem_sleep

If the output is:

[s2idle] deep

Then your laptop isn’t entering deep sleep, and the default suspend mode is s2idle (since it is highlighted with brackets).

Temporary fix

To try a temporary fix, run this command:

sudo deep > /sys/power/mem_sleep

The output should look like this:

s2idle [deep]

Then suspend the laptop and wake up again. The laptop will probably take an extra second or two to wake up, but to truly test it, you can put your computer to sleep for a couple of hours and check back.

Permanent fix

To make this change permanent, you have to edit your kernel options. This process varies by what Linux distribution you’re using.

Ubuntu, Fedora, and other systems with GRUB2:

On Linux distributions using GRUB2 as the bootloader, edit as root user the file /etc/default/grub, by running this command:

sudo nano /etc/default/grub

Find the line that says “GRUB_CMDLINE_LINUX”. Find where it says “quiet splash” (it’s probably at the end of the line), and then add this after “quiet splash”, but before the ending quote:

mem_sleep_default=deep

Then do CTRL-X to exit nano, and type ‘Y’ to save changes.

Then you have to regenerate your grub configuration. Here’s the command for Ubuntu:

sudo grub-mkconfig -o /boot/grub/grub.cfg

And here’s the command on Fedora:

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Then try shutting down your laptop (not rebooting) and make sure the changes are permanent.

Pop_OS and other systems with systemd-boot:

Some distributions use systemd-boot instead of GRUB2 as the bootloader. On Pop_OS, all you have to do is run this command:

sudo kernelstub -a mem_sleep_default=deep

Then run this command to see all your bootloader options:

sudo kernelstub -p

The kernel boot options should now include the sleep mode:

Kernel Boot Options:.quiet loglevel=0 systemd.show_status=false splash mem_sleep_default=deep

Then try shutting down your laptop (not rebooting) and make sure the changes are permanent.

%d bloggers like this: