Open zjackwang opened 7 months ago
Can you add a gist or so with the full logs when running with --debug?
Do you have any mkosi scripts that are used with your configuration? I cannot reproduce this error locally with the information you've provided. I'm assuming that /boot
is not a directory in which case mkdir()
is documented to fail with FileExistsError
.
You can verify this by adding run(["bash"], stdin=sys.stdin, cwd=context.root)
just before boot_binary.parent.mkdir(parents=True, exist_ok=True)
is called and checking the boot/
path
So I added run(["bash"], stdin=sys.stdin, cwd=context.root)
and checked out /boot
.
It is a symlink: /boot -> /srv/boot. I verified in our postinstall script that we create this symlink since /srv
will be mutable while /
is immutable. During build time, this symlink is valid.
However, at install_uki
, this symlink is broken. The symlink is now pointing at the host filesystem root srv path, which doesn't exist. Is this because the env is not chroot'd? I encounter the same problem when mounting a built image onto a random path. When I chroot <build_root>
, the symlinks become whole again. Is there a reason to not do this in install_uki
?
@zjackwang Please realize that I lost a lot of time investigating this because you omitted this information. Next time you should add crucial information like this in your original report.
To fix this, don't use absolute symlinks, use relative symlinks.
So we should probably add a chase()
helper function that we use to resolve paths whenever we operate on the image root directory. This helper would open an fd to "/", then chroot and chdir into the image root directory, resolve the symlink and finally chroot and chdir back to "/". That way absolute symlinks would be resolved correctly.
@zjackwang Please realize that I lost a lot of time investigating this because you omitted this information. Next time you should add crucial information like this in your original report.
To fix this, don't use absolute symlinks, use relative symlinks.
Apologies for the omitted information. Confirmed relative symlinks allowed the build to succeed.
Getting this error as using the
Bootloader=systemd-boot
option attempts to install the UKI into /boot/EFI/Linux. Not sure what's going on since the python version is 3.10, and according to https://docs.python.org/3/library/pathlib.html#pathlib.Path.mkdir, the mkdir command in the code should behave likemkdir -p
.Here is my full config:
The build succeeds if I use
Bootloader=uki
as that installs the UKI to/efi/EFI/BOOT
, which was successfully created.