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 pm-suspend-hybrid command from pm-utils as a superuser, which did nothing. I also tried the systemctl hibernate command, which had the same effect as closing the laptop, unfortunately.

The next step was checking out my BIOS setings. Here are the steps I followed:

  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.
  3. Once you’re there, go to Settings -> Power Management -> USB Wake Support and tick the Enable USB Wake Support box. One website said that that box would be unchecked, but my BIOS was already in that state.
  4. Similarly, I went to Settings -> Power Management -> Block Sleep. It said that the Block Sleep option would be selected, but once again, my BIOS was already in that configuration.
  5. The next step was to update the BIOS:
    1. Repeatedly press F12 (I don’t actually know if doing it once suffices)
    2. Slecting 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 ArchWikis, specifically, the Power Management section.

  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, you’ll have to change the kernel parameters by editing the /etc/default/grub file as a superuser.

  4. Since that was what I wanted, in the grub file, the GRUB_CMDLINE_LINUX_DEFAULT (the boot options) will be set to quiet splash.

    • The quiet part just means “non-verbose.” Without this, a bazillion messages would be printed to the screen.
    • The splash bit gives us something to look at while the real stuff loads in the background. Without this, we’d just be staring at a blank screen.
  5. After the quiet splash, add the text mem_sleep_default=deep, and write and quit.

  6. Now type in

     sudo grub-mkconfig -o /boot/grub/grub.cfg
    
  7. Reboot, test, and we’re done!