units/{user,capsule}@.service: issue daemon-reexec when notify-reloading
authorMike Yuan <me@yhndnzj.com>
Thu, 10 Oct 2024 19:32:17 +0000 (21:32 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 11 Oct 2024 08:36:08 +0000 (10:36 +0200)
commita375e145190482e8a2f0971bffb332e31211622f
tree6b6fb5f964cc7072008df3a3035c4a6a163f3840
parent155098a702c4f6de6b1dca534661492625773fed
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.
units/capsule@.service.in
units/user@.service.in