Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not unconditionally copy theme data to boot directory #2624

Open
aplanas opened this issue Aug 26, 2024 · 4 comments
Open

Do not unconditionally copy theme data to boot directory #2624

aplanas opened this issue Aug 26, 2024 · 4 comments

Comments

@aplanas
Copy link
Contributor

aplanas commented Aug 26, 2024

Problem description

The new grub2bls subpackage does already provides an EFI file (grub2bls.efi) that contains in the internal squashfs internal image all the required resources: configuration file, fonts, graphical assets, etc. During the installation this file needs to be copied into the ESP and renamed to grub.efi.

KIWI does expect that the theme packages are also installed, and in the bootloader/config/grub2.py there are unconditional calls to _copy_theme_data_to_boot_directory, making the image fail with:

[   94s] [ INFO    ]: 09:35:44 | Cleaning up Disk instance
[   94s] [ DEBUG   ]: 09:35:44 | EXEC: [partx --delete /dev/loop0]
[   94s] [ DEBUG   ]: 09:35:44 | EXEC: [losetup -d /dev/loop0]
[   94s] [ ERROR   ]: 09:35:44 | KiwiBootLoaderGrubFontError: Setting up unicode font failed with grub path unicode.pf2 not found in ['/usr/src/packages/KIWI-oem/build/image-root/usr/share/grub2/unicode.pf2', '/usr/src/packages/KIWI-oem/build/image-root/usr/lib/grub2/unicode.pf2', '/usr/src/packages/KIWI-oem/build/image-root/usr/share/grub/unicode.pf2', '/usr/src/packages/KIWI-oem/build/image-root/usr/lib/grub/unicode.pf2']
[   94s] Powering off.

Steps to reproduce the behaviour

Create an image with the grub2-x86-efi-bls package, but does not include grub2 or the patterns-base-bootloader

    <packages type="image" profiles="kvm-and-xen-grub-bls">
        <!-- <package name="patterns-base-bootloader"/> -->
        <package name="grub2-x86_64-efi-bls" arch="x86_64"/>
        <package name="grub2-arm-efi-bls" arch="aarch64"/>
    </packages>
@aplanas
Copy link
Contributor Author

aplanas commented Aug 26, 2024

Some approaches:

  • Make the copy of assets optional, in the sense that if some file is missing print a warning and continue without fail
  • Call _copy_theme_data_to_boot_directory if console="gfxterm" is set
  • Make the call if <bootloader-theme> is set

@aplanas
Copy link
Contributor Author

aplanas commented Aug 26, 2024

as mkconfig and install are also missing, this will requires more changes

@schaefi
Copy link
Collaborator

schaefi commented Aug 26, 2024

The original idea with _copy_theme_data_to_boot_directory() was as follows

  • make sure we have a font
  • copy theme data if there is a theme, which is done via if self.theme and that value is set via get_boot_theme() which is a function of the base class that does what you proposed in point 3 of your bullet list

@aplanas The presence of a font so far was always a strict requirement for grub not only for showing a theme but for showing any type of character. So you are saying this requirement has changed ? if it has changed and no font file is required for grub anymore then I'm ok with changing this into a warning

@aplanas
Copy link
Contributor Author

aplanas commented Aug 26, 2024

So you are saying this requirement has changed ?

For the new grub2bls subpackage yes. For the general case no.

As commented in the original post all the elements (configuration files, fonts, modules like bli.mod, and graphic resources) are now deployed inside the EFI file (the squashfs image embedded inside the EFI file)

Changing the the exception into a warning seems a very sensible option. The problem that I found is that also the rest of the tools (grub2-mkconfig, grub2-install, etc) are also optional: the configuration file are inside the EFI and the external one is ignored if present, and the installation is just a copy-and-rename operation from rootfs to the ESP. No other bit (like i386-pc) is not present in the rootfs nor required in the ESP. Basically the grub2bls subpackage just contain a single EFI file and no dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
@aplanas @schaefi and others