Update will fail if update metadata is missing for the current boot type#1039
Conversation
There was a problem hiding this comment.
Code Review
This pull request correctly implements the desired behavior of failing an update when the metadata for the current boot type is missing. The changes in src/bios.rs and src/efi.rs are clear and effective. The test case in tests/kola/test-bootupd has also been updated to reflect this new behavior for BIOS-booted systems. I've added one suggestion to make the test more robust by making it boot-aware, so it can validate the behavior on both EFI and BIOS systems.
ef6b96c to
5c6efd7
Compare
c83c64a to
d1fa7ad
Compare
| get_component_update(sysroot, self) | ||
| let content_metadata = get_component_update(sysroot, self)?; | ||
| // Failed as expected if booted with BIOS and no update metadata | ||
| if content_metadata.is_none() && !sysroot.exists("sys/firmware/efi")? { |
There was a problem hiding this comment.
why not !is_efi_booted instead of testing the /sys path?
There was a problem hiding this comment.
I am concern that it might be not suitable for ppc, as is_efi_booted() is for x86_64, or maybe it is better to move is_efi_booted() out of efi.rs. WDYT?
|
This change is breaking the builds for automotive. I'm getting this when using image-builder converting the bootc image to a disk image: I don't see this on my machine which has a /sys/firmware/efi directory, but I am seeing it in the internal CI builds, which are probably running on a non-efi system. |
|
Overall, its probably not good that bootupd makes decisions based on host hardware details, as such things will never be right when running in the context of generating images. |
|
This was not meant to be triggered at install time but only at update time, so this is a bug. |
|
Then it should be in run_update(), not query_update(), i think. query_update() is called from install(). |
|
The main concern that led to this PR was that we would remove the EFI binaries if the metadata was not there in the image and that would break an installed system on update: #1018. But this only matters for the EFI case as we do not "remove" the BIOS boot partition content on BIOS booted systems on update if there is no BIOS component. We just do not update it. So I would remove the checks for BIOS and only keep the runtime check that if the system is booted via EFI, we should install an EFI component. This would break systems where we would only install BIOS but that does not exists? |
Fixes #1035