[arch-general] systemctl reboot

Ralf Mardorf ralf.mardorf at rocketmail.com
Sat Sep 13 13:07:19 EDT 2014

On Sat, 2014-09-13 at 17:42 +0200, Neven Sajko wrote:
> On 13 September 2014 17:30, Mateus Rodrigues Costa <charles.costar at gmail.com
> > wrote:
> > I think this is because your current session is the only session running.
> > In those situations systemctl power management commands don't ask for
> > root/sudo password. Not sure how to disable though.
> > If you had another session running (e.g. a VT) the commands would ask for
> > root/sudo password.

Correct, if I run a second session no reboot happens:

$ systemctl reboot
User chuser is logged in on tty2.
Please retry operation after closing inhibitors and logging out other users.
Alternatively, ignore inhibitors and users with 'systemctl reboot -i'.

_But_  systemctl reboot -i  does work with 2 sessions running by different users.

> Systemd, of course, *would* ask for a password, if polkit (PolicyKit)
> weren't there.

And yes, polkit is installed:
$ pacman -Q polkit
polkit 0.112-2

Since I also want to be ask for a password before screen locking or a
logout, I guess I'll use this or a similar scrip for fbpanel menu

$ cat /usr/local/bin/obexit

# /usr/local/bin/obexit

case $1 in
 .lock)         sudo -k echo
                if [ "$?" = "0" ]; then xflock4; fi;;
 .logout)       sudo -k echo
                if [ "$?" = "0" ]; then /usr/lib/fbpanel/xlogout; fi;;
 -o|--logout)   roxterm -T "Log Out"     -e obexit .logout;;
 -l|--lock)     roxterm -T "Lock Screen" -e obexit .lock;;
 -r|--restart)  roxterm -T "Restart"     -e sudo -k shutdown -r now;;
 -s|--shutdown) roxterm -T "Shut Down"   -e sudo -k shutdown -h now;;
 -a|--about)    echo "$0 $obexit_version Rocketmouse";;
 -v|--version)  echo "$obexit_version";;
 *)             echo Usage: obexit [OPTION]
                echo ".lock           xflock4 Lock Screen"
                echo ".logout         fbpanel Log Out"
                echo "-o, --logout    Term Log Out"
                echo "-l, --lock      Term Lock Screen"
                echo "-r, --restart   Term Restart"
                echo "-s, --shutdown  Term Shut Down"
                echo "-a, --about     About"
                echo "-v, --version   Version"

JFTR a user can run  shutdown -r now  too.


More information about the arch-general mailing list