Error: Can't allocate initrd

I’m trying to pxe-boot a brand new HP Zbook G8 in EFI mode with secure boot disabled using the latest foreman discovery image(4.0.3) but I’m getting an error message saying Error: Can’t allocate initrd. An earlier version of the discovery image boots just fine, but lacks the necessary network drivers.

Hey @scarygary

Welcome to the community. For the best chance of someone helping you, please use the template provided below.
I think you selected the dev label, so it might not have populated, but this looks like more of a support question for now. We’ll see what dev is needed once we get to the bottom of it :wink:

Problem:

Expected outcome:

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

Problem: Unable to boot the latest version of the foreman discovery image on a brand new HP Zbook G8.
Expected outcome: Booting and running the discovery to report back to the foreman server.
Foreman version 3.1.1 and the smart proxy is running on the same host.
The server is running Ubuntu 20.04.
What versions are running on the host is not really relevant though. The computer picks up the image via tftp and then fails to boot with the error message in my first post. It works just fine on older laptops. In EFI as well as in BIOS mode.
The discovery image is the latest one released, 4.0.3.

To clarify, version 3.8 of the discovery image boots just fine, but lacks support for the revision of the network adapter in the HP Zbook G8. What are my options?

Hey, I haven’t seen that one, can you create a picture of the screen?

Are you able to download FDI.ISO and try to boot that manually mounted via USB stick or something like that?

If i download http://downloads.theforeman.org/discovery/releases/4.0/fdi-4.0.3-a86d8b3.iso and put it on a usb-stick, it boots just fine. Not via pxe though. Then it looks like this:
https://drive.google.com/file/d/1YGRA1u05DWunidUdaUwsumLgNAeEbtSs/view?usp=sharing

Any idea what’s going on?

This looks like a bug in grub that made it into RHEL7:

https://bugzilla.redhat.com/show_bug.cgi?id=1572126

Please download grubx64.efi from Fedora Rawhide (the newest build) and replace the file on your TFTP/HTTP BOOT server and try again. You will have to extract the bootloader from grub2-efi RPM package. Or you can download already extracted version from 2021:

https://people.redhat.com/~lzapleta/grub/grub2-efi-x64-2.04-35.fc34.x86_64/

1 Like

New error message after replacing grubx64.efi.

I am afraid you have to create BZ for Fedora, ideally with a reproducer with Fedora (the FDI image is CentOS8 based). You could create such test by converting Fedora LiveCD to PXE and booting that. Or you can reach out to Grub developers too on their mailing list.

There is nothing I can do here, this is very likely a bug in the bootloader. FDI boots fine on other hardware and in VMs.

Workaround: Use iPXE instead.

1 Like

Hi, I had the same issue. I solved it by using the efi from RockyLinux: Index of /pub/rocky/8/BaseOS/x86_64/kickstart/EFI/BOOT/
works for me. :wink:

1 Like

Hi, we also observed this behavior on a HP ProBook 450 G8 laptop with FDI v4.1.0.

With the default GRUB2 from CentOS7 (v2.02) we also got “can’t allocate initrd”, with a more recent version of GRUB2 (v2.06, Ubuntu) we got “out of memory”. Booting Ubuntu 20.04 kernel+initrd worked with both.

According to Bug #1970402 “Initrd out of memory error after upgrade to 22.04” : Bugs : initramfs-tools package : Ubuntu it looks like initrd is too big and GRUB2 does not allocate enough space for it. The size of the initrd is that big (~500M) because it contains the roofs.

As workaround could be to use rootfs-less initrd and load rootfs separately from webserver:

# wget https://downloads.theforeman.org/discovery/releases/latest/fdi-4.1.0-24d62de.iso
# mount fdi-4.1.0-24d62de.iso /mnt/
# mkdir /var/lib/tftpboot/boot/fdi-image-slim
# cp /mnt/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/boot/fdi-image-slim/
# umount /mnt
# mkdir /var/www/html/pub/fdi-image-slim
# cp fdi-4.1.0-24d62de.iso /var/www/html/pub/fdi-image-slim
# ln -sr /var/www/html/pub/fdi-image-slim/fdi-4.1.0-24d62de.iso /var/www/html/pub/fdi-image-slim/fdi.iso
# cat >> /var/lib/tftpboot/grub2/grub.cfg <<'EOF'
common_slim="rootflags=loop root=live:http://<foreman-fqdn>/pub/fdi-image-slim/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nokaslr nomodeset proxy.url=https://<foreman-fqdn> proxy.type=foreman BOOTIF=01-$net_default_mac ip=dhcp"

menuentry 'Foreman Discovery Image EFI Slim' --id discovery {
  linuxefi boot/fdi-image-slim/vmlinuz ${common_slim}
  initrdefi boot/fdi-image-slim/initrd.img
}
EOF

Replace <foreman-fqdn> accordingly. ISO can only be fetched via HTTP (missing CA in the initrd). The parameter ip=dhcp is mandatory to bring up network for fetching the ISO. The plain initrd has a size of ~43M which looks promising.

I can confirm that this worked for HP ProBook 450 G8 laptop with FDI v4.1.0 and the default CentOS7 GRUB2 v2.02.

Finally got around to testing this. Fdi 4.1.0 doesn’t work with HP Zbook G7 och G8. Kernel panic. 4.0.3 works just fine though. Nice workaround.