OSInside / kiwi

KIWI - Appliance Builder Next Generation
https://osinside.github.io/kiwi
GNU General Public License v3.0
282 stars 142 forks source link

Missing `strings` command results in non-bootable ISOs #2565

Closed jloeser closed 3 weeks ago

jloeser commented 1 month ago

Problem description

I am using a Fedora 40 image in Hetzner Cloud in a pipeline to build ISO live systems in an automated way.

Builds runs through smoothly.

Resulting ISOs didn't boot up correctly because of missing (cd0)/EFI/ubuntu (here for Ubuntu OS) path for GRUB2. Only the default path (cd0)/EFI/BOOT is available. Boot stops at GRUB2 rescue shell.

Root cause is missing strings command on the build host which extracts the path from GRUB2 binary: https://github.com/OSInside/kiwi/blob/98608861e4b612b19f533ad4ac0a38cbb1e16f54/kiwi/bootloader/config/grub2.py#L576

Fedora image might be stripped down by Hetzner, however I would expect at least a warning if a command invocation fails in case of "command not found" errors (or any error) and/or a dependency to strings command - which is in the most cases part of binutils.

According to the logs, there is no issue with missing strings command at all:

...
[ INFO    ]: 07:09:23 | --> Using standard boot template
[ DEBUG   ]: 07:09:23 | EXEC: [bash -c strings /root/image/build/image-root/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed | grep EFI\/]
[ DEBUG   ]: 07:09:23 | EXEC: [mkdir -p /root/image/live-media.ypc4hwrk/EFI/ubuntu]
[ INFO    ]: 07:09:23 | Copying /root/image/live-media.ypc4hwrk/EFI/BOOT/grub.cfg -> /root/image/live-media.ypc4hwrk/EFI/ubuntu/grub.cfg to be found by EFI
[ INFO    ]: 07:09:23 | Writing KIWI template grub.cfg file
...

Installing binutils fixed the issue for me.

Expected behaviour

Bootable ISO after successful built.

Steps to reproduce the behaviour

OS and Software information

schaefi commented 4 weeks ago

Hi, yes this is a bad one. The strings call is intentionally done with raise_on_error=False which then leads to the default efi boot path EFI/BOOT. However the case when there is not even a strings tool available and the distro requires a vendor path to boot will then also fall into "not so bad" category.

Adding binutils as a requirement on the packaging level is too expensive. I'll add a check for the command such that it will end with a proper error message.