From f7c6c0880ead25588c9fc58c24acd1575974e246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Mon, 2 Sep 2024 16:58:27 +0200 Subject: [PATCH] bootupctl: Clear failure status from previous runs If for whatever reason a bootupd command fails, it will leave the systemd service unit in a failed state and systemd will then refuse to run a unit under the same name with `systemd-run` again until the failure is cleared. Thus systematically call `systemctl reset-failed` before calling `systemd-run` to clear any potential failures from previous calls. See: https://github.com/coreos/bootupd/issues/707 --- src/cli/bootupctl.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cli/bootupctl.rs b/src/cli/bootupctl.rs index 123d42bd..9e48fbe0 100644 --- a/src/cli/bootupctl.rs +++ b/src/cli/bootupctl.rs @@ -154,6 +154,11 @@ fn ensure_running_in_systemd() -> Result<()> { require_root_permission()?; let running_in_systemd = running_in_systemd(); if !running_in_systemd { + // Clear any failure status that may have happened previously + let _r = Command::new("systemctl") + .arg("reset-failed") + .arg("bootupd.service") + .spawn()?.wait()?; let r = Command::new("systemd-run") .args(SYSTEMD_ARGS_BOOTUPD) .args(std::env::args())