On Arch Linux, with systemd, the following commands are all symlinks to systemctl:
/usr/bin/telinit
/usr/bin/poweroff
/usr/bin/runlevel
/usr/bin/reboot
/usr/bin/halt
/usr/bin/shutdown
I find their behaviour with respect to authorization confusing:
$ shutdown
Must be root.
$ halt
Must be root.
$ telinit 3
# Asks for Polkit authorization
Neither poweroff nor reboot asks for authorization. poweroff doesn't actually turn off my system, the laptop remains on with text on the screen stating it is powering off - indefinitely.
I haven't tinkered with Polkit rules, so I wonder why their behaviour is so.
- All commands were tried with my non-root admin user, who's a member of
wheel. /etc/polkit-1/rules.donly seems to contain a default ruleset:# tail /etc/polkit-1/rules.d/* // DO NOT EDIT THIS FILE, it will be overwritten on update // // Default rules for polkit // // See the polkit(8) man page for more information // about configuring polkit. polkit.addAdminRule(function(action, subject) { return ["unix-group:wheel"]; });
On closer inspection, /usr/share/polkit-1/actions/org.freedesktop.login1.policy has sections for poweroff, reboot, suspend and hibernate, with allow_active set to yes. But there are no sections for shutdown. If this is the cause, why is it so?
shutdownbehaves likehaltinstead ofpoweroffwhen used without timeouts/messages. Bothshutdownandhaltseem to turn off my system. – muru Jun 15 '15 at 17:07shutdowndefaults to "poweroff with timeout"... so are you saying thatshutdownpowers it off, butpoweroffdoesn't? – intelfx Jun 15 '15 at 17:10systemctl %svs halt/reboot/poweroff: https://github.com/systemd/systemd/issues/213 – intelfx Jun 15 '15 at 18:43poweroff,haltand friends now seem to be able to use interactive auth again. But TBH I haven't been following systemd development so closely these days, so I can't tell what exactly was changed and why. – intelfx May 15 '18 at 20:46