SLEEP in KDE

(guessing this is the category for my topic)

have run “sudo cat /sys/power/mem_sleep” and gotten response on new computer

“s2idle”

expected:

“s2idle [deep]”

Have seen one suggestion to modify GRUB at
GRUB_CMDLINE_LINUX_DEFAULT adding “mem_sleep_default=deep” – this did not fix my concern.

Mine is exactly the same and you can change some settings in the UEFI Bios to enable different modes.

[ricklinux@rick-ms7c37 ~]$ sudo cat /sys/power/mem_sleep
[sudo] password for ricklinux: 
s2idle [deep]
[ricklinux@rick-ms7c37 ~]$ 

https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate

Edit:

https://wiki.archlinux.org/title/Talk:Power_management/Suspend_and_hibernate

Perhaps:

there is only one way to cause the system to go into the Suspend-To-RAM state (write
“deep” into /sys/power/mem_sleep and “mem” into /sys/power/state).

:eye: https://www.kernel.org/doc/Documentation/power/states.txt

From my system:

cat /sys/power/mem_sleep 
[s2idle] deep
cat /sys/power/state 
freeze mem disk

:thinking:

[please excuse my confused comprehension, seems I need the dummie explanation]

do I understand correctly I can edit “mem_sleep” adding “deep” after “[s2idle]” and that will suffice to cause a -suspend to ram- when I select sleep ?

I don’t have a lot of experience setting these. I use a desktop mostly and never worry about hibernation or suspend modes. The reason being is i also have mechanical keyboards that don’t work well with this and i also find graphics cards are another issue trying to resume from sleep.

I already have that in the file? /sys/power/mem_sleep

s2idle [deep]

Mine is the same and my desktop does go into sleep if i activate it from the menu but coming out of it is the issue. My mouse won’t work properly and sometimes i have issues also with the graphics.

Edit: If i run systemctl suspend it has issues with mouse and graphics also if not more.

What I posted above is from an Intel-based (CPU-iGPU) laptop.
Suspension-to-RAM and waking up from suspension works fine on this system.

I think it does on my Intel also with an Nvidia card but i haven’t tried it for a while so i may be wrong.

Edit: I just face the reality that all these products are designed to function around Windows. Unless you have a product that is 100% designed to work with Linux it’s a crap shoot.

1 Like

@garybean

Okay i got this working on KDE with my hardware which is Ryzen 3800X Cpu and AMD RX 590 Graphics card. So my settings are the same as @pebcak showed.

cat /sys/power/mem_sleep 
[s2idle] deep
cat /sys/power/state 
freeze mem disk

I added the kernel parameter to grub and updated grub.

mem_sleep_default=deep

So on KDE from the menu if i click on sleep it automatically shuts down and the power button is flashing. I am using a mechanical keyboard and mouse set that are usb. When i press the power button it comes back on and the screen is black but the mouse cursor is there. You have to wait so many seconds and then the screen comes up to the login and i do have mouse control. My system works this way normally when you boot the computer the keyboard and mouse take a bit of time before they light up as it is starting at the UEFI Bios screen. So you just have to be a little more patient.

1 Like

having a bit of trouble editing “/sys/power/mem_sleep” to add “deep”

have modified grub to include:
GRUB_CMDLINE_LINUX_DEFAULT=“loglevel=3 nowatchdog nvme_load=YES mem_sleep_default=deep” – have also updated grub with “grub-mkconfig -o ~/grub.cfg”

when I try to directly edit “/sys/power/mem_sleep” with kate:
after I am asked for root privilege, I get an error message “The document could not be saved, as it was not possible to write to /sys/power/mem_sleep. Check that you have write access to this file…”

help, please

Doesn’t it already have it?

cat /sys/power/mem_sleep

Hopefully you used

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

do have “/sys/power/mem_sleep”

did use “sudo grub-mkconfig -o /boot/grub/grub.cfg”

just hung up trying to edit “/sys/power/mem_sleep” to include “deep”

Doesn’t it already have the proper entry? Hence why i asked for the output of this command.

cat /sys/power/mem_sleep

Edit: example:

[ricklinux@rick-ms7c37 ~]$ cat /sys/power/mem_sleep
s2idle [deep]

“cat /sys/power/mem_sleep” output is:
[gary@AR14 ~]$ cat /sys/power/mem_sleep
[s2idle]

my usual method to edit file “mem_sleep” via kate, did try nano without success

might there be a way to change some other parameter that would cause mem_sleep to include “deep” ?

Did you try using nano? (text editor)

sudo nano /sys/power/mem_sleep

add as needed

s2idle [deep]

ctrl + o and then enter to save

ctrl + x to exit nano

Edit: Sorry, did you try using sudo with nano already?

used above message as template (in nano)
did change entry to: “s2idle [deep]”
then: ctrl + o and then enter to save I see: File Name to Write: /sys/power/mem_sleep
hit enter, see: File was modified since you opened it; continue saving?
then: Y Yes
N No ^C Cancel
selecting Y gives error message of invalid argument

(hopefully my description above accurately describes my action and what I see in konsole)

Yes it seems you can’t change this file without a special way of doing it. I’m not sure what sets this file from the beginning? Mine is already set this way. Maybe someone else has the answer. You can use the echo command to add it but is only temporary as it reverts when you reboot. So I’m not sure why yours isn’t set this way.

@garybean

You could try this.

echo deep > /sys/power/mem_sleep

In the default grub command line make sure you add this kernel parameter.

mem_sleep_default=deep

Then update grub

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

Then reboot and verify if it stays permanently.

cat /sys/power/mem_sleep

Edit: No it still won’t allow you to write to the file.