Skip to content

Installing with --bootloader systemd using an image without systemd-boot should fail #2486

Closed

Description

@jeckersb

Currently this "works":

$ bcvk to-disk --composefs-backend --bootloader systemd --filesystem ext4 quay.io/fedora/fedora-bootc:44 /tmp/test-disk.raw
[...]
Bootloader: systemd
Installing bootloader via systemd-boot
[...]
Installation completed successfully!

But there's no systemd-boot in the fedora base image, so the disk ends up being unbootable.

Activity

  1. self-assigned this
    on Sep 22, 2026
  2. jeckersb commented on Sep 22, 2026

    @jeckersb
    CollaboratorAuthor

    Some AI-guided debugging suggests what's happening is because of the environment we're invoking bootctl in during the install path, it detects that we're in a chroot and falls back automatically to graceful mode:

    --graceful
               Ignore failure when the EFI System Partition cannot be found, when EFI variables cannot be written, or a different or newer boot loader is already installed. Currently only applies to is-installed, update, random-seed and install verbs. Since
               version v258, it is implicitly enabled when running inside a chroot.
    
               Added in version 244.
    

    And then mocking up roughly what's going on for a reproducer:

    $ podman run --rm --privileged \
           --env SYSTEMD_LOG_LEVEL=debug \
           --env SYSTEMD_RELAX_ESP_CHECKS=1 \
           --env SYSTEMD_IN_CHROOT=1 \
           quay.io/fedora/fedora-bootc:44 \
           bash -c '
               mkdir -p /tmp/composefs-root
               mount --bind / /tmp/composefs-root
               mount -t tmpfs tmpfs /tmp/composefs-root/boot
               mount -t tmpfs tmpfs /tmp/composefs-root/tmp
    
               echo "=== bootctl install output ==="
               bootctl install --root /tmp/composefs-root --esp-path /boot --no-variables 2>&1
               echo "EXIT: $?"
    
               echo ""
               echo "=== Check what was installed on ESP ==="
               find /tmp/composefs-root/boot -type f
           ' 2>&1
    === bootctl install output ===
    Running in a chroot, enabling --graceful.
    Found container virtualization podman.
    Using EFI System Partition at /tmp/composefs-root/boot.
    Using XBOOTLDR partition at /tmp/composefs-root/boot as $BOOT.
    layout=ostree is specified in config.
    Using entry token: fedora
    Created "/tmp/composefs-root/boot/EFI".
    Created "/tmp/composefs-root/boot/EFI/systemd".
    Created "/tmp/composefs-root/boot/EFI/BOOT".
    Created "/tmp/composefs-root/boot/loader".
    Created "/tmp/composefs-root/boot/loader/keys".
    Created "/tmp/composefs-root/boot/loader/entries".
    Created "/tmp/composefs-root/boot/EFI/Linux".
    Source directory does not exist, ignoring.
     Mount point '/tmp/composefs-root/boot' which backs the random seed file is world accessible, which is a security hole!
    Random seed file /tmp/composefs-root/boot/loader/random-seed successfully written (32 bytes).
    EXIT: 0
    
    === Check what was installed on ESP ===
    /tmp/composefs-root/boot/loader/entries.srel
    /tmp/composefs-root/boot/loader/random-seed
    /tmp/composefs-root/boot/loader/loader.conf
    

    The part about Source directory does not exist, ignoring is coming from here, and BOOTLIBDIR is coming from here and in turn here.

    So in the end it gracefully ignores the fact that there's nothing in /usr/lib/systemd/boot/efi and happily exits 0 without installing anything.

  3. jeckersb commented on Sep 22, 2026

    @jeckersb
    CollaboratorAuthor

    I think the most straightforward fix here is to explicitly set SYSTEMD_IN_CHROOT=0 to prevent it from falling into that detection code, that seems to let it error out as you would expect:

    $ podman run --rm --privileged \
           --env SYSTEMD_LOG_LEVEL=debug \
           --env SYSTEMD_RELAX_ESP_CHECKS=1 \
           --env SYSTEMD_IN_CHROOT=0 \
           quay.io/fedora/fedora-bootc:44 \
           bash -c '
               mkdir -p /tmp/composefs-root
               mount --bind / /tmp/composefs-root
               mount -t tmpfs tmpfs /tmp/composefs-root/boot
               mount -t tmpfs tmpfs /tmp/composefs-root/tmp
    
               echo "=== bootctl install output ==="
               bootctl install --root /tmp/composefs-root --esp-path /boot --no-variables 2>&1
               echo "EXIT: $?"
    
               echo ""
               echo "=== Check what was installed on ESP ==="
               find /tmp/composefs-root/boot -type f
           ' 2>&1
    === bootctl install output ===
    Found container virtualization podman.
    Using EFI System Partition at /tmp/composefs-root/boot.
    Using XBOOTLDR partition at /tmp/composefs-root/boot as $BOOT.
    layout=ostree is specified in config.
    Using entry token: fedora
    Created "/tmp/composefs-root/boot/EFI".
    Created "/tmp/composefs-root/boot/EFI/systemd".
    Created "/tmp/composefs-root/boot/EFI/BOOT".
    Created "/tmp/composefs-root/boot/loader".
    Created "/tmp/composefs-root/boot/loader/keys".
    Created "/tmp/composefs-root/boot/loader/entries".
    Created "/tmp/composefs-root/boot/EFI/Linux".
    Failed to open boot loader directory /tmp/composefs-root/usr/lib/systemd/boot/efi: No such file or directory
    EXIT: 1
    
    === Check what was installed on ESP ===
    
  4. added a commit that references this issue on Sep 23, 2026
    a43b2fd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions