How to shutdown with consolekit without sysvinit (but with systemd)

consolekitshutdownsystemdsysvinit

I have systemd (and no sysvinit) installed on a Arch Linux box. However, I cannot shutdown/reboot with consolekit (dbus interface). # systemctl {shutdown,reboot} work just fine, so I guess it's because consolekit doesn't know how to contact the pid 1 process.

Best Answer

After having a look at the source code, it seems that consolekit(ck) uses a short script to do shutdown and reboot. These two scripts are installed as

/usr/lib/ConsoleKit/scripts/ck-system-{stop,restart}

in Arch Linux and they simply find and exec {,/usr}/sbin/shutdown to do that.

Therefore, there seems no way to configure ck to do that now (by normal I just mean simply edit some file(s) in /etc), and the work around is straightforward.

  1. simply edit those two scripts to exec systemctl {shutdown,reboot}. (But at least on Arch Linux, it will probably be overwrite after each upgrading.)

  2. simply create a wrapper script at /sbin/shutdown that do the right thing. (This will cause conflict if you want to install sysvinit later, but hopefully not a problem.)

I will also look for (and create if there haven't been one) a bug report on the problem and I hope it can be done in a better way in the future (really don't like to do configuration outside /etc).

NOTE: Arch Linux now have the systemd-sysvcompat package which provide these (init/halt/shutdown etc.) as symlink to systemctl/systemd.