How do I force Laptop to always suspend even when multiple users logged in

I have laptop which has two users when both are logged in and I close laptop lid, I have configured manjaro to suspend when lid is closed, system refuses to suspend and asking other user for permission to suspend.
How I can force system to always suspend when lid closed even when in login screen (I use lightDM)?

I’m using Manjaro Xfce edition
Kernel: 5.15.12-1


Hi @kertzi,

You could run the suspend command as root. But unless specifically set up, that would still require authentication.

For that to work, however, you’d have to know how to suspend the computer from command line, and seeing as I use KDE and not Xfce, I don’t know if any of the commands for me would work for you.


I believe I have found the command, I just don’t know how to change the command run when Xfce suspends…but I believe I can do it in a very hacky uncool way…or at least, I find it uncool, hacky and don’t really recommend it.

I also don’t kknow hoow to change the command that is run when the laptops lid is closed…

That has been the multi-user design of Linux kernel. The machine running with Linux kernel can host many different user sessions at the same time, each with its own UI (keyboard, mouse, monitor, DE). If a user suspends the machine, that will negatively affect other users. So normally, it’s forbidden for normal user to be able to shut down the system completely when other users are logged-in. It’s just the design.

It must be the superuser to suspend the machine when there are multiple user sessions.

1 Like

Okay, thanks for responses.
Yes I know how linux is designed but its not very best design for laptop use case when users often sit on computer physically and only user switching happens. I understand design where it comes from when multiple user could logged in and use same computer remotely but that’s not a case with laptop (most cases).

I just hope that maybe there is some feature in gdm/graphical login manager which can be set to allow suspends, maybe sudo without password or some other hack. Its funny that gdm offers suspend on login screen but If you click it nothing happens if other users have session running (idle session because no remote access).

It would be helpful if you can then tell me where are the scripts which os executes when lid closes.

Have a look here:

Hope this helps!

1 Like

What you did was treating your laptop the same model as centralized remote computer. You can connect additional keyboard, mouse, and display to your laptop, adjust some settings (multi-seat), and the other user can use your laptop simultaneously while you’re using it.

AFAIK, none for your case.

Your idea of laptop doesn’t apply exactly to Linux. Linux has its own root from UNIX, you’ll expect personal computer being treated as centralized computer and you are the administrator user (when you first create the first account during fresh installation). First paragraph explanation again.

Since one of your account will have superuser power, you can manage the power state of your system from the terminal from your account with superuser capability (your account that can do sudo or su).

I give you 2 references on how to manage power state from terminal:

Note that managing power state involves sysfs manipulation and this is very dangerous as it can risk breaking your system. So make sure you understands the reference link to the official kernel documentation. Make a shell script if you must, since the steps above are still rather manual. And remember it must be by sudo because there are many user log-ins.