diff --git a/test_infra/src/lib.rs b/test_infra/src/lib.rs index 08d051fdb..8a4361d92 100644 --- a/test_infra/src/lib.rs +++ b/test_infra/src/lib.rs @@ -1085,7 +1085,7 @@ impl Guest { } pub fn reboot_linux(&self, current_reboot_count: u32, custom_timeout: Option) { - let list_boots_cmd = "sudo journalctl --list-boots | wc -l"; + let list_boots_cmd = "sudo last | grep -c reboot"; let boot_count = self .ssh_command(list_boots_cmd) .unwrap() diff --git a/tests/integration.rs b/tests/integration.rs index 94c1dbc75..29262ed33 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -1882,11 +1882,8 @@ fn _test_virtio_iommu(acpi: bool) { } fn get_reboot_count(guest: &Guest) -> u32 { - // Ensure that the current boot journal is written so reboot counts are valid - guest.ssh_command("sudo journalctl --sync").unwrap(); - guest - .ssh_command("sudo journalctl --list-boots | wc -l") + .ssh_command("sudo last | grep -c reboot") .unwrap() .trim() .parse::()