Skip to content

Commit

Permalink
Fix boot slot A marked as bad on the very first boot
Browse files Browse the repository at this point in the history
On the very first boot, grubenv doesn't exist and loading and saving it
silently fails. However, it is later created by the hassos-persists script and
the missing information are added by grub.cfg on the next boot. As the
consequence, when RAUC tries to get information from grubenv on the first boot,
ORDER variable is missing and the slot is reported as bad.

Fixes #3376
  • Loading branch information
sairon committed Jun 20, 2024
1 parent 94c6930 commit 53ab905
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions buildroot-external/board/pc/ova/hassos-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function hassos_pre_image() {
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" set ORDER="B A"
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" set B_OK=1
grub-editenv "${EFIPART_DATA}/EFI/BOOT/grubenv-B" set B_TRY=0
cp "${EFIPART_DATA}/EFI/BOOT/grubenv-A" "${EFIPART_DATA}/EFI/BOOT/grubenv"

cp -r "${EFIPART_DATA}/"* "${BOOT_DATA}/"
}
Expand Down
8 changes: 8 additions & 0 deletions tests/smoke_test/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ def check_container_running(container_name):
_LOGGER.info("%s", "\n".join(output))


@pytest.mark.dependency(depends=["test_init"])
def test_rauc_status(shell):
output = shell.run_check("rauc status --output-format=shell")
# RAUC_BOOT_PRIMARY won't be set if correct grub env is missing
assert "RAUC_BOOT_PRIMARY='kernel.0'" in output
assert "rauc-WARNING" not in "\n".join(output)


@pytest.mark.dependency(depends=["test_init"])
def test_dmesg(shell):
output = shell.run_check("dmesg")
Expand Down

0 comments on commit 53ab905

Please sign in to comment.