0

On Debian 10.9 using cinnamon Desktop environment, if I close the lid of my laptop, the laptop goes into suspend mode, but when I open the lid, I can see what I was working on for a split second until the screen actually locks.

If I press the button on the keyboard to suspend, or I use a command to enter the suspend state (opposed to just closing the lid), then suspend works properly. Its almost as if the laptop's firmware is putting the CPU into the S3 state before the cinnamon-screensaver process can lock the screen.

How can I resolve this issue?

0

At first, I tried to use the method listed in https://bbs.archlinux.org/viewtopic.php?id=166221 as it completely described my issue. However, the approach they were taking was a keybind to a script that manually ran the lock command before initiating the suspend.

What I found to work best for my situation was to modify the systemd unit file at /usr/lib/systemd/system/systemd-suspend.service, and replace the contents of the [Service] section with the following:

[Service]
Type=oneshot
ExecStart=/usr/bin/sleep 2
ExecStart=/lib/systemd/systemd-sleep suspend

This way, the OS will sleep 2 seconds, giving time for the cinnamon process to complete the lock screen, before ever sending the command to suspend. The Type=oneshot was already present, which signifies that multiple ExecStart= fields are allowed and that they will be executed sequentially, not in parallel, which allows for sleeping before the suspend command is sent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.