summaryrefslogtreecommitdiffstats
path: root/units
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-10-10 21:32:17 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-10-11 10:36:08 +0200
commita375e145190482e8a2f0971bffb332e31211622f (patch)
tree6b6fb5f964cc7072008df3a3035c4a6a163f3840 /units
parentcore/manager-serialize: drop serialization for Manager.ready_sent (diff)
downloadsystemd-a375e145190482e8a2f0971bffb332e31211622f.tar.xz
systemd-a375e145190482e8a2f0971bffb332e31211622f.zip
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.
Diffstat (limited to 'units')
-rw-r--r--units/capsule@.service.in4
-rw-r--r--units/user@.service.in4
2 files changed, 8 insertions, 0 deletions
diff --git a/units/capsule@.service.in b/units/capsule@.service.in
index f2bb9e3a45..a64298786e 100644
--- a/units/capsule@.service.in
+++ b/units/capsule@.service.in
@@ -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
diff --git a/units/user@.service.in b/units/user@.service.in
index 5695465747..381ab2a0db 100644
--- a/units/user@.service.in
+++ b/units/user@.service.in
@@ -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