Skip to content

Commit 0f3de09

Browse files
authored
Merge pull request bootc-dev#715 from travier/main-systemctl-reset
bootupctl: Clear failure status from previous runs
2 parents 9bc21ba + 6fcc010 commit 0f3de09

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/cli/bootupctl.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clap::Parser;
44
use log::LevelFilter;
55

66
use std::os::unix::process::CommandExt;
7-
use std::process::Command;
7+
use std::process::{Command, Stdio};
88

99
static SYSTEMD_ARGS_BOOTUPD: &[&str] = &[
1010
"--unit",
@@ -154,6 +154,14 @@ fn ensure_running_in_systemd() -> Result<()> {
154154
require_root_permission()?;
155155
let running_in_systemd = running_in_systemd();
156156
if !running_in_systemd {
157+
// Clear any failure status that may have happened previously
158+
let _r = Command::new("systemctl")
159+
.arg("reset-failed")
160+
.arg("bootupd.service")
161+
.stdout(Stdio::null())
162+
.stderr(Stdio::null())
163+
.spawn()?
164+
.wait()?;
157165
let r = Command::new("systemd-run")
158166
.args(SYSTEMD_ARGS_BOOTUPD)
159167
.args(std::env::args())

0 commit comments

Comments
 (0)