From: Zbigniew Jędrzejewski-Szmek Date: Mon, 1 Apr 2019 11:57:24 +0000 (+0200) Subject: meson: stop creating enablement symlinks in /etc during installation X-Git-Tag: v242~77^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01d2041e41f4886a6dff16a53a950ae8d5b66bc7;p=platform%2Fupstream%2Fsystemd.git meson: stop creating enablement symlinks in /etc during installation This patch was initially prompted by a report on a Fedora update [1], that the upgrade causes systemd-resolved.service and systemd-networkd.service to be re-enabled. We generally want to preserve the enablement of all services during upgrades, so a reset like this is not expected. Both services declare two symlinks in their [Install] sections, for their dbus names and for multi-user.target.wants/. It turns out that both services were only partially enabled, because their dbus unit symlinks /etc/systemd/system/dbus-org.freedesktop.{resolve1,network1}.service were created, by the symlinks in /etc/systemd/system/multi-user.target.wants/ were not. This means that the units could be activated by dbus, but not in usual fashion using systemctl start. Our tools make it rather hard to figure out when something like this happens, and it is definitely an area for improvement on its own. The symlink in .wants/ was filtered out by during packaging, but the dbus symlink was left in (I assume by mistake). Let's simplify things by not creating the symlinks statically during 'ninja install'. This means that the units shipped by systemd have to be enabled in the usual fashion, which in turns means that [Install] section and presets become the "single source of truth" and we don't have two sets of conflicting configuration. Let's consider a few cases: - developer: a developer installs systemd from git on a running system, and they don't want the installation to reset enablement of anything. So this change is either positive for them, or has no effect (if they have everything at defaults). - package creation: we want to create symlinks using 'preset-all' and 'preset' on upgraded packages, we don't want to have any static symlinks. This change will remove the need to filter out symlinks in packaging and of course fix the original report. - installation of systemd from scratch: this change means that without 'preset-all' the system will not be functional. This case could be affected negatively by this change, but I think it's enough of a corner case to accept this. In practice I expect people to build a package, not installl directly into the file system, so this might not even matter in practice. Creating those symlinks was probably the right thing in the beginning, but nowadays the preset system is very well established and people expect it to be honoured. Ignoring the presets and doing static configuration is not welcome anymore. Note: during package installation, either 'preset-all' or 'preset getty@.service machines.target remote-cryptsetup.target remote-fs.target systemd-networkd.service systemd-resolved.service systemd-networkd-wait-online.service systemd-timesyncd.service' should be called. [1] https://bodhi.fedoraproject.org/updates/FEDORA-2019-616045ca76 --- diff --git a/units/meson.build b/units/meson.build index be5d70d..a53632c 100644 --- a/units/meson.build +++ b/units/meson.build @@ -34,8 +34,7 @@ units = [ ['local-fs-pre.target', ''], ['local-fs.target', ''], ['machine.slice', 'ENABLE_MACHINED'], - ['machines.target', 'ENABLE_MACHINED', - join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')], + ['machines.target', 'ENABLE_MACHINED'], ['multi-user.target', '', 'runlevel2.target runlevel3.target runlevel4.target'], ['network-online.target', ''], @@ -52,11 +51,9 @@ units = [ ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], ['reboot.target', '', 'runlevel6.target ctrl-alt-del.target'], - ['remote-cryptsetup.target', 'HAVE_LIBCRYPTSETUP', - join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')], + ['remote-cryptsetup.target', 'HAVE_LIBCRYPTSETUP'], ['remote-fs-pre.target', ''], - ['remote-fs.target', '', - join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')], + ['remote-fs.target', ''], ['rescue.target', '', 'runlevel1.target'], ['rpcbind.target', ''], @@ -97,8 +94,7 @@ units = [ 'sockets.target.wants/'], ['systemd-journald.socket', '', 'sockets.target.wants/'], - ['systemd-networkd.socket', 'ENABLE_NETWORKD', - join_paths(pkgsysconfdir, 'system/sockets.target.wants/')], + ['systemd-networkd.socket', 'ENABLE_NETWORKD'], ['systemd-poweroff.service', ''], ['systemd-reboot.service', ''], ['systemd-rfkill.socket', 'ENABLE_RFKILL'], @@ -175,11 +171,8 @@ in_units = [ 'dbus-org.freedesktop.machine1.service'], ['systemd-modules-load.service', 'HAVE_KMOD', 'sysinit.target.wants/'], - ['systemd-networkd.service', 'ENABLE_NETWORKD', - join_paths(pkgsysconfdir, 'system/dbus-org.freedesktop.network1.service') + ' ' + - join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')], - ['systemd-networkd-wait-online.service', 'ENABLE_NETWORKD', - join_paths(pkgsysconfdir, 'system/network-online.target.wants/')], + ['systemd-networkd.service', 'ENABLE_NETWORKD'], + ['systemd-networkd-wait-online.service', 'ENABLE_NETWORKD'], ['systemd-nspawn@.service', ''], ['systemd-portabled.service', 'ENABLE_PORTABLED', 'dbus-org.freedesktop.portable1.service'], @@ -187,9 +180,7 @@ in_units = [ ['systemd-random-seed.service', 'ENABLE_RANDOMSEED', 'sysinit.target.wants/'], ['systemd-remount-fs.service', ''], - ['systemd-resolved.service', 'ENABLE_RESOLVE', - join_paths(pkgsysconfdir, 'system/dbus-org.freedesktop.resolve1.service') + ' ' + - join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')], + ['systemd-resolved.service', 'ENABLE_RESOLVE'], ['systemd-rfkill.service', 'ENABLE_RFKILL'], ['systemd-suspend.service', ''], ['systemd-sysctl.service', '', @@ -198,8 +189,7 @@ in_units = [ 'sysinit.target.wants/'], ['systemd-timedated.service', 'ENABLE_TIMEDATED', 'dbus-org.freedesktop.timedate1.service'], - ['systemd-timesyncd.service', 'ENABLE_TIMESYNCD', - join_paths(pkgsysconfdir, 'system/sysinit.target.wants/')], + ['systemd-timesyncd.service', 'ENABLE_TIMESYNCD'], ['systemd-time-wait-sync.service', 'ENABLE_TIMESYNCD'], ['systemd-tmpfiles-clean.service', 'ENABLE_TMPFILES'], ['systemd-tmpfiles-setup-dev.service', 'ENABLE_TMPFILES', @@ -229,8 +219,7 @@ m4_units = [ ['console-getty.service', ''], ['container-getty@.service', ''], ['getty@.service', '', - 'autovt@.service ' + - join_paths(pkgsysconfdir, 'system/getty.target.wants/getty@tty1.service')], + 'autovt@.service '], ['serial-getty@.service', ''], ]