From Fedora Project Wiki


Systemd presets for user units

Summary

System units are managed through presets since F18 and by policy, presets are carried by the fedora-release package. This policy is now extended to user units.

Owner

Current status

Detailed Description

The preset mechanism for user units was already in place, but we were missing the actual preset files, and the default was "enable *" instead of "disable *" as for system services.

Systemd will now provide a /usr/lib/systemd/user-preset/99-default-disable.preset that marks user services as disabled by default. Any user services which should be enabled will be to get an appropriate preset in /usr/lib/systemd/user-preset/90-default-user.preset or a spin-specific file. Most packages already call into the preset mechanism, but those which don't will be adjusted to do that.

This is essentially a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1468501. There is no good reason to treat user services different than system services in this regard. On the systemd side this change is very simple, but all packages that provide user units need to be reviewed to check if they are enabled after the change if appropriate.

Benefit to Fedora

User and system services are handled in the same way.

Local configuration may be used to override which services should be enabled after upgrade. In particular, "local" in this context may mean "per-spin" or "per-user".

Scope

  • Proposal owners:
    • review all packages that provide user services in Fedora and submit PRs when changes are needed
    • add a new presets file to the fedora-release package for user units [1].
    • submit a proposal to FPC to update the guidelines (essentially to say "... and the same for user services.") [2].
  • Other developers:
    • FPC: review (and accept ;)) the guidelines changes
    • other maintainers: verify that units in their packages are enabled or not as appropriate after package installation
  • Release engineering: n/a
  • Policies and guidelines: a pull request will be submitted
  • Trademark approval: N/A (not needed for this Change)

Approximate list of units:

$ dnf repoquery --whatprovides '/usr/lib/systemd/user/*' --releasever=32 -l|grep -v target|sed -r -n 's,/usr/lib/systemd/user/(.+),\1,p'

systemd-tmpfiles-setup.service              90-systemd.preset  
systemd-tmpfiles-clean.timer                90-systemd.preset  
systemd-tmpfiles-clean.service              (covered by .timer)
systemd-exit.service                        (not needed)

gnome-shell-*.*
gnome-initial-setup*.*
gsd-*.*                          (There's a bazillion of those, with a separate target for each service.
                                  The scheme is being reworked in https://gitlab.gnome.org/GNOME/gnome-session/merge_requests/34,
                                  so I'm omitting them from this list.)
gnome-session-*.service
gnome-welcome-tour.service                                            permanently-enabled

dbus.socket                                90-default-user.preset     enabled-after-installation                        
dbus-broker.service                        90-default-user.preset
dbus-daemon.service                        (not needed)

at-spi-dbus-bus.service
bamfdaemon.service
blueman-applet.service
colord-session.service
cros-garcon.service                                                   enabled-after-installation
cros-pulse-config.service                                             enabled-after-installation
ddupdate.service
dunst.service
emacs.service
enlightenment.service
ethumb.service
evolution-addressbook-factory.service
evolution-calendar-factory.service
evolution-source-registry.service
evolution-user-prompter.service
flatpak-oci-authenticator.service
flatpak-oci-authenticator.service
flatpak-portal.service
flatpak-portal.service
flatpak-session-helper.service
fleet-commander-adretriever.service                                   enabled-after-installation
gamemoded.service
glib-pacrunner.service
glib-pacrunner.service
gnome-remote-desktop.service
gnome-terminal-server.service
gnome-user-share-webdav.service
grive-changes@.service
grive-timer@.service
grub-boot-success.service                  (covered by .timer)
grub-boot-success.timer                                               permanently-enabled
gvfs-afc-volume-monitor.service
gvfs-daemon.service
gvfs-daemon.service
gvfs-goa-volume-monitor.service
gvfs-gphoto2-volume-monitor.service
gvfs-metadata.service
gvfs-metadata.service
gvfs-mtp-volume-monitor.service
gvfs-udisks2-volume-monitor.service
gvfs-udisks2-volume-monitor.service
io.podman.service
io.podman.socket
mako.service                                                          enabled-after-installation
mpDris2.service
mpris-scrobbler.service                                               enabled-after-installation
obex.service
onedrive.service
org.gnome.Evince.service
org.gnome.GPaste.Ui.service
org.gnome.GPaste.service
p11-kit-client.service
p11-kit-remote.socket                                                 enabled-after-installation
p11-kit-remote@.service
p11-kit-server.service
p11-kit-server.socket
pipewire.service                           (covered by .socket)
pipewire.socket                            90-default-user.preset     permanently-enabled
pulseaudio.service                         (covered by .socket)
pulseaudio.socket                                                     enabled-after-installation
redshift-gtk.service
redshift.service
reportd.service
rtags.service                                                         enabled-after-installation
rtags.socket                                                          enabled-after-installation
rygel.service
snapd.session-agent.service                (covered by .socket)
snapd.session-agent.socket                 90-default-user.preset     enabled-after-installation
sommelier-x@.service                                                  enabled-after-installation
sommelier@.service                                                    enabled-after-installation
squeezelite.service                                                   enabled-after-installation
syncevo-dbus-server.service
syncthing.service                                90-syncthing.preset  custom preset to be dropped, https://bugzilla.redhat.com/show_bug.cgi?id=1708297
termy-server.service                             (covered by .service)
termy-server.socket                                                   enabled-after-installation
thunar.service
tracker-extract.service
tracker-miner-fs.service
tracker-miner-rss.service
tracker-store.service
tracker-writeback.service
unity-gtk-module.service                                              permanently-enabled
vino-server.service
vncserver@.service
xdg-desktop-portal-gtk.service
xdg-desktop-portal.service
xdg-desktop-portal.service
xdg-document-portal.service
xdg-document-portal.service
xdg-permission-store.service
xdg-permission-store.service
xfce4-notifyd.service
yacreaderlibraryserver.service
zeitgeist-fts.service
zeitgeist.service

Legend:

  • a preset file is shown if it covers the unit
  • "permanently-enabled" — a symlink in /usr/lib/systemd/user/*.wants/ is installed by rpm. Most of those should be changed to an [Install] section. It seems that in most cases the unit should be disabled by default, and the permanent enablement is a mistake.
  • "enabled-after-installation" — a symlink in /etc/systemd/user/*.wants/ is created by rpm. Most of those seem to be mistaked too, we don't want them enabled by default.
  • Any unit which doesn't have "*enabled*" won't be affected by this change, since either it doesn't have the [Install] section or the package doesn't have scriptlets. So those files can be ignored.

Upgrade/compatibility impact

Should not be user visible. Some units which are are currently enabled by mistake will not be enabled anymore on new installations.

How To Test

Install a new system (or uninstall and reinstall some packages). Verify that the appropriate units are enabled for the user session.

User Experience

N/A

Dependencies

N/A

Contingency Plan

  • Contingency mechanism: Revert the changes.
  • Contingency deadline: beta freeze
  • Blocks release? No
  • Blocks product? No

Documentation

A pull request for the packaging guidelines will be submitted.

Release Notes

Not needed.