From b7c785ac2b64af59554dacb4ced4db3d2479bca08fa53ff8a42d103166d82653 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Thu, 11 Mar 2021 09:53:07 +0000 Subject: [PATCH] - Make sure the udev socket units are reloaded during udev package updates OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1139 --- systemd-mini.changes | 5 +++++ systemd-mini.spec | 17 +++++++++++------ systemd.changes | 5 +++++ systemd.spec | 17 +++++++++++------ 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/systemd-mini.changes b/systemd-mini.changes index 57800dc1..a1a83bfe 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Mar 11 09:51:53 UTC 2021 - Franck Bui + +- Make sure the udev socket units are reloaded during udev package updates + ------------------------------------------------------------------- Wed Mar 10 09:10:03 UTC 2021 - Franck Bui diff --git a/systemd-mini.spec b/systemd-mini.spec index 77bd8f50..f99bb053 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -903,12 +903,17 @@ rm -f /etc/udev/rules.d/{20,55,65}-cdrom.rules %postun -n udev%{?mini} %regenerate_initrd_post -# Restarting udevd sockets means also stopping the daemon. But we -# don't want the sockets and the daemon to be inactive at the same -# time because we might loose new events sent by the kernel during the -# package update otherwise. Hence we accept the fact that the socket -# properties might not be updated. They are unlikely changed anyway. -%systemd_postun_with_restart systemd-udevd.service +systemctl daemon-reload || : +# On package update, restarting the socket units will probably fail as +# udevd is most likely running. Therefore systemctl will refuse to +# start them again once stopped. It's not an issue since we are mostly +# interested to make PID1 use the updated unit files once the socket +# units wil be started again. And that will happen when systemd-udevd +# itself will be restarted. +if [ $1 -ge 1 ]; then + systemctl try-restart systemd-udevd-{control,kernel}.socket 2>/dev/null || : + systemctl try-restart systemd-udevd.service || : +fi %posttrans -n udev%{?mini} %regenerate_initrd_posttrans diff --git a/systemd.changes b/systemd.changes index 57800dc1..a1a83bfe 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Mar 11 09:51:53 UTC 2021 - Franck Bui + +- Make sure the udev socket units are reloaded during udev package updates + ------------------------------------------------------------------- Wed Mar 10 09:10:03 UTC 2021 - Franck Bui diff --git a/systemd.spec b/systemd.spec index 41bd4223..0ce09c2c 100644 --- a/systemd.spec +++ b/systemd.spec @@ -901,12 +901,17 @@ rm -f /etc/udev/rules.d/{20,55,65}-cdrom.rules %postun -n udev%{?mini} %regenerate_initrd_post -# Restarting udevd sockets means also stopping the daemon. But we -# don't want the sockets and the daemon to be inactive at the same -# time because we might loose new events sent by the kernel during the -# package update otherwise. Hence we accept the fact that the socket -# properties might not be updated. They are unlikely changed anyway. -%systemd_postun_with_restart systemd-udevd.service +systemctl daemon-reload || : +# On package update, restarting the socket units will probably fail as +# udevd is most likely running. Therefore systemctl will refuse to +# start them again once stopped. It's not an issue since we are mostly +# interested to make PID1 use the updated unit files once the socket +# units wil be started again. And that will happen when systemd-udevd +# itself will be restarted. +if [ $1 -ge 1 ]; then + systemctl try-restart systemd-udevd-{control,kernel}.socket 2>/dev/null || : + systemctl try-restart systemd-udevd.service || : +fi %posttrans -n udev%{?mini} %regenerate_initrd_posttrans