From d526ab8a9aa74798e453dabf8c55636305238110 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 29 Sep 2025 21:58:36 +0900 Subject: [PATCH] mkosi: avoid infinite reboot on failure If systemd-pcrphase-initrd.service and friends failed for some reasons, the test VM will reboot infinitely and the test will timeout. Let's propagate the failure to the host and fail the test earlier in that case. --- .../exit-on-failure.conf | 2 ++ .../system/systemd-storagetm.service.d/exit-on-failure.conf | 2 ++ .../system/systemd-validatefs@.service.d/exit-on-failure.conf | 2 ++ .../system/systemd-pcrfs-root.service.d/exit-on-failure.conf | 2 ++ .../system/systemd-pcrfs@.service.d/exit-on-failure.conf | 2 ++ .../systemd-pcrphase-sysinit.service.d/exit-on-failure.conf | 2 ++ .../system/systemd-pcrphase.service.d/exit-on-failure.conf | 2 ++ .../systemd-pcrphase-initrd.service.d/exit-on-failure.conf | 2 ++ .../exit-on-failure.conf | 2 ++ 9 files changed, 18 insertions(+) create mode 100644 mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-pcrphase-factory-reset.service.d/exit-on-failure.conf create mode 100644 mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-storagetm.service.d/exit-on-failure.conf create mode 100644 mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-validatefs@.service.d/exit-on-failure.conf create mode 100644 mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrfs-root.service.d/exit-on-failure.conf create mode 100644 mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrfs@.service.d/exit-on-failure.conf create mode 100644 mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-sysinit.service.d/exit-on-failure.conf create mode 100644 mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase.service.d/exit-on-failure.conf create mode 100644 mkosi/mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-initrd.service.d/exit-on-failure.conf create mode 100644 mkosi/mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-storage-target-mode.service.d/exit-on-failure.conf diff --git a/mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-pcrphase-factory-reset.service.d/exit-on-failure.conf b/mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-pcrphase-factory-reset.service.d/exit-on-failure.conf new file mode 100644 index 00000000000..7183952c9bf --- /dev/null +++ b/mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-pcrphase-factory-reset.service.d/exit-on-failure.conf @@ -0,0 +1,2 @@ +[Unit] +FailureAction=exit diff --git a/mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-storagetm.service.d/exit-on-failure.conf b/mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-storagetm.service.d/exit-on-failure.conf new file mode 100644 index 00000000000..7183952c9bf --- /dev/null +++ b/mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-storagetm.service.d/exit-on-failure.conf @@ -0,0 +1,2 @@ +[Unit] +FailureAction=exit diff --git a/mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-validatefs@.service.d/exit-on-failure.conf b/mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-validatefs@.service.d/exit-on-failure.conf new file mode 100644 index 00000000000..7183952c9bf --- /dev/null +++ b/mkosi/mkosi.extra.common/usr/lib/systemd/system/systemd-validatefs@.service.d/exit-on-failure.conf @@ -0,0 +1,2 @@ +[Unit] +FailureAction=exit diff --git a/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrfs-root.service.d/exit-on-failure.conf b/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrfs-root.service.d/exit-on-failure.conf new file mode 100644 index 00000000000..7183952c9bf --- /dev/null +++ b/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrfs-root.service.d/exit-on-failure.conf @@ -0,0 +1,2 @@ +[Unit] +FailureAction=exit diff --git a/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrfs@.service.d/exit-on-failure.conf b/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrfs@.service.d/exit-on-failure.conf new file mode 100644 index 00000000000..7183952c9bf --- /dev/null +++ b/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrfs@.service.d/exit-on-failure.conf @@ -0,0 +1,2 @@ +[Unit] +FailureAction=exit diff --git a/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-sysinit.service.d/exit-on-failure.conf b/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-sysinit.service.d/exit-on-failure.conf new file mode 100644 index 00000000000..7183952c9bf --- /dev/null +++ b/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-sysinit.service.d/exit-on-failure.conf @@ -0,0 +1,2 @@ +[Unit] +FailureAction=exit diff --git a/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase.service.d/exit-on-failure.conf b/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase.service.d/exit-on-failure.conf new file mode 100644 index 00000000000..7183952c9bf --- /dev/null +++ b/mkosi/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase.service.d/exit-on-failure.conf @@ -0,0 +1,2 @@ +[Unit] +FailureAction=exit diff --git a/mkosi/mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-initrd.service.d/exit-on-failure.conf b/mkosi/mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-initrd.service.d/exit-on-failure.conf new file mode 100644 index 00000000000..7183952c9bf --- /dev/null +++ b/mkosi/mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-initrd.service.d/exit-on-failure.conf @@ -0,0 +1,2 @@ +[Unit] +FailureAction=exit diff --git a/mkosi/mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-storage-target-mode.service.d/exit-on-failure.conf b/mkosi/mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-storage-target-mode.service.d/exit-on-failure.conf new file mode 100644 index 00000000000..7183952c9bf --- /dev/null +++ b/mkosi/mkosi.images/initrd/mkosi.extra/usr/lib/systemd/system/systemd-pcrphase-storage-target-mode.service.d/exit-on-failure.conf @@ -0,0 +1,2 @@ +[Unit] +FailureAction=exit -- 2.47.3