JasonN3 / build-container-installer

Creates an ISO for installing a container image as an OS
GNU General Public License v3.0
64 stars 9 forks source link

[BUG] Building ISO with `ARCH=aarch64` failing because of missing grub package #141

Open ColorfulRhino opened 1 month ago

ColorfulRhino commented 1 month ago

Describe the bug Trying to build an ISO for ARM64/aarch64 fails with the following error message:

...
2024-09-30 16:46:44,956: installpkg grub2-efi-aa64-cdboot>=1:2.06-67 failed: no package matched grub2-efi-aa64-cdboot>=1:2.06-67
2024-09-30 16:46:44,956: template command error in runtime-install.tmpl:
2024-09-30 16:46:44,956:   installpkg grub2-efi-aa64-cdboot>=1:2.06-67
2024-09-30 16:46:44,968:   RuntimeError: Required installpkg failed.
Traceback (most recent call last):
  File "/usr/sbin/lorax", line 211, in <module>
    main()
  File "/usr/sbin/lorax", line 192, in main
    lorax.run(dnfbase, opts.product, opts.version, opts.release,
  File "/usr/lib/python3.12/site-packages/pylorax/__init__.py", line 306, in run
    rb.install()
  File "/usr/lib/python3.12/site-packages/pylorax/treebuilder.py", line 152, in install
    self._runner.run("runtime-install.tmpl")
  File "/usr/lib/python3.12/site-packages/pylorax/ltmpl.py", line 154, in run
    self._run(commands)
  File "/usr/lib/python3.12/site-packages/pylorax/ltmpl.py", line 173, in _run
    f(*args)
  File "/usr/lib/python3.12/site-packages/pylorax/ltmpl.py", line 357, in installpkg
    raise RuntimeError("Required installpkg failed.")
RuntimeError: Required installpkg failed.
2024-09-30 16:46:44,978: Cleaning up tempdir - /var/tmp/lorax/lorax.isb3qbar
make: *** [Makefile:112: results/images/boot.iso] Error 1

To Reproduce podman run --rm --privileged --volume .:/build-container-installer/build ghcr.io/jasonn3/build-container-installer:latest VERSION=40 IMAGE_NAME=base IMAGE_TAG=40 VARIANT=Server ARCH=aarch64

Expected behavior ISO build should not fail since using the ARCH argument is supported and mentioned in the docs.

Additional context

The root issue seems to be here: https://github.com/weldr/lorax/blob/ab611dfa81cd23a9e842dc8668e08e1f113f312d/share/templates.d/99-generic/runtime-install.tmpl#L69-L75

Not sure if this issue is better fixed upstream, but to detect such issues I believe it would be nice to expand the automated test matrix to test ARCH=aarch64 as well in addition to x86_64.

Full run:

podman run --rm --privileged --volume .:/build-container-installer/build  ghcr.io/jasonn3/build-container-installer:latest VERSION=40 IMAGE_NAME=base IMAGE_TAG=40 VARIANT=Server ARCH=aarch64

+ mknod -m 0660 /dev/loop0 b 7 0
+ true
+ [[ -d /cache/skopeo ]]
+ [[ ! -d /cache/dnf ]]
+ mkdir /cache/dnf
+ make VERSION=40 IMAGE_NAME=base IMAGE_TAG=40 VARIANT=Server ARCH=aarch64
make -w -C external lorax/branch-40
make[1]: Entering directory '/build-container-installer/external'
git config advice.detachedHead false
cd lorax && git reset --hard HEAD && git checkout tags/lorax-40.5.5-1
HEAD is now at ffba3078 Add prefixdevname support to the boot.iso
Previous HEAD position was ffba3078 Add prefixdevname support to the boot.iso
HEAD is now at c8aa45de Automatic commit of package [lorax] release [40.5.5-1].
touch lorax/branch-40
make[1]: Leaving directory '/build-container-installer/external'
make -w -C lorax_templates post_install_configure_upgrades.tmpl
make[1]: Entering directory '/build-container-installer/lorax_templates'
header=0; skip=0; while read -r line; do if [[ $line =~ ^\<\% ]]; then if [[ 'true' == 'true' ]]; then echo $line >> post_install_configure_upgrades.tmpl; fi; echo >> post_install_configure_upgrades.tmpl; else if [[ $header == 0 ]]; then if [[ $line =~ ^\#\#\ (.*)$ ]]; then echo "append usr/share/anaconda/post-scripts/install_configure_upgrades.ks \"%post --erroronfail ${BASH_REMATCH[1]}\"" >> post_install_configure_upgrades.tmpl; skip=1; else echo "append usr/share/anaconda/post-scripts/install_configure_upgrades.ks \"%post --erroronfail\"" >> post_install_configure_upgrades.tmpl; fi; header=1; fi; if [[ $skip == 0 ]]; then echo "append usr/share/anaconda/post-scripts/install_configure_upgrades.ks \"${line//\"/\\\"}\"" >> post_install_configure_upgrades.tmpl; fi; skip=0; fi; done < scripts/post/install_configure_upgrades; echo "append usr/share/anaconda/post-scripts/install_configure_upgrades.ks \"%end\"" >> post_install_configure_upgrades.tmpl
make[1]: Leaving directory '/build-container-installer/lorax_templates'
make -w -C repos fedora-cisco-openh264.repo
make[1]: Entering directory '/build-container-installer/repos'
cp /etc/yum.repos.d/fedora-cisco-openh264.repo           fedora-cisco-openh264.repo
sed -i "s/\$releasever/40/g" fedora-cisco-openh264.repo
sed -i "s/\$basearch/aarch64/g"      fedora-cisco-openh264.repo
make[1]: Leaving directory '/build-container-installer/repos'
make -w -C repos fedora-updates-testing.repo
make[1]: Entering directory '/build-container-installer/repos'
cp /etc/yum.repos.d/fedora-updates-testing.repo           fedora-updates-testing.repo
sed -i "s/\$releasever/40/g" fedora-updates-testing.repo
sed -i "s/\$basearch/aarch64/g"      fedora-updates-testing.repo
make[1]: Leaving directory '/build-container-installer/repos'
make -w -C repos fedora-updates.repo
make[1]: Entering directory '/build-container-installer/repos'
cp /etc/yum.repos.d/fedora-updates.repo           fedora-updates.repo
sed -i "s/\$releasever/40/g" fedora-updates.repo
sed -i "s/\$basearch/aarch64/g"      fedora-updates.repo
make[1]: Leaving directory '/build-container-installer/repos'
make -w -C repos fedora.repo
make[1]: Entering directory '/build-container-installer/repos'
cp /etc/yum.repos.d/fedora.repo           fedora.repo
sed -i "s/\$releasever/40/g" fedora.repo
sed -i "s/\$basearch/aarch64/g"      fedora.repo
make[1]: Leaving directory '/build-container-installer/repos'
mv /etc/rpm/macros.image-language-conf /tmp/tmp.wl1KaSVtUL/macros.image-language-conf
lorax -p base -v 40 -r 40 -t Server \
        --isfinal --buildarch=aarch64 --volid=base-aarch64-40 --sharedir /build-container-installer/external/lorax/share/templates.d/99-generic \
        --macboot --noupgrade --squashfs-only \
        --repo /build-container-installer/repos/fedora-cisco-openh264.repo --repo /build-container-installer/repos/fedora-updates-testing.repo --repo /build-container-installer/repos/fedora-updates.repo --repo /build-container-installer/repos/fedora.repo \
        --add-template /build-container-installer/lorax_templates/install_set_installer.tmpl --add-template /build-container-installer/lorax_templates/post_install_configure_upgrades.tmpl \
         \
         \
         \
        --rootfs-size 4 \
        --add-template-var "arch=aarch64" --add-template-var "image_name=base" --add-template-var "image_repo=quay.io/fedora-ostree-desktops" --add-template-var "_image_repo_double_escaped=quay.io\\\/fedora-ostree-desktops" --add-template-var "_image_repo_escaped=quay.io\/fedora-ostree-desktops" --add-template-var "image_signed=true" --add-template-var "image_tag=40" --add-template-var "repos=/etc/yum.repos.d/fedora-cisco-openh264.repo /etc/yum.repos.d/fedora-updates-testing.repo /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora.repo" --add-template-var "_rhel=" --add-template-var "variant=Server" --add-template-var "version=40" --add-template-var "web_ui=false" \
        results/
2024-09-30 16:45:24,281: selinux is Disabled
2024-09-30 16:45:24,283: Using platform:f40 for module_platform_id
2024-09-30 16:45:24,286: Using repos: fedora-cisco-openh264, fedora, updates
2024-09-30 16:45:24,286: Fetching metadata...
2024-09-30 16:46:34,267: selinux is Disabled
2024-09-30 16:46:34,267: checking for root privileges
2024-09-30 16:46:34,267: checking dnf base object
2024-09-30 16:46:34,267: setting up build architecture
2024-09-30 16:46:34,267: setting up build parameters
2024-09-30 16:46:34,268: Using templatedir /build-container-installer/external/lorax/share/templates.d/99-generic
2024-09-30 16:46:44,887: got release: fedora-release-server
2024-09-30 16:46:44,887: installing runtime packages
2024-09-30 16:46:44,911: running runtime-install.tmpl
2024-09-30 16:46:44,919: installpkg: *-firmware expands to atmel-firmware-1.3-32.fc40.noarch,zd1211-firmware-1.5-15.fc40.noarch,amd-gpu-firmware-20240909-1.fc40.noarch,amd-ucode-firmware-20240909-1.fc40.noarch,atheros-firmware-20240909-1.fc40.noarch,bcm2711-firmware-20240723-1.8d5579c.fc40.aarch64,bcm2835-firmware-20240723-1.8d5579c.fc40.aarch64,bcm283x-firmware-20240723-1.8d5579c.fc40.aarch64,brcmfmac-firmware-20240909-1.fc40.noarch,intel-gpu-firmware-20240909-1.fc40.noarch,iwlegacy-firmware-20240909-1.fc40.noarch,iwlwifi-dvm-firmware-20240909-1.fc40.noarch,iwlwifi-mvm-firmware-20240909-1.fc40.noarch,libertas-firmware-20240909-1.fc40.noarch,linux-firmware-20240909-1.fc40.noarch,mt7xxx-firmware-20240909-1.fc40.noarch,nvidia-gpu-firmware-20240909-1.fc40.noarch,nxpwireless-firmware-20240909-1.fc40.noarch,qed-firmware-20240909-1.fc40.noarch,realtek-firmware-20240909-1.fc40.noarch,tiwilink-firmware-20240909-1.fc40.noarch
2024-09-30 16:46:44,956: installpkg grub2-efi-aa64-cdboot>=1:2.06-67 failed: no package matched grub2-efi-aa64-cdboot>=1:2.06-67
2024-09-30 16:46:44,956: template command error in runtime-install.tmpl:
2024-09-30 16:46:44,956:   installpkg grub2-efi-aa64-cdboot>=1:2.06-67
2024-09-30 16:46:44,968:   RuntimeError: Required installpkg failed.
Traceback (most recent call last):
  File "/usr/sbin/lorax", line 211, in <module>
    main()
  File "/usr/sbin/lorax", line 192, in main
    lorax.run(dnfbase, opts.product, opts.version, opts.release,
  File "/usr/lib/python3.12/site-packages/pylorax/__init__.py", line 306, in run
    rb.install()
  File "/usr/lib/python3.12/site-packages/pylorax/treebuilder.py", line 152, in install
    self._runner.run("runtime-install.tmpl")
  File "/usr/lib/python3.12/site-packages/pylorax/ltmpl.py", line 154, in run
    self._run(commands)
  File "/usr/lib/python3.12/site-packages/pylorax/ltmpl.py", line 173, in _run
    f(*args)
  File "/usr/lib/python3.12/site-packages/pylorax/ltmpl.py", line 357, in installpkg
    raise RuntimeError("Required installpkg failed.")
RuntimeError: Required installpkg failed.
2024-09-30 16:46:44,978: Cleaning up tempdir - /var/tmp/lorax/lorax.isb3qbar
make: *** [Makefile:112: results/images/boot.iso] Error 1