How to disable sleep, hibernate any other similar functions.

I know this is not an Install/Boot/Login question but I think is a very close to the idea behind this forum :wink:

Woking in a multi boot environment I want to disable all forms of suspension to disk, due to possible disk corruption on resumption as another OS may have changed the filesystem. I can do it for windows with no problem by killing fast start-up but want to lock down the Linux systems too.

I have found a post elsewhere that suggests:-

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Will this work for OpenSUSE or is there a better way to implement what I want?

Cheers,

That’s not what your subject says. If you want to be sure hibernation is not possible, boot with “nohibernate” on kernel command line. If you are using UEFI and Secure Boot is enabled, hibernation is prohibited anyway.

Sleep cannot be blocked at all if it was enabled during kernel build.

Will this work for OpenSUSE

It won’t work anywhere. You can always do “echo disk > /sys/power/state”.

If you want to hide these options in your desktop environment, see “man sleep.conf.d”, it is better approach. But anyone with root privileges can bypass systemd entirely.

P.S. and it openSUSE, not OpenSUSE.

Thanks for the pointers and background . Hiding the options in the desktop environment is what I think I actually wanted to achieve. It prevents hibernation by mistake which is my real worry.

My machines have no swap. Thus KDE hides hibernation automatically.