Currently on Ubuntu, the actual shutdown is performed by console-kit-daemon
, the ConsoleKit daemon, which runs with root privileges. The ConsoleKit daemon receives the shutdown request from the desktop panel application via D-Bus. The policy that allows unprivileged processes to speak to privileged processes is handled by polkit (formerly PolicyKit). You can emulate the ConsoleKit invocation via dbus-send
if you wish. In particular, to tell ConsoleKit to perform a shutdown you can do:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" \
/org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
On Ubuntu, ConsoleKit replaced the Hardware Abstraction Layer (HAL), a subsystem aimed to allow desktop applications to discover and use the hardware of the host system through a portable and abstract API, regardless of the type of the underlying hardware. HAL is today deprecated in most Linux distributions. The equivalent dbus-send
invocation using HAL is:
dbus-send --print-reply --system --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer/org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown
Currently, ConsoleKit is not actively maintained. The focus of the freedesktop.org project has shifted towards the built-in seat/user/session management of the systemd init system called systemd-logind. How this will affect distributions who adopted their own init systems, like upstart in Ubuntu, remains to be seen.
mount
(ing) might help a bit in understanding. I, personally, chew heavily on them at the moment – erch Nov 30 '13 at 14:05