Robustly configure suspend / lock?

Am using the i3 community edition which seems to have the xfce4-power-manager pre-installed. I am not committed to this tool at all, but it seems like it should do the job.

What I want is quite simple: after X minutes, lock the screen and suspend the system. There are several locking tools pre-installed… xflock4, blurlock, i3lock. When configuring (through the xfce4-power-manager-settings) to have the system suspend on battery after 2 minutes and then running xfce4-power-manager --debug --no-daemon, then waiting 2 minutes, I get the error:

(xfce4-power-manager:40410): xfce4-power-manager-WARNING **: 18:36:34.037: Failed to hibernate via systemd: GDBus.Error:org.freedesktop.login1.SleepVerbNotSupported: Not enough suitable swap space for hibernation available on compatible block devices and file systems
TRACE[xfpm-suspend.c:201] xfpm_suspend_try_action(): Executing command: pkexec /usr/bin/xfce4-pm-helper --hibernate

(xfce4-power-manager:40410): xfce4-power-manager-WARNING **: 18:36:34.083: Failed to suspend/hibernate: Child process exited with code 1
TRACE[xfpm-brightness-polkit.c:160] xfpm_brightness_polkit_set_level(): Executing command: pkexec /usr/bin/xfpm-power-backlight-helper --set-brightness 34915

In addition, if the “lock screen when system is going to sleep” option is set, I will get a “none of the lock tools ran successfully” message. If this is not set, I won’t get the popup message and the screen won’t suspend (so I assume the lock tools alone are not preventing suspend). As for the xfpm-brightness line, maybe that is the issue? Currently I am having to adjust brightness with brightnessctl:

bindsym XF86MonBrightnessUp exec "brightnessctl s +10%"
bindsym XF86MonBrightnessDown exec "brightnessctl s 10%-"

I’ll add that systemctl suspend works as expected, along with the zoo of screenlocking tools available.

---------------------------------------------------
       Xfce power manager version 4.20.0
With policykit support
---------------------------------------------------
Can suspend: True
Can hibernate: False
Can hybrid sleep: False
Authorised to suspend: True
Authorised to hibernate: False
Authorized to hybrid sleep: False
Authorised to shutdown: True
Has battery: True
Has brightness panel: True
Has power button: True
Has hibernate button: True
Has sleep button: True
Has battery button: True
Has LID: True

Any ideas?

Here you have a message that already tells you what is off for the hibernation after several minutes.
You are lacking enough swap space.
Do you have swap configured? How much is it compared to the available RAM?

You could/should add the inxi output (there are some how to’s that tell you how to do it and what commandline options to use)

In this context (like in many others), suspend is different from hibernate. Hibernation (aka suspend-to-disk) refers to a state where the RAM content is written to the disk, which requires SWAP, while suspend keeps the RAM powered.

2 Likes

For latest version of Xfce (4.20) screen locking is handled by xfce4-screensaver

Xfce 4.20 tour – Xfce

xfce4-power-manager

Screen Locking

There is no dedicated “security” tab anymore. Lock screen management was massively simplified and “Light Locker” was dropped. “lock-on-sleep” is now synchronized with xfce4-session and xfce4-screensaver.

Screen locking settings are now only handled by xfce4-screensaver to avoid conflicts. A button to open xfce4-screensaver-preferences was added:

1 Like

You are attempting to enter hibernation, or perhaps a hybrid sleep state, and as @Erim suggests;

In fact, you are lacking any at all: :eyes:

To hibernate your system, the minimum amount of swap space recommended (for a system with 32 GB of RAM, such as yours) is ~33 GB; preferably as a swap partition though in some circumstances a swap file could be used.

A system might also benefit from a combination of both;
using zswap.

Lastly, you could choose to suspend the system instead. :eyes:

A small amount of swap would still be generally desirable (but not strictly required). A file is created on / (by default), and naturally, you would need to have sufficient space available for the file.

Or, possibly zram which dynamically grows and shrinks as required;

I hope this helps.

Regards.

3 Likes

Thanks all. So I followed this: Swap - Manjaro. Booted into live USB and created linux swap partition, then executed the commands. Now

---------------------------------------------------
       Xfce power manager version 4.20.0
With policykit support
---------------------------------------------------
Can suspend: True
Can hibernate: True
Can hybrid sleep: True
Authorised to suspend: True
Authorised to hibernate: True
Authorized to hybrid sleep: True
Authorised to shutdown: True
Has battery: True
Has brightness panel: True
Has power button: True
Has hibernate button: True
Has sleep button: True
Has battery button: True
Has LID: True

I’m not exactly sure what hibernate is supposed to look like on linux, but after rebooting from hibernate I am certainly not returned to my previous state. Anyway I don’t care for this feature, happy now that suspend is working.

1 Like

Power management/Suspend and hibernate - ArchWiki:

There are multiple methods of suspending available, notably:

Suspend to idle (s2idle):

Called S0ix by Intel, Modern Standby (previously “Connected Standby”) by Microsoft and S2Idle by the kernel. Designed to be used instead of the S3 sleeping state for supported systems, by providing identical energy savings but a drastically reduced wake-up time.

Suspend to RAM (aka suspend or deep sleep):

The S3 sleeping state as defined by ACPI. Works by cutting off power to most parts of the machine aside from the RAM, which is required to restore the machine’s state. Because of the large power savings, it is advisable for laptops to automatically enter this mode when the computer is running on batteries and the lid is closed (or the user is inactive for some time).

Suspend to disk (aka hibernate)

The S4 sleeping state as defined by ACPI. Saves the machine’s state into swap space and completely powers off the machine. When the machine is powered on, the state is restored. Until then, there is zero power consumption.

Hybrid suspend (aka hybrid sleep)

A hybrid of suspending and hibernating, sometimes called suspend to both. Saves the machine’s state into swap space, but does not power off the machine. Instead, it invokes the default suspend. Therefore, if the battery is not depleted, the system can resume instantly. If the battery is depleted, the system can be resumed from disk, which is much slower than resuming from RAM, but the machine’s state has not been lost.

Instructions for correctly setting up hibernation can be found on the same ArchWiki page at: 4 Hibernation

1 Like

Cool, everything seems to be working after adding in the resume hook. I do get a new error on boot:

> [drm] *ERROR* [CRTC:82:pipe A] DSB 0 poll error

However this seems to be related to the graphics driver issues I’ve been having.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.