Migrate from ConsoleKit to logind

Registered by James Hunt

Ubuntu currently uses ConsoleKit for tracking logged-in users. However, ConsoleKit is no longer maintained.

Since logind is now packaged in the archive and can run standalone, now is a good time to investigate how we might migrate to it.

= References =

* http://www.freedesktop.org/wiki/Software/ConsoleKit
* http://www.freedesktop.org/wiki/Software/systemd/logind
* https://blueprints.launchpad.net/ubuntu/+spec/foundations-r-session-management

Blueprint information

Status:
Complete
Approver:
Steve Langasek
Priority:
High
Drafter:
James Hunt
Direction:
Approved
Assignee:
None
Definition:
Approved
Series goal:
Accepted for saucy
Implementation:
Implemented
Milestone target:
milestone icon ubuntu-13.05
Started by
Sebastien Bacher
Completed by
Sebastien Bacher

Whiteboard

Ubuntu currently uses ConsoleKit for tracking logged-in users. However, ConsoleKit is no longer maintained.
 Since logind is now packaged in the archive and can run standalone, now is a good time to investigate how we might migrate to it.
 = References =

     http://www.freedesktop.org/wiki/Software/ConsoleKit

     http://www.freedesktop.org/wiki/Software/systemd/logind

     https://blueprints.launchpad.net/ubuntu/+spec/foundations-r-session-management

  - no requirement to actually use systemd, just pulls in pam plugin. logind has a dependency on systemd cgroups model
 running logind separately happens to work, but is not really supported upstream

 Possible Bugs/Issues:
 - even if KillUserProcesses=no is specified in logind.conf, processes are still ended?
 - the systemd's cgroup usage is different from the model used in other pieces of our infrastructure
 Benefits from ck -> logind:
 - other projects are moving to logind
 - consolekit is unmaintained, logind is maintained
 - can drop $XDG_SESSION_COOKIE
 - ability to utilize newer udev version with acl support
 Our udev is old because we don't use the systemd's merged version
 Need to tighten package dependencies between new udev and logind even if these are separate logically (not so much in practice/at runtime)

Add comments below for things that do / do not have logind support, and whether logind support is needed or not.

== Transition ==
CK → logind: http://pad.ubuntu.com/saucy-logind-transition
libudev0 → libudev1: done in raring
runtime check for logind vs. systemd: http://people.canonical.com/~pitti/tmp/cgroup-sd_booted.txt

 udev/systemd update blocked by:
 - logind (taking over udev-acl)
 - libudev soname change (not that much of binary ABI change, but some less used functions were dropped)
 - look at the udev patches we currently have that didn't get upstreamed and might need to be refreshed

 Convergence issue:
 the ubuntu touch image is using eventd and not udev, need to figure what we want to do once we convergence (they are doing it because they started from android)
 -> it probably fine to run udev is the container (stgraber is doing that in lxc containers and it works fine)
 lightdm should just be working with logind (through the pam stack)

pitti, 2013-03-07:
- Created PPA for staging updates: https://launchpad.net/~ubuntu-core-dev/+archive/logind
- Fixed logind packages to create /sys/fs/cgroup tmpfs mount on demand, and ship the missing udev rules, so that automatic ACLs work. NOTE: This is better done in /lib/init/fstab, to avoid race conditions; if we don't do it there, we need to adjust logind's and udev's udev rules.
- Building two polkits (one with CK, one with logind) is rather messy, but we do not actually need this: We can just switch polkit to use logind and add a logind dependency. We can just run CK and logind side by side until everything has been converted; they are tracking the same state, and various clients can ask one or the other.
- logind depends on systemd to put user's sessions and processes into cgroups; systemd 44-10ubuntu2 mounts the necessary cgroup fs for this

pitti, 2013-03-10:
- systemd/logind 44 packages with above fixes are in raring
- version 198 packages are in PPA; these don't build systemd, systemd-sysv, and udev yet, but do ship the soname bump (libudev1) instead. This means we'll need some 50 rebuilds.
- PPA merges logind into systemd-services again, to avoid over-splitting and fewer delta to Debian. Martin will review our changes with Debian tomorrow (already pre-discussed last week)

(?)

Work Items

Work items:
[xnox] Archive grep for ConsoleKit DBus API thanks jdstrand http://people.canonical.com/~jamie/archive-grep/xnox_consolekit.log : DONE
[xnox] check which of above have / have not logind (thanks jdstrand/pitti for archive grep) http://people.canonical.com/~jamie/archive-grep/pitti-fs_cgroup_systemd_or_sd_booted.log : DONE
[laney] Add lightdm support for user switching with logind: DONE
[pitti] Provide current (v198) systemd and logind's client stack packages in a PPA: DONE
[pitti] check whether we can build policykit to support both CK and logind, with two separate conflicting binaries: DONE
[pitti] provide logind enabled polkit (in PPA): DONE
[pitti] setup proper dependencies and update seeds for PAM modules: DONE
[seb128] systemd MIR (#1152187): DONE
[pitti] logind FFE (#1153224, declined): DONE
[pitti] talk to Lennart about fixing sd_booted() and getting an official API for "have logind" (fixed upstream): DONE
[pitti] fix sd_booted() to actually mean "systemd init", not just "logind" as it does now, after we transition the logind rdepends: DONE
[pitti] fix upstream projects calling sd_booted() which actually mean "logind": DONE
[pitti] fix packages calling sd_booted() which actually mean "logind": DONE
[pitti] fix packages with an outdated sd_booted() which talk to systemd init: DONE
[pitti] Fix lingering "state: closing" sessions in logind when not running under systemd: DONE
[pitti] fix race condition of udev-acl with logind: DONE
[pitti] backport uaccess builtin to udev, for applying ACLs with old udev: DONE
[laney] port indicator-session (lp:~laney/indicator-session/logind-port): DONE

Work items for ubuntu-13.04-month-6:
[laney] help with the lightdm port (bug #930488), in progress in lp:~laney/lightdm/logind: DONE

Work items for ubuntu-13.05:
[laney] help out with other ports: DONE

Work items for ubuntu-13.06:
[cjwatson] Check whether openssh needs to grow logind support, and add it if necessary (seems to work fine without, can just drop the CK bits): DONE

Work items for ubuntu-13.09:
[xnox] Add logind support to ubiquity-dm install-only session: DONE

Work items for ubuntu-13.11:
[pitti] Merge systemd packaging with Debian as much as possible: DONE

Dependency tree

* Blueprints in grey have been implemented.