Skip to content

Commit 8d73029

Browse files
committed
tmt: Document soft-reboot limitation and fix tests
TMT does not support systemd soft-reboots - it only detects reboots by checking if /proc/stat btime changes, which doesn't happen during soft-reboots. This caused test-custom-selinux-policy to hang when running with bcvk (which allows actual soft-reboots), while it accidentally passed with testcloud (which forced full VM reboots). Add bug-soft-reboot.md documenting this limitation and update both test files to reference it. Also remove --soft-reboot=auto from test-custom-selinux-policy since we can't test it with TMT anyway. Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Colin Walters <[email protected]>
1 parent 68e4113 commit 8d73029

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
lines changed

tmt/bug-soft-reboot.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# TMT soft-reboot limitation
2+
3+
TMT does not currently support systemd soft-reboots. It detects reboots by checking
4+
if the `/proc/stat` btime (boot time) field changes, which does not happen during
5+
a systemd soft-reboot.
6+
7+
See: <https://github.com/teemtee/tmt/issues/3143>
8+
9+
Note: This same issue affects Testing Farm as documented in `plans/integration.fmf`
10+
where `test-27-custom-selinux-policy` is disabled for Packit (AWS) testing.
11+
12+
## Impact on bootc testing
13+
14+
This means that when testing `bootc switch --soft-reboot=auto` or `bootc upgrade --soft-reboot=auto`:
15+
16+
1. The bootc commands will correctly prepare for a soft-reboot (staging the deployment in `/run/nextroot`)
17+
2. However, TMT cannot detect or properly handle the soft-reboot
18+
3. Tests must explicitly reset the soft-reboot preparation before calling `tmt-reboot`
19+
20+
## Workaround
21+
22+
After calling bootc with `--soft-reboot=auto`, use:
23+
24+
```nushell
25+
ostree admin prepare-soft-reboot --reset
26+
tmt-reboot
27+
```
28+
29+
This forces a full reboot instead of a soft-reboot, which TMT can properly detect.
30+
31+
## Testing environments
32+
33+
- **testcloud**: Accidentally worked because libvirt forced a full VM power cycle, overriding systemd's soft-reboot attempt
34+
- **bcvk**: Exposes the real issue because it allows actual systemd soft-reboots
35+
- **Production (AWS, bare metal, etc.)**: Not affected - TMT is purely a testing framework; soft-reboots work correctly in production

tmt/plans/integration.fmf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ execute:
104104
adjust:
105105
- when: running_env != image_mode
106106
enabled: false
107-
because: tmt-reboot does not work with systemd reboot in testing farm environment
107+
because: tmt-reboot does not work with systemd reboot in testing farm environment (see bug-soft-reboot.md)
108108

109109
/test-28-factory-reset:
110110
summary: Factory reset

tmt/tests/booted/test-custom-selinux-policy.nu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ RUN mkdir /opt123; echo \"/opt123 /opt\" >> /etc/selinux/targeted/contexts/files
2222
# Build it
2323
podman build -t localhost/bootc-derived .
2424

25-
bootc switch --soft-reboot=auto --transport containers-storage localhost/bootc-derived
25+
bootc switch --transport containers-storage localhost/bootc-derived
2626

2727
assert (not ("/opt123" | path exists))
2828

29+
# See ../bug-soft-reboot.md - TMT cannot handle systemd soft-reboots
2930
# https://tmt.readthedocs.io/en/stable/stories/features.html#reboot-during-test
3031
tmt-reboot
3132
}

tmt/tests/booted/test-soft-reboot.nu

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ RUN echo test content > /usr/share/testfile-for-soft-reboot.txt
3636

3737
assert ("/run/nextroot" | path exists)
3838

39-
#Let's reset the soft-reboot as we still can't correctly soft-reboot with tmt
39+
# See ../bug-soft-reboot.md - TMT cannot handle systemd soft-reboots
4040
ostree admin prepare-soft-reboot --reset
4141
# https://tmt.readthedocs.io/en/stable/stories/features.html#reboot-during-test
4242
tmt-reboot
@@ -45,9 +45,7 @@ RUN echo test content > /usr/share/testfile-for-soft-reboot.txt
4545
# The second boot; verify we're in the derived image
4646
def second_boot [] {
4747
assert ("/usr/share/testfile-for-soft-reboot.txt" | path exists)
48-
#tmt-reboot seems not to be using systemd soft-reboot
49-
# and tmt-reboot -c "systemctl soft-reboot" is not connecting back
50-
# let's comment this check.
48+
# See ../bug-soft-reboot.md - we can't verify SoftRebootsCount due to TMT limitation
5149
#assert equal (systemctl show -P SoftRebootsCount) "1"
5250

5351
# A new derived with new kargs which should stop the soft reboot.

0 commit comments

Comments
 (0)