install: attempt to use an already mounted ESP at the target#960
Conversation
e15b3d0 to
b680523
Compare
|
For the record, this problem isn't specific to metal4k images. It also happens on ARM (aarch64) where BIOS isn't an option and we only do EFI: |
| let destpath = if let Some(destdir) = self.get_mounted_esp(Path::new(dest_root))? { | ||
| destdir | ||
| } else { | ||
| // Using `blockdev` to find the partition instead of partlabel because | ||
| // we know the target install toplevel device already. | ||
| let esp_device = blockdev::get_esp_partition(device)? | ||
| .ok_or_else(|| anyhow::anyhow!("Failed to find ESP device"))?; | ||
| self.mount_esp_device(Path::new(dest_root), Path::new(&esp_device))? | ||
| }; | ||
|
|
||
| let destd = &openat::Dir::open(destpath) | ||
| let destd = &openat::Dir::open(&destpath) |
There was a problem hiding this comment.
I'm not 100% sure this is going to solve the problem in all cases. Do I understand correctly that device passed into this install() function will be None (i.e. device.is_empty() is true) if we aren't doing BIOS?
If that's the case then won't we run into this same problem IF the ESP isn't already mounted on platforms where BIOS isn't requested? i.e. if the ESP isn't already mounted and BIOS wasn't requested then we'll still fail. In the commit message for f6ef3d1 it mentions
During
bootc install to-diskthe esp device is not mounted
So I guess one way to test that theory would be to run a bootc install to-disk on say aarch64.
I kind of wish we coul just assume the ESP is already mounted in this function.
There was a problem hiding this comment.
Do I understand correctly that
devicepassed into thisinstall()function will be None (i.e.device.is_empty()is true) if we aren't doing BIOS?
Yes, we need the device to install BIOS, if without device on x64, will skip BIOS, see https://github.com/coreos/bootupd/blob/main/src/bootupd.rs#L88
If that's the case then won't we run into this same problem IF the ESP isn't already mounted on platforms where BIOS isn't requested? i.e. if the ESP isn't already mounted and BIOS wasn't requested then we'll still fail. In the commit message for f6ef3d1 it mentions
During
bootc install to-diskthe esp device is not mountedSo I guess one way to test that theory would be to run a
bootc install to-diskon say aarch64.
On aarch64 is a little different as we do not include BIOS module, and bootc install to-disk calls bootupctl backend install --write-uuid --device /dev/loop0 /run/bootc/mounts/rootfs with device (see run logs)
I kind of wish we coul just assume the ESP is already mounted in this function.
Yes, as we do not have device and can not find esp and can not mount.
There was a problem hiding this comment.
if the ESP isn't already mounted and BIOS wasn't requested then we'll still fail.
Agree that will be a problem. We have the option --component to specify the target component, see https://github.com/coreos/bootupd/blob/main/src/cli/bootupd.rs#L66, maybe we should pass the device and specify --component EFI to skip BIOS when building metal4k image (for x64), but I think the workaround also works for that change.
There was a problem hiding this comment.
Include cosa osbuild metal4k in CI, and result is PASSED, IMU the workaround will fix the problem.
d87d1e2 to
95c5ca1
Compare
Let's attempt to use an already mounted ESP at the target dest_root if one is already mounted there in a known ESP location, if failed, will fallback to mount ESP partition of the device. See coreos/coreos-assembler#4161
95c5ca1 to
66877ef
Compare
Let's attempt to use an already mounted ESP at the target
dest_root if one is already mounted there in a known ESP location,
if failed, will fallback to mount ESP partition of the device.
See coreos/coreos-assembler#4161