mirror of
https://github.com/systemd/systemd
synced 2025-10-06 00:13:24 +02:00
units: kill only udev services and keep udev sockets on switching root
This also makes initrd-cleanup.service explicitly start
initrd-switch-root.service with replace-irreversibly mode, to avoid
systemd-udevd.service being triggered by kernel events and the start
job of initrd-switch-root.service being cancelled.
Follow-ups for 676fb42aae
.
Addresses https://github.com/systemd/systemd/pull/37374#issuecomment-2875990471.
This commit is contained in:
committed by
Luca Boccassi
parent
13cb664181
commit
d766c75acd
@@ -18,3 +18,4 @@ After=initrd-root-fs.target initrd-fs.target initrd.target
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=systemctl --no-block isolate initrd-switch-root.target
|
||||
ExecStart=systemctl --no-block --job-mode=replace-irreversibly start initrd-switch-root.service
|
||||
|
@@ -11,8 +11,8 @@
|
||||
Description=Cleanup udev Database
|
||||
DefaultDependencies=no
|
||||
AssertPathExists=/etc/initrd-release
|
||||
Conflicts=systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket systemd-udevd-varlink.socket systemd-udev-trigger.service systemd-udev-settle.service
|
||||
After=systemd-udevd.service systemd-udevd-control.socket systemd-udevd-kernel.socket systemd-udevd-varlink.socket systemd-udev-trigger.service systemd-udev-settle.service
|
||||
Conflicts=systemd-udevd.service systemd-udev-trigger.service systemd-udev-settle.service
|
||||
After=systemd-udevd.service systemd-udev-trigger.service systemd-udev-settle.service
|
||||
Before=initrd-switch-root.target
|
||||
|
||||
[Service]
|
||||
|
@@ -24,6 +24,14 @@ ConditionPathIsReadWrite=/sys
|
||||
Before=soft-reboot.target systemd-soft-reboot.service
|
||||
Conflicts=soft-reboot.target
|
||||
|
||||
# To avoid this service being triggered by a relevant socket unit during
|
||||
# switching root, which easily happens due to kernel events.
|
||||
# Note, unlike soft-reboot (and any other shutting down processes),
|
||||
# initrd-switching-root.service is started after initrd-switch-root.target.
|
||||
# Hence, we need to also add the service to Conflicts=.
|
||||
Before=initrd-switch-root.target initrd-switch-root.service
|
||||
Conflicts=initrd-switch-root.target initrd-switch-root.service
|
||||
|
||||
[Service]
|
||||
CapabilityBoundingSet=~CAP_SYS_TIME CAP_WAKE_ALARM
|
||||
Delegate=
|
||||
|
Reference in New Issue
Block a user