Stop Paying Full Reboot Downtime: Practical systemd soft-reboot on Linux
说明与用途
使用 systemd soft-reboot 可仅重启用户空间,保持内核和硬件状态,从而降低软件更新后的停机时间。
问题
After a userspace package update, the system remains running old libraries while the kernel stays unchanged, causing unnecessary full reboot downtime.
结果
Using systemd soft-reboot reduces downtime by restarting only userspace while keeping the kernel and hardware state intact, enabling quick recovery after package updates and optional root flips.
工作流
- 1. Verify systemd version ≥254 and presence of soft-reboot.target.
- 2. Ensure root or polkit rights to run power commands.
- 3. (Optional) Prepare /run/nextroot/ with a new root filesystem if a root flip is needed.
- 4. Run
sudo systemctl soft-reboot(or with --when/--force as needed). - 5. Systemd isolates to soft-reboot.target, stops services, unmounts shutdown graph mounts, then reexecutes PID 1.
- 6. If /run/nextroot/ exists, kernel switches root before reexec.
- 7. New userspace boot transaction starts; services restart under the same kernel.
- 8. Verify by checking kernel release (
uname -runchanged) and timestamps (UserspaceTimestamp advanced).
证据
systemctl soft-reboot was added in systemd 254.
soft-reboot isolates toward soft-reboot.target, which requires systemd-soft-reboot.service.
If /run/nextroot/ exists, the root filesystem is switched to it.
- 记录日期: 2026-09-13T20:30:53.266Z