Since I failed to find a way to tell systemctl to go to sleep in a one-time specified mode (see previous question), I decided to write some script to change whether the system goes to sleep in shallow or deep mode by writing directly into /sys/power/mem_sleep.

Available values on my system are s2idle and deep (default).

However, though I did that before, I cannot do it anymore: echo "[s2idle] deep" | sudo tee /sys/power/mem_sleep returns tee: /sys/power/mem_sleep: write error: Invalid argument and manual edit via vim as root I also cannot save. I think I set the default kernel sleep mode to be deep... could that be the problem?

1 Answer 1


I think if you cat /sys/power/mem_sleep, you'll see a list, with the one selected in brackets:

$ cat /sys/power/mem_sleep
s2idle [deep]

If you want to change the selection, write the name of the one you want, not the entire line:

$ echo s2idle | sudo tee /sys/power/mem_sleep
$ cat /sys/power/mem_sleep
[s2idle] deep

If your desired state does appear in this list, check your BIOS or UEFI setup for suspend-related settings.

  • damn, that was simple, I should have thought of it from the behavior of /sys/power/state, thanks for your help! Oct 12, 2022 at 12:43
  • 1
    It's actually not that simple. Things like sudo echo "s2idle" > /sys/power/mem_sleep, or sudo echo "s2idle" >> /sys/power/mem_sleep, don't work due to permissions issues since apparently the echo command gets sudo applied, but not the writing part to the file. So, the sudo tee technique, oddly enough, is required. Jun 12, 2023 at 15:50
  • @AndyDalton, nobody suggested it here. But I was stuck on that and landed here after a google search. I suspect others land here from similar Google searches, so I just figured I'd point it out. Jun 13, 2023 at 16:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .