Sunday, 31 July 2016

Announce: Moving session startup from upstart to systemd

Hello Ubuntu developers!

What is this about?
As discussed at UDS [1] we are moving away from using upstart to start
graphical desktop sessions, towards systemd (and D-Bus activations in
some cases where it's appropriate). Two weeks ago Sebastien Bacher,
Iain Lane, Ted Gould, and me had three-day sprint where we converted
most services of the Ubuntu session, and before/after I was working on
the necessary infrastructure in systemd and upstart, and
converted/checked most other flavors. This is now ready to land and
get wider testing.

The main "switch" is being done in the Exec= lines of the
corresponding /usr/share/xsessions/*.desktop. Display managers use
these to show which sessions are available and to know how to start
them. This happend in ubuntu-desktop [2] and
xubuntu-default-settings 16.10.1 [3], which just landed in Yakkety.
Other desktops like Kubuntu, Lubuntu etc. don't use upstart and thus
have not been converted; if you are interested in this, please talk to
me, or Sebastien/Iain (as I will be on holidays from next Wednesday

With this, about half of your session will then be driven by systemd
units, check "systemctl --user status" and "initctl list|grep run"
before and after. unity itself, hud, and indicators are still run by
upstart -- their conversion is being prepared in CI train [4]. If you
want, you can get systemd units for those by enabling the staging PPA
[5] and installing the "systemd-graphical-session" package -- this
package and the PPA will become empty over time as things are being

Note that some upstart jobs like "dbus" or "gnome-session" will still
run -- their overrides change the program to be run to "sleep
infinity" so that they become stub jobs. This is necessary as we still
want their dependencies to get started until the transition gets
finished, i. e. all reverse upstart job dependencies of those stubs
get converted.

Next steps
We now need to provide systemd units for the remaining jobs. On
desktop (all flavors) it's pretty much complete with the PPA, the main
missing piece is to convert the unity greeter session. This is also
the only actual reverse dependency of "upstart" -- in a VM with the
PPA you can force-purge upstart and run a desktop entirely without
it. Indicators will be missing in the Unity greeter session in lightdm,
but they are not essential.

The bulk of the remaining work is to convert the Touch packages and
ubuntu-app-launch. There are also some workarounds in place for
missing functionality in systemd. All remaining work is being tracked
in the blueprint [1] and in bugs tagged with "systemd-session" [6].

D-Bus user session
The upstart → systemd transition also depends on/contains a separate
transition from a session-centric to user-centric D-Bus daemon and
services. A lot of D-Bus services like pulseaudio, gvfs, SSH agents,
keyring daemon etc. are useful to other parallel (non-graphical, i. e.
VT or ssh) logins of the same user, so these will now continue to live
until the last session of a particular user gets stopped. See e. g.
[7] for some details. This is being achieved by installing the
"dbus-user-session" package, on which the converted
ubuntu-session/xubuntu-default-settings packages now depend. This
also caused some fallout mostly in policykit, gnome-keyring, and
AppArmor profiles, which all got fixed in Yakkety. There are no other
known issues with those at the moment, so if you notice anything else
please file a bug about it and tag it with "systemd-session".

Contingency plan
If this causes trouble, this can be switched back by reverting the
Exec= lines, in these two commits:
(this commit has other changes, just the hunk in this file)

As an alternative, unless you removed upstart, you temporarily switch
back to the upstart jobs by editing /etc/X11/Xsession.d/00upstart and
replacing the line

if [ "${1#*.target}" != "$1" ]; then


if false && [ "${1#*.target}" != "$1" ]; then

(i. e. effectively disable the "if").



Martin Pitt |
Ubuntu Developer ( | Debian Developer (