diff --git a/tmt/bug-soft-reboot.md b/tmt/bug-soft-reboot.md new file mode 100644 index 00000000..eaef1df3 --- /dev/null +++ b/tmt/bug-soft-reboot.md @@ -0,0 +1,35 @@ +# TMT soft-reboot limitation + +TMT does not currently support systemd soft-reboots. It detects reboots by checking +if the `/proc/stat` btime (boot time) field changes, which does not happen during +a systemd soft-reboot. + +See: + +Note: This same issue affects Testing Farm as documented in `plans/integration.fmf` +where `test-27-custom-selinux-policy` is disabled for Packit (AWS) testing. + +## Impact on bootc testing + +This means that when testing `bootc switch --soft-reboot=auto` or `bootc upgrade --soft-reboot=auto`: + +1. The bootc commands will correctly prepare for a soft-reboot (staging the deployment in `/run/nextroot`) +2. However, TMT cannot detect or properly handle the soft-reboot +3. Tests must explicitly reset the soft-reboot preparation before calling `tmt-reboot` + +## Workaround + +After calling bootc with `--soft-reboot=auto`, use: + +```nushell +ostree admin prepare-soft-reboot --reset +tmt-reboot +``` + +This forces a full reboot instead of a soft-reboot, which TMT can properly detect. + +## Testing environments + +- **testcloud**: Accidentally worked because libvirt forced a full VM power cycle, overriding systemd's soft-reboot attempt +- **bcvk**: Exposes the real issue because it allows actual systemd soft-reboots +- **Production (AWS, bare metal, etc.)**: Not affected - TMT is purely a testing framework; soft-reboots work correctly in production diff --git a/tmt/plans/integration.fmf b/tmt/plans/integration.fmf index bca4bbe4..fe74cc73 100644 --- a/tmt/plans/integration.fmf +++ b/tmt/plans/integration.fmf @@ -104,7 +104,7 @@ execute: adjust: - when: running_env != image_mode enabled: false - because: tmt-reboot does not work with systemd reboot in testing farm environment + because: tmt-reboot does not work with systemd reboot in testing farm environment (see bug-soft-reboot.md) /test-28-factory-reset: summary: Factory reset diff --git a/tmt/tests/booted/test-custom-selinux-policy.nu b/tmt/tests/booted/test-custom-selinux-policy.nu index 75c786c3..b484a129 100644 --- a/tmt/tests/booted/test-custom-selinux-policy.nu +++ b/tmt/tests/booted/test-custom-selinux-policy.nu @@ -22,10 +22,11 @@ RUN mkdir /opt123; echo \"/opt123 /opt\" >> /etc/selinux/targeted/contexts/files # Build it podman build -t localhost/bootc-derived . - bootc switch --soft-reboot=auto --transport containers-storage localhost/bootc-derived + bootc switch --transport containers-storage localhost/bootc-derived assert (not ("/opt123" | path exists)) + # See ../bug-soft-reboot.md - TMT cannot handle systemd soft-reboots # https://tmt.readthedocs.io/en/stable/stories/features.html#reboot-during-test tmt-reboot } diff --git a/tmt/tests/booted/test-soft-reboot.nu b/tmt/tests/booted/test-soft-reboot.nu index ee372149..e131dd71 100644 --- a/tmt/tests/booted/test-soft-reboot.nu +++ b/tmt/tests/booted/test-soft-reboot.nu @@ -36,7 +36,7 @@ RUN echo test content > /usr/share/testfile-for-soft-reboot.txt assert ("/run/nextroot" | path exists) - #Let's reset the soft-reboot as we still can't correctly soft-reboot with tmt + # See ../bug-soft-reboot.md - TMT cannot handle systemd soft-reboots ostree admin prepare-soft-reboot --reset # https://tmt.readthedocs.io/en/stable/stories/features.html#reboot-during-test tmt-reboot @@ -45,9 +45,7 @@ RUN echo test content > /usr/share/testfile-for-soft-reboot.txt # The second boot; verify we're in the derived image def second_boot [] { assert ("/usr/share/testfile-for-soft-reboot.txt" | path exists) - #tmt-reboot seems not to be using systemd soft-reboot - # and tmt-reboot -c "systemctl soft-reboot" is not connecting back - # let's comment this check. + # See ../bug-soft-reboot.md - we can't verify SoftRebootsCount due to TMT limitation #assert equal (systemctl show -P SoftRebootsCount) "1" # A new derived with new kargs which should stop the soft reboot.