Quoting Matthias Bodenbinder (matth...@bodenbinder.de): > Am 29.03.2015 um 17:35 schrieb Michael Biebl: > > Am 29.03.2015 um 11:42 schrieb Matthias Bodenbinder: > >> Am 28.03.2015 um 18:51 schrieb Michael Biebl: > >>> You can run something like > >>> > >>> systemd-inhibit --what=shutdown --mode=block /bin/sleep 3600 > >>> > >>> to block shutdown for 1h. > >> > >> This does NOT work. I tested it with debian testing. > > > > Are you sure you are using systemd as PID 1? > > PID 1 is /sbin/init > with > lrwxrwxrwx 1 root root 20 Feb 13 12:22 /sbin/init -> /lib/systemd/systemd > > All my tests where with local root: KDE+konsole, as regular user. Either > executing "poweroff" via "su -" in the konsole or clicking shutdown button in > KDE. > > Example: > > In konsole #1: > su - > systemd-inhibit --what="idle:sleep:shutdown" --mode=block sleep 3600 > > In konsole #2: > su - > poweroff > > The computer is just powered off.
Not using KDE myself, I can only comment on the CLI (and thanks for the clear posting). I think you need to understand that root privilege overrides any inhibitions, as one might expect. This is what works for me: jessiebox ~$ /bin/su - Password: jessiebox ~# systemd-inhibit --what="idle:sleep:shutdown" --mode=block sleep 3600 and moving to a VC or another xterm: jessiebox ~$ /sbin/poweroff Operation inhibited by "sleep 3600" (PID 28227 "systemd-inhibit", user root), reason is "Unknown reason". Please retry operation after closing inhibitors and logging out other users. Alternatively, ignore inhibitors and users with 'systemctl poweroff -i'. jessiebox ~$ jessiebox ~$ systemctl poweroff -i ==== AUTHENTICATING FOR org.freedesktop.login1.power-off-ignore-inhibit === Authentication is required for powering off the system while an application asked to inhibit it. Authenticating as: root Password: [password not typed] Failed to execute operation: Connection timed out Failed to start poweroff.target: Access denied polkit-agent-helper-1: pam_authenticate failed: Authentication failure jessiebox ~$ Now that would have worked if I had typed the password. jessiebox ~$ systemd-inhibit --list Who: /bin/sleep 3600 (UID 0/root, PID 4051/systemd-inhibit) What: shutdown Why: Unknown reason Mode: block 1 inhibitors listed. jessiebox ~$ AIUI it's up to root to check for inhibitions. I also get te impression that mollyguard is really just for trying to prevent you accidently closing down a machine you've ssh'd to because you think you're still local. (I prevent this by using differently coloured prompt strings.) I don't know how well it's integrated with systemd. Cheers, David. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20150331194555.ga12...@alum.home