From 638de11012ce19f257d7aef318aae9eec311ce498ec49174ccac5fa9e47bdd06 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Mon, 24 Jun 2024 14:45:08 +0000 Subject: [PATCH] - Don't automatically clean unmodified config files up (bsc#1226415) OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1535 --- files.experimental | 2 ++ files.journal-remote | 3 +++ files.network | 2 ++ files.systemd | 5 +++++ files.udev | 5 +++++ fixlet-systemd-post.sh | 25 +++++++++++++++++++++++++ systemd.changes | 10 ++++++++++ systemd.spec | 36 ------------------------------------ 8 files changed, 52 insertions(+), 36 deletions(-) diff --git a/files.experimental b/files.experimental index f9116e29..ee0675ca 100644 --- a/files.experimental +++ b/files.experimental @@ -9,6 +9,8 @@ %if %{with sd_boot} %dir %{_unitdir}/initrd.target.wants %endif +# Main config files have been replaced in favor of drop-ins. +%ghost %{_sysconfdir}/systemd/oomd.conf %{_bindir}/oomctl %{_bindir}/systemd-vmspawn %if %{with sd_boot} diff --git a/files.journal-remote b/files.journal-remote index 1acfe411..27597c7b 100644 --- a/files.journal-remote +++ b/files.journal-remote @@ -4,6 +4,9 @@ %dir %{_sysconfdir}/systemd/journal-remote.conf.d %dir %{_sysconfdir}/systemd/journal-upload.conf.d %ghost %dir %{_localstatedir}/log/journal/remote +# Main config files have been replaced in favor of drop-ins. +%ghost %{_sysconfdir}/systemd/journal-remote.conf +%ghost %{_sysconfdir}/systemd/journal-upload.conf %{_datadir}/systemd/gatewayd %{_datadir}/systemd/gatewayd/browse.html %{_mandir}/man5/journal-remote.conf.5.gz diff --git a/files.network b/files.network index c1b17155..2dd59e9a 100644 --- a/files.network +++ b/files.network @@ -5,6 +5,8 @@ %dir %{_sysconfdir}/systemd/network %dir %{_sysconfdir}/systemd/networkd.conf.d %dir %{_systemd_util_dir}/network +# Main config files have been replaced in favor of drop-ins. +%ghost %{_sysconfdir}/systemd/networkd.conf %{_bindir}/networkctl %{_datadir}/bash-completion/completions/networkctl %{_datadir}/dbus-1/interfaces/org.freedesktop.network1.DHCPServer.xml diff --git a/files.systemd b/files.systemd index 45a34a3a..477251f6 100644 --- a/files.systemd +++ b/files.systemd @@ -91,6 +91,11 @@ %ghost %config(noreplace) %{_sysconfdir}/machine-info %ghost %dir %attr(2755, root, systemd-journal) %{_localstatedir}/log/journal %ghost %{_localstatedir}/lib/systemd/catalog/database +# Main config files have been replaced in favor of drop-ins. +%ghost %{_sysconfdir}/systemd/journald.conf +%ghost %{_sysconfdir}/systemd/logind.conf +%ghost %{_sysconfdir}/systemd/system.conf +%ghost %{_sysconfdir}/systemd/user.conf %license LICENSE.GPL2 %license LICENSE.LGPL2.1 %{_bindir}/busctl diff --git a/files.udev b/files.udev index 401584d2..09ba6c98 100644 --- a/files.udev +++ b/files.udev @@ -40,6 +40,11 @@ %ghost %attr(644, root, root) %{_prefix}/lib/udev/compat-symlink-generation %ghost %config(noreplace) %{_sysconfdir}/vconsole.conf %ghost %{_localstatedir}/lib/systemd/backlight +# Main config files have been replaced in favor of drop-ins. +%ghost %{_sysconfdir}/systemd/pstore.conf +%ghost %{_sysconfdir}/systemd/sleep.conf +%ghost %{_sysconfdir}/systemd/timesyncd.conf +%ghost %{_sysconfdir}/udev/iocost.conf %{_bindir}/bootctl %if %{without bootstrap} %{_bindir}/kernel-install diff --git a/fixlet-systemd-post.sh b/fixlet-systemd-post.sh index 1ddb654d..e32bf8fe 100644 --- a/fixlet-systemd-post.sh +++ b/fixlet-systemd-post.sh @@ -276,6 +276,31 @@ drop_after_local_support() { fi } +# +# We have stopped shipping the main config files in /etc but we don't try to +# clean them up automatically as it can have unexepected side effects +# (bsc#1226415). Instead we simply suggest users to convert them (if they exist) +# into drop-ins. +# +# Note: run at each package update +# +check_config_files () { + config_files=(systemd/journald.conf systemd/logind.conf systemd/system.conf systemd/user.conf + systemd/pstore.conf systemd/sleep.conf systemd/timesyncd.conf systemd/coredump.conf + systemd/journal-remote.conf systemd/journal-upload.conf systemd/networkd.conf + systemd/resolved.conf systemd/oomd.conf udev/iocost.conf) + + for f in ${config_files[*]}; do + [ -e /etc/$f ] || continue + + cat >&2 < + +- Don't automatically clean unmodified config files up (bsc#1226415) + + Relying on the presence of .rpmsave for detecting unmodified main config files + couldn't work as it created a time window in which some of the systemd + services were restarted with no config file. That had the bad side effect to + restart them with the upstream defaults, ignoring any user's customization. + ------------------------------------------------------------------- Tue Jun 18 13:20:26 UTC 2024 - Franck Bui diff --git a/systemd.spec b/systemd.spec index bd584826..3cbda4ac 100644 --- a/systemd.spec +++ b/systemd.spec @@ -80,20 +80,6 @@ # value is independent of the build flavor. %bcond_without filetriggers -# We stopped shipping main config files in /etc but we have to restore any -# config files that might have been backed up by rpm during the migration of the -# main config files from /etc to /usr. This needs to be done in %%posttrans -# because the .rpmsave files are created when the *old* package version is -# removed. This is not needed by ALP and will be dropped from Factory near the -# end of 2024. -%define restore_rpmsave() \ -if [ -e %{_sysconfdir}/%{1}.rpmsave ] && [ ! -e %{_sysconfdir}/%{1} ]; then \ - echo >&2 "Restoring %{_sysconfdir}/%1. Please consider moving your customizations in a drop-in instead." \ - echo >&2 "For more details, visit https://en.opensuse.org/Systemd#Configuration." \ - mv -v %{_sysconfdir}/%{1}.rpmsave %{_sysconfdir}/%{1} || : \ -fi \ -%{nil} - Name: systemd%{?mini} URL: http://www.freedesktop.org/wiki/Software/systemd Version: %systemd_version @@ -1131,13 +1117,6 @@ journalctl --update-catalog || : %systemd_postun_with_restart systemd-timedated.service %systemd_postun_with_restart systemd-userdbd.service -%posttrans -%restore_rpmsave systemd/coredump.conf -%restore_rpmsave systemd/journald.conf -%restore_rpmsave systemd/logind.conf -%restore_rpmsave systemd/system.conf -%restore_rpmsave systemd/user.conf - %pre -n udev%{?mini} # Units listed below can be enabled at installation accoding to their preset # setting. @@ -1192,10 +1171,6 @@ fi %posttrans -n udev%{?mini} %regenerate_initrd_posttrans -%restore_rpmsave systemd/pstore.conf -%restore_rpmsave systemd/sleep.conf -%restore_rpmsave systemd/timesyncd.conf -%restore_rpmsave udev/iocost.conf %ldconfig_scriptlets -n libsystemd0%{?mini} %ldconfig_scriptlets -n libudev%{?mini}1 @@ -1246,10 +1221,6 @@ fi %systemd_postun_with_restart systemd-journal-gatewayd.service %systemd_postun_with_restart systemd-journal-remote.service %systemd_postun_with_restart systemd-journal-upload.service - -%posttrans journal-remote -%restore_rpmsave systemd/journal-remote.conf -%restore_rpmsave systemd/journal-upload.conf %endif %if %{with networkd} || %{with resolved} @@ -1298,10 +1269,6 @@ fi %ldconfig %systemd_postun systemd-resolved.service %endif - -%posttrans network -%restore_rpmsave systemd/networkd.conf -%restore_rpmsave systemd/resolved.conf %endif %if %{with homed} @@ -1360,9 +1327,6 @@ fi %postun experimental %systemd_postun systemd-homed.service %systemd_postun systemd-oomd.service systemd-oomd.socket - -%posttrans experimental -%restore_rpmsave systemd/oomd.conf %endif # File trigger definitions