Announce: Moving session startup from upstart to systemd

Martin Pitt martin.pitt at ubuntu.com
Sun Jul 31 15:09:10 UTC 2016


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.

Landing
=======
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 3.18.1.2-1ubuntu5 [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
on).

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
landed.

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:

  http://bazaar.launchpad.net/~ubuntu-desktop/gnome-session/ubuntu/revision/343#debian/patches/50_ubuntu_sessions.patch
  (this commit has other changes, just the hunk in this file)

  http://bazaar.launchpad.net/~xubuntu-dev/xubuntu-default-settings/trunk/revision/621

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

with

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

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

References
==========
[1] https://blueprints.launchpad.net/ubuntu/+spec/convergence-y-replace-upstart
[2] https://launchpad.net/ubuntu/+source/gnome-session/3.18.1.2-1ubuntu5
[3] https://launchpad.net/ubuntu/+source/xubuntu-default-settings/16.10.1
[4] https://requests.ci-train.ubuntu.com/#/ticket/1710
[5] https://launchpad.net/~ubuntu-desktop/+archive/ubuntu/systemd-session
[6] https://bugs.launchpad.net/ubuntu/+bugs?field.tag=systemd-session
[7] https://lists.debian.org/debian-devel/2016/07/msg00484.html

Thanks,

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20160731/fbced699/attachment.pgp>


More information about the ubuntu-devel mailing list