mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 02:03:37 +08:00
units/{user,capsule}@.service: issue daemon-reexec when notify-reloading
Closes #28367 (but not really in the exact form, see below) We have the problem of restarting all user manager instances after upgrade. Current approaches involve systemctl kill with SIGRTMIN+25, which is async and feels rather ugly [1][2]; or systemctl --machine=user@ --user, which requires entering each user session. Neither is particularly elegant. Instead, let's just signal daemon-reexec when user@.service is reloaded from system manager. Our long goal of dropping daemon-reload in favor of reexec (see TODO) is unlikely to happen due to user dbus restrictions, but here the synchronization is done via READY=1. [1] https://gitlab.archlinux.org/archlinux/packaging/packages/systemd/-/blob/main/systemd.install?ref_type=heads#L37 [2] https://salsa.debian.org/systemd-team/systemd/-/blob/debian/master/debian/systemd.postinst#L24 #28367 would not really work for us now I come to think about it, because all processes will be reparented to pid1 as soon as original user manager process exits. This alternative approach seems good enough for our use case.
This commit is contained in:
parent
155098a702
commit
a375e14519
@ -23,6 +23,10 @@ StateDirectory=capsules/%i
|
||||
RuntimeDirectory=capsules/%i
|
||||
LogExtraFields=CAPSULE=%i
|
||||
Slice=capsule.slice
|
||||
# Reexecute the manager on service reload, instead of reloading.
|
||||
# This provides a synchronous method for restarting all user manager
|
||||
# instances after upgrade.
|
||||
ReloadSignal=RTMIN+25
|
||||
KillMode=mixed
|
||||
Delegate=pids memory cpu
|
||||
DelegateSubgroup=init.scope
|
||||
|
@ -20,6 +20,10 @@ PAMName=systemd-user
|
||||
Type=notify-reload
|
||||
ExecStart={{LIBEXECDIR}}/systemd --user
|
||||
Slice=user-%i.slice
|
||||
# Reexecute the manager on service reload, instead of reloading.
|
||||
# This provides a synchronous method for restarting all user manager
|
||||
# instances after upgrade.
|
||||
ReloadSignal=RTMIN+25
|
||||
KillMode=mixed
|
||||
Delegate=pids memory cpu
|
||||
DelegateSubgroup=init.scope
|
||||
|
Loading…
Reference in New Issue
Block a user