Sleep and Wake

The Problem

Éowyn, my lovely Dell XPS 15 9570, likes to give its Ubuntu (and Linux) users hell when it comes to going to sleep mode and waking up. As it stood, I couldn't close my laptop and then resume working, which was rather problematic since closing the laptop should have theoretically only put the computer in sleep mode. Every time I closed the lid, I had to power off and power on my laptop.

Stuff that didn't work

The first solution I looked up was command-line ways to put the computer to sleep. I tried using the
command from pm-utils as a superuser (which did nothing) as well as tried the
systemcl hibernate
command. The latter had the same effect as closing the laptop, unfortunately.

The next step was checking out my BIOS settings.

  1. Get drivers (an .exe file) from the Dell website (a truly dreadful experience), put the file on a USB drive, and mount the drive.
  2. Shut down the computer and enter the BIOS by pressing the F2 key, and going to SettingsPower ManagementUSB Wake Support as well as SettingsPower ManagementBlock Sleep. Why are BIOS's so painful to navigate?
  3. One website said that the Enable USB Wake Support button would be disabled, and that I should enable it. It also said that that the Block Sleep option would also be selected, and that I should disable it. However, my BIOS settings were already in these states.
  4. The next step was to update the BIOS.
    1. Repeatedly pressing F12 (I don’t actually know if doing it only once suffices)
    2. Selecting the BIOS Flash Update
    3. Navigating to and selecting that .exe file we talked about earlier
    4. Waiting for a while
This did absolutely zilch to fix the issue, but it was a learning experience. Yay! I now know how to update my BIOS.

The Solution

There’s a pretty simple 4-ish minute long YouTube video that explained this the best. The chap pulled a ton of this stuff from the ArchWikis. The pertinent stuff can be found in the Power Management section of the page.

  1. If you type
    cat /sys/power/mem_sleep
    you’ll see the (default) response: [s2idle] deep, meaning that the s2idle is selected.
  2. To fix the issue, you’ll want to use the deep version instead. You could just go ahead and use the command
    echo deep|sudo tee/sys/power/mem_sleep
    which would temporarily fix the issue.
  3. To make the change permanent, change the kernel parameters by editing the /etc/default/grub as a superuser.
  4. In the grub file, the GRUB_CMDLINE_LINUX_DEFAULT (the boot options) is set to quiet splash.
  5. After the quiet splash, add the text mem_sleep_default=deep
  6. Now type
    sudo grub-mkconfig -o /boot/grub/grub.cfg
  7. Reboot, test, and we’re done!