Skip to content

Commit

Permalink
Cleanly unmount /boot on test end
Browse files Browse the repository at this point in the history
Recent ext4 drivers may leave "orphan present" flag set on unclean ext4
unmount. Mounting such filesystem requires either forced fsck or new enough
kernel. This is especially problematic for Heads which currently doesn't have
either. Try to avoid the issue in tests.

Related to linuxboot/heads#1796
  • Loading branch information
marmarek committed Nov 8, 2024
1 parent 3a7ab82 commit ea6bbcf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
6 changes: 6 additions & 0 deletions lib/installedtest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ sub post_fail_hook {
$self->save_and_upload_log("qvm-run --no-gui -p $vm 'journalctl -b --user'", 'sys-gui-user-journalctl.log');
$self->save_and_upload_log("qvm-run --no-gui -p -u root $vm 'tar cz /var/log'", 'sys-gui-var_log.tar.gz');
}
if (check_var("BACKEND", "generalhw")) {
# clears ext4 "orphan present" flag
script_run("! mountpoint -q /boot/efi || mount -o ro,remount /boot/efi");
script_run("! mountpoint -q /boot || mount -o ro,remount /boot");
script_run("sync");
}
}


Expand Down
4 changes: 1 addition & 3 deletions main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ if (get_var('TEST_GUI_INTERACTIVE')) {
autotest::loadtest "tests/collect_logs.pm";
}

if (get_var("STORE_HDD_1") || get_var("PUBLISH_HDD_1")) {
autotest::loadtest "tests/shutdown.pm";
}
autotest::loadtest "tests/shutdown.pm";

1;

Expand Down
15 changes: 12 additions & 3 deletions tests/shutdown.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ sub run {
select_console('root-console');
# make upload as small as possible
script_run("fstrim -v /", timeout => 180);
# shutdown before uploading disk image
script_run("poweroff", 0);
assert_shutdown 300;
if (get_var("STORE_HDD_1") || get_var("PUBLISH_HDD_1")) {
# shutdown before uploading disk image
script_run("poweroff", 0);
assert_shutdown 300;
} elsif (check_var("BACKEND", "generalhw")) {
# otherwise just sync and remount /boot (clears the orphan present
# flag) if running non-virtualized
script_run("! mountpoint -q /boot/efi || mount -o ro,remount /boot/efi");
script_run("! mountpoint -q /boot || mount -o ro,remount /boot");
script_run("sync");
}

}

# this is not 'fatal' or 'important' as all wiki test cases are passed
Expand Down

0 comments on commit ea6bbcf

Please sign in to comment.