Difference between revisions of "ConsoleKit"

From ArchWiki
Jump to: navigation, search
(Use D-Bus for power operations: rw OOD template into question; failed to notice upower is still shipped with the 0.99.x branch)
m (Fix link: Display Manager redirects to Display manager)
Line 26: Line 26:
This starts [[Openbox]] with proper environment variables so it and its children are able to use ConsoleKit.
This starts [[Openbox]] with proper environment variables so it and its children are able to use ConsoleKit.
[[Display Manager|Display managers]] like [[KDM]], [[GDM]], [[LXDM]] and [[SLiM]] start ConsoleKit automatically with each X session.
[[Display manager]]s like [[KDM]], [[GDM]], [[LXDM]] and [[SLiM]] start ConsoleKit automatically with each X session.

Revision as of 09:18, 22 April 2015

Warning: Arch Linux only has official support for logind [1] and systemd. When using ConsoleKit, please mention so in support requests.
Note: While Consolekit is no longer maintained upstream, the fork ConsoleKit2 is under development. [2]

ConsoleKit2 is a framework for defining and tracking users, login sessions, and seats. Its function is to support multiuser setups. It also works for a single user, but offers no benefits compared to existing methods. [3]


Install consolekitAUR and polkit-consolekitAUR from the AUR.


Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Content must be revised for ConsoleKit2 and other developments (Discuss in Talk:ConsoleKit#)


To launch an X session with ConsoleKit, append the following to the exec statement in ~/.xinitrc e.g.:

exec ck-launch-session dbus-launch --sh-syntax --exit-with-session openbox-session

This starts Openbox with proper environment variables so it and its children are able to use ConsoleKit.

Display managers like KDM, GDM, LXDM and SLiM start ConsoleKit automatically with each X session.

  • Do not nest ConsoleKit sessions by calling one from another, or you will break ConsoleKit.
  • In particular, since SLiM reads ~/.xinitrc, you should make sure not to run ck-launch-session there.

No display manager

If you are not using a display manager, but starting your window manager via the startx command, or from inittab.

If ConsoleKit is not working (ck-list-sessions command showing active = FALSE), you should start your window manager using the bash_profile method: Start_X_at_Login#bash_profile.

Tips and tricks

Use D-Bus for power operations

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: Since February 2013, the suspend and hibernate functions in UPower have been deprecated. Does the following still work with upower? (Discuss in Talk:Upower)
Note: Using D-Bus for suspend and hibernate requires upower.

Shut down:

dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop


dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart


dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

Hibernate (suspend to disk):

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate

This method assumes that you are given permission to shut the system down via PolicyKit. The default group for this is wheel. To change this, edit /etc/polkit-1/localauthority.conf.d/50-localauthority.conf as root.


Running several applications from ~/.xinitrc

If several applications are to be executed from ~/.xinitrc, not all of these will have ConsoleKit environment variables set. In the following example, only children of Compiz will be able to properly use ConsoleKit, but children of xterm will not.

xterm &
exec ck-launch-session compiz ccp

Typically, this can be an issue when for example using Compiz standalone and some other application launchers, (gnome-do, kupfer, gmrun, xbindkeys, etc.) since children of the application launcher will not be able to use ConsoleKit. A dirty workaround is to have the entire session started by a second script, e.g. ~/.xstart. Do not forget dbus-launch, it is likely that you will need it too:

exec ck-launch-session dbus-launch ~/.xstart
xterm &
thunar &
compiz ccp

Do not forget to make ~/.xstart executable:

$ chmod +x ~/.xstart

To see whether everything is started correctly:

$ ck-list-sessions

It should show at least one session like this one:

       unix-user = '1000'
       realname = 'Your Name'
       seat = 'Seat1'
       session-type = 
       active = TRUE
       x11-display = ':0'
       x11-display-device = '/dev/tty2'
       display-device = '/dev/tty1'
       remote-host-name = 
       is-local = TRUE
       on-since = '2011-11-16T12:01:50.104764Z'
       login-session-id = '7'

Consolekit blocks active TTY

Configure init to start ConsoleKit on an unused TTY, for example:

/usr/bin/openvt -c 63 -f -- /usr/sbin/console-kit-daemon --no-daemon &

See [4] for details.

Inactive session when launching X on same TTY

Specify the keeptty flag to startx or xinit [5], for example:

startx -- -keeptty

See also Xorg#Broken redirection.

Replacing ConsoleKit with systemd-logind

Note: systemd-logind requires booting with systemd to be functional.

Remove references to ck-launch-session from ~/.xinitrc.

See Session to check the status of your user session.

See also