]> git.ipfire.org Git - thirdparty/systemd.git/commit
systemctl-logind: auto soft-reboot only if /run/nextroot/ is mountpoint 32136/head
authorMike Yuan <me@yhndnzj.com>
Sun, 7 Apr 2024 11:33:37 +0000 (19:33 +0800)
committerMike Yuan <me@yhndnzj.com>
Sun, 7 Apr 2024 12:02:40 +0000 (20:02 +0800)
commit9eb7f4cebf6c950a459eaab310e0b3e3d26cf2d2
tree48345ff2d17ed66c5d5dee7409cc52e640e752b9
parent706e9a4bc7988b44a25c90543d7354f3997be990
systemctl-logind: auto soft-reboot only if /run/nextroot/ is mountpoint

Consider the following case: a user sets up a minimum rootfs for
file system maintenance work in /run/nextroot/ dir directly. When
they're done, they expect 'systemctl reboot' to perform a full reboot.
But they keep soft-rebooting back to the tmpfs root, until they
find out about $SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT.

So currently, when /run/nextroot/ is a normal dir, pid1 automatically
turns it into a bind mount to soft-reboot into. This is good, but when
combined with automatic soft-reboot it has an arguably unexpected
behavior, since /run/nextroot/ can never go away in such a case.
OTOH, if /run/nextroot/ is a mountpoint in the first place, the mount
is *moved* so a second reboot would not trigger auto soft-reboot.
Let's just make things more friendly to users, and do auto soft-reboot
only if /run/nextroot/ is also a mountpoint.
src/systemctl/systemctl-logind.c