From 665a3d6d15c09428debcabd46e8a2e27afc51a46 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 19 Oct 2023 13:58:03 +0100 Subject: systemctl: automatically softreboot/kexec if set up on reboot Automatically softreboot if the nextroot has been set up with an OS tree, or automatically kexec if a kernel has been loaded with kexec --load. Add SYSTEMCTL_SKIP_AUTO_KEXEC and SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT to skip the automated switchover. --- man/org.freedesktop.login1.xml | 18 +++++++++++------- man/systemctl.xml | 15 +++++++++++++++ man/systemd-soft-reboot.service.xml | 4 ++++ 3 files changed, 30 insertions(+), 7 deletions(-) (limited to 'man') diff --git a/man/org.freedesktop.login1.xml b/man/org.freedesktop.login1.xml index 4a94656f66..954518992b 100644 --- a/man/org.freedesktop.login1.xml +++ b/man/org.freedesktop.login1.xml @@ -595,16 +595,20 @@ node /org/freedesktop/login1 { SuspendThenHibernateWithFlags() add flags to allow for extendability, defined as follows: -#define SD_LOGIND_ROOT_CHECK_INHIBITORS (UINT64_C(1) << 0) -#define SD_LOGIND_KEXEC_REBOOT (UINT64_C(1) << 1) -#define SD_LOGIND_SOFT_REBOOT (UINT64_C(1) << 2) +#define SD_LOGIND_ROOT_CHECK_INHIBITORS (UINT64_C(1) << 0) +#define SD_LOGIND_KEXEC_REBOOT (UINT64_C(1) << 1) +#define SD_LOGIND_SOFT_REBOOT (UINT64_C(1) << 2) +#define SD_LOGIND_SOFT_REBOOT_IF_NEXTROOT_SET_UP (UINT64_C(1) << 3) When the flags is 0 then these methods behave just like the versions without flags. When SD_LOGIND_ROOT_CHECK_INHIBITORS (0x01) is set, active inhibitors are - honoured for privileged users too. When SD_LOGIND_KEXEC_REBOOT (0x02) is set, then - RebootWithFlags() performs a kexec reboot if kexec kernel is loaded. When - SD_LOGIND_SOFT_REBOOT (0x04) is set, then RebootWithFlags() - performs a userspace reboot only. + honoured for privileged users too. When SD_LOGIND_KEXEC_REBOOT (0x02) is set, + then RebootWithFlags() performs a kexec reboot if kexec kernel is loaded. When + SD_LOGIND_SOFT_REBOOT (0x04) is set, or + SD_LOGIND_SOFT_REBOOT_IF_NEXTROOT_SET_UP (0x08) is set and a new root file system + has been set up on /run/nextroot/, then RebootWithFlags() + performs a userspace reboot only. SD_LOGIND_SOFT_REBOOT_IF_NEXTROOT_SET_UP and + SD_LOGIND_KEXEC_REBOOT can be combined, with soft-reboot having precedence. SetRebootParameter() sets a parameter for a subsequent reboot operation. See the description of reboot in diff --git a/man/systemctl.xml b/man/systemctl.xml index 419d4a8243..217010ca1c 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -1652,6 +1652,13 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err This command honors and in a similar way as halt. + If a new kernel has been loaded via kexec --load, a + kexec will be performed instead of a reboot, unless + SYSTEMCTL_SKIP_AUTO_KEXEC=1 has been set. If a new root file system has + been setup on /run/nextroot, a soft-reboot will be + performed instead of a reboot, unless SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT=1 has + been set. + @@ -1681,6 +1688,10 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err This command honors and similarly to halt. + + If a new kernel has been loaded via kexec --load, a + kexec will be performed when reboot is invoked, unless + SYSTEMCTL_SKIP_AUTO_KEXEC=1 has been set. @@ -1700,6 +1711,10 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err systemd-soft-reboot.service8 for details. + If a new root file system has been setup on /run/nextroot, a + soft-reboot will be performed when reboot is invoked, + unless SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT=1 has been set. + diff --git a/man/systemd-soft-reboot.service.xml b/man/systemd-soft-reboot.service.xml index 1de2fbc5f3..2419b86604 100644 --- a/man/systemd-soft-reboot.service.xml +++ b/man/systemd-soft-reboot.service.xml @@ -164,6 +164,10 @@ ExecStart=sleep infinity Note that systemd-soft-reboot.service (and related units) should never be executed directly. Instead, trigger system shutdown with a command such as systemctl soft-reboot. + + Note that if a new root file system has been setup on /run/nextroot, a + soft-reboot will be performed when the reboot command is + invoked. -- cgit v1.2.3