From 57759855eacc90b9dec81d4930b8a9589bc9a7e5 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 See: https://github.com/coreos/bootupd/pull/663 --- src/cli/bootupctl.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cli/bootupctl.rs b/src/cli/bootupctl.rs index 123d42bd..6775701e 100644 --- a/src/cli/bootupctl.rs +++ b/src/cli/bootupctl.rs @@ -154,6 +154,12 @@ 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())