From f419cd2fdd86ccacfaba1eef4d0e937fb8999bf3169c14fd80f171d86a8a639b Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Wed, 4 Aug 2021 20:28:26 +0000 Subject: [PATCH] Accepting request 909721 from Base:System - Avoid the error message when udev is updated due to udev being already active when the sockets are started again (bsc#1188291) OBS-URL: https://build.opensuse.org/request/show/909721 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=334 --- systemd-mini.changes | 6 ++++++ systemd-mini.spec | 26 +++++++++++++++----------- systemd.changes | 6 ++++++ systemd.spec | 26 +++++++++++++++----------- 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/systemd-mini.changes b/systemd-mini.changes index 6a0a7640..25dbc3d6 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jul 29 13:12:48 UTC 2021 - Franck Bui + +- Avoid the error message when udev is updated due to udev being + already active when the sockets are started again (bsc#1188291) + ------------------------------------------------------------------- Mon Jul 26 10:54:10 UTC 2021 - Franck Bui diff --git a/systemd-mini.spec b/systemd-mini.spec index 6f2afebc..0f05b170 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -974,17 +974,21 @@ rm -f /etc/udev/rules.d/{20,55,65}-cdrom.rules %postun -n udev%{?mini} %regenerate_initrd_post -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 + +# The order of the units being restarted is important here because there's currently no +# way to queue multiple jobs into a single transaction atomically. Therefore systemctl +# will create 3 restart jobs that can be handled by PID1 separately and if the jobs for +# the sockets are being handled first then starting them again will fail as the service +# is still active hence the sockets held by udevd. However if the restart job for udevd +# is handled first, there should be enough time to queue the socket jobs before the stop +# job for udevd is processed. Hence PID1 will automatically sort the restart jobs +# correctly by stopping the service then the sockets and then by starting the sockets and +# the unit. +# +# Note that when systemd-udevd is restarted, there will always be a short time +# frame where no socket will be listening to the events sent by the kernel, no +# matter if the socket unit is restarted in first or not. +%service_del_postun_with_restart systemd-udevd.service systemd-udevd-{control,kernel}.socket %posttrans -n udev%{?mini} %regenerate_initrd_posttrans diff --git a/systemd.changes b/systemd.changes index 6a0a7640..25dbc3d6 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jul 29 13:12:48 UTC 2021 - Franck Bui + +- Avoid the error message when udev is updated due to udev being + already active when the sockets are started again (bsc#1188291) + ------------------------------------------------------------------- Mon Jul 26 10:54:10 UTC 2021 - Franck Bui diff --git a/systemd.spec b/systemd.spec index f20d2bcf..f55e9088 100644 --- a/systemd.spec +++ b/systemd.spec @@ -972,17 +972,21 @@ rm -f /etc/udev/rules.d/{20,55,65}-cdrom.rules %postun -n udev%{?mini} %regenerate_initrd_post -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 + +# The order of the units being restarted is important here because there's currently no +# way to queue multiple jobs into a single transaction atomically. Therefore systemctl +# will create 3 restart jobs that can be handled by PID1 separately and if the jobs for +# the sockets are being handled first then starting them again will fail as the service +# is still active hence the sockets held by udevd. However if the restart job for udevd +# is handled first, there should be enough time to queue the socket jobs before the stop +# job for udevd is processed. Hence PID1 will automatically sort the restart jobs +# correctly by stopping the service then the sockets and then by starting the sockets and +# the unit. +# +# Note that when systemd-udevd is restarted, there will always be a short time +# frame where no socket will be listening to the events sent by the kernel, no +# matter if the socket unit is restarted in first or not. +%service_del_postun_with_restart systemd-udevd.service systemd-udevd-{control,kernel}.socket %posttrans -n udev%{?mini} %regenerate_initrd_posttrans