From ac8ba5a7b01ec3f8d47ef9cd57f9c9e7bd7f5682 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Wed, 8 Jan 2025 09:43:47 -0500 Subject: [PATCH] Delay being killed on reboot/poweroff Setting KillSignal=SIGCONT is a hack, but it gives us DefaultTimeoutStopSec before being killed (45s on Fedora, 90s on EL9). The proper systemd way would be to use inhibit locks but they are ignored by reboot/poweroff commands, ie you need the systemctl reboot/poweroff variants, and just using systemd-inhibit makes all the logs starts with systemd-inhibit instead of bootupctl. --- contrib/packaging/bootloader-update.service | 5 +++++ src/cli/bootupctl.rs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/contrib/packaging/bootloader-update.service b/contrib/packaging/bootloader-update.service index 065f1730..8561c18d 100644 --- a/contrib/packaging/bootloader-update.service +++ b/contrib/packaging/bootloader-update.service @@ -6,7 +6,12 @@ Documentation=https://github.com/coreos/bootupd Type=oneshot ExecStart=/usr/bin/bootupctl update RemainAfterExit=yes +PrivateNetwork=yes +ProtectHome=yes MountFlags=slave +# inhibit locks are ignored by reboot/poweroff (need to use systemctl) +# so just delay being killed as much as possible +KillSignal=SIGCONT [Install] WantedBy=multi-user.target diff --git a/src/cli/bootupctl.rs b/src/cli/bootupctl.rs index ab30decb..6851e391 100644 --- a/src/cli/bootupctl.rs +++ b/src/cli/bootupctl.rs @@ -15,6 +15,8 @@ static SYSTEMD_ARGS_BOOTUPD: &[&str] = &[ "ProtectHome=yes", "--property", "MountFlags=slave", + "--property", + "KillSignal=SIGCONT", "--pipe", ];