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

Failed running distrobuilder generating RockyLinux 9 VM #827

Open
nobodyman1 opened this issue Mar 11, 2024 · 2 comments
Open

Failed running distrobuilder generating RockyLinux 9 VM #827

nobodyman1 opened this issue Mar 11, 2024 · 2 comments

Comments

@nobodyman1
Copy link

I tried to generate an image, but it doesn´t work.

  • Build system:
    NAME="Rocky Linux"
    VERSION="9.3 (Blue Onyx)"
  • SELinux disabled
  • Distrobuilder version: 3.0
  • Build command:
    distrobuilder build-incus rockylinux.yaml --vm --debug --disable-overlay -o image.architecture=x86_64 -o image.release=9 -o image.variant=default -o source.variant=boot
  • Used template file:
    https://raw.githubusercontent.com/lxc/lxc-ci/main/images/rockylinux.yaml

The output shows an error:

...
  Installing       : rootfiles-8.1-31.el9.noarch                                                                                                                                                         127/127
  Running scriptlet: grub2-common-1:2.06-70.el9_3.2.rocky.0.3.noarch                                                                                                                                     127/127
  Running scriptlet: kernel-modules-core-5.14.0-362.18.1.el9_3.0.1.x86_64                                                                                                                                127/127
  Running scriptlet: kernel-core-5.14.0-362.18.1.el9_3.0.1.x86_64                                                                                                                                        127/127
grub2-probe: error: failed to get canonical path of `/dev/mapper/rl-root'.
No path or device is specified.
Usage: grub2-probe [OPTION...] [OPTION]... [PATH|DEVICE]
Try 'grub2-probe --help' or 'grub2-probe --usage' for more information.
findmnt: can't read (null): No such file or directory

  Running scriptlet: kernel-modules-5.14.0-362.18.1.el9_3.0.1.x86_64
...

but building continues until

...
INFO   [2024-03-11T12:27:29+01:00] Running hooks                                 trigger=post-files
++ ls /boot/initramfs-5.14.0-362.18.1.el9_3.0.1.x86_64.img
++ sed -r 's#.*initramfs-(.+)\.img#\1#'
+ kver=5.14.0-362.18.1.el9_3.0.1.x86_64
+ target=/boot/efi/EFI/rocky/grub.cfg
+ grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done
+ sed -i 's#root=[^ ]*#root=/dev/sda2#g' /boot/efi/EFI/rocky/grub.cfg
+ grubby --update-kernel=/boot/vmlinuz-5.14.0-362.18.1.el9_3.0.1.x86_64 '--args=root=/dev/sda2 ro'
The param /boot/vmlinuz-5.14.0-362.18.1.el9_3.0.1.x86_64 is incorrect
Error: Failed to run post-files: exit status 1
ERROR  [2024-03-11T12:27:31+01:00] Failed running distrobuilder                  err="Failed to run post-files: exit status 1"
INFO   [2024-03-11T12:27:31+01:00] Removing cache directory

To get some more info I added to rockylinux.yaml:

- trigger: post-files
  action: |-
    #!/bin/sh
    set -eux
    grubby --info=ALL
    ...
  types:
  - vm
  releases:
  - 9

Here is the additional output:

index=0
kernel="/var/cache/distrobuilder.4233995394/rootfs/boot/vmlinuz-5.14.0-362.18.1.el9_3.0.1.x86_64"
args="ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap rhgb quiet selinux=0"
root="/dev/mapper/rl-root"
initrd="/var/cache/distrobuilder.4233995394/rootfs/boot/initramfs-5.14.0-362.18.1.el9_3.0.1.x86_64.img"
title="Rocky Linux (5.14.0-362.18.1.el9_3.0.1.x86_64) 9.3 (Blue Onyx)"
id="84539f10c3234600a5599254072f4639-5.14.0-362.18.1.el9_3.0.1.x86_64"

Result: The kernel and initrd settings are invalid!

As workaround for this I modified rockylinux.yaml:

- trigger: post-files
  action: |-
    #!/bin/sh
    set -eux
    ...
    # Patch *.conf files
    sed -i "s|/var/cache/distrobuilder\..*/rootfs||" /boot/loader/entries/*.conf
    # Update files in /boot/loader/entries/. `grubby` needs to be run after
    # `grub2-mkconfig` as the latter overwrites files in /boot/loader/entries/.
    grubby --update-kernel=/boot/vmlinuz-${kver} --args="root=/dev/sda2 ro"
    # Regenerate initramfs
    dracut --kver "${kver}" -f
  types:
  - vm
  releases:
  - 9

With this patch the image is generated.
The issue is similar to #785 but in that case there is no call of grub-install which can be modified.

@stgraber
Copy link
Member

It looks like it's your host system LVM setup that's being picked up by grub inside the build environment.

We have all our build servers run on the simplest storage configuration possible (single ext4 partition, no LVM) which has us avoid such issues.

@nobodyman1
Copy link
Author

I tried a fresh installation of RockyLinux 9.3 with ext4 root partition (no LVM), but the error is still there.

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

No branches or pull requests

2 participants