1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 15:45:53 +01:00

lib/src/reboot: use systemd-run to execute the reboot

When we do a reboot it is triggered inside the bootc namespace.
As we implement support for soft-reboots we need to make sure
that systemd has a view into the mounted /run/nextroot
to be able to act on doing a soft-reboot or a reboot.
By using systemd-run we avoid the limited view in the current
namespace.

Signed-off-by: Joseph Marrero Corchado <jmarrero@redhat.com>
This commit is contained in:
Joseph Marrero Corchado
2025-06-30 13:46:21 -04:00
parent bb5171b685
commit 9f566a2e1f

View File

@@ -13,7 +13,9 @@ pub(crate) fn reboot() -> anyhow::Result<()> {
// Flush output streams
let _ = std::io::stdout().flush();
let _ = std::io::stderr().flush();
Task::new("Rebooting system", "reboot").run()?;
Task::new("Rebooting system", "systemd-run")
.args(["--message=Initiated by bootc", "reboot"])
.run()?;
tracing::debug!("Initiated reboot, sleeping forever...");
loop {
std::thread::park();