Bug 2223883 - Error when loading large initrd (~1 GiB) on UEFI: out of memory
Summary: Error when loading large initrd (~1 GiB) on UEFI: out of memory
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: grub2
Version: 9.2
Hardware: x86_64
OS: Linux
urgent
high
Target Milestone: rc
: ---
Assignee: Bootloader engineering team
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-19 07:46 UTC by Juan Hernández
Modified: 2023-08-08 12:34 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-162685 0 None None None 2023-07-19 07:49:27 UTC

Description Juan Hernández 2023-07-19 07:46:35 UTC
Description of problem:

When we try to load a large initrd (~1 GiB) on UEFI with TPM disabled grub fails to load and prints a "out of memory" message.

Version-Release number of selected component (if applicable):

grub2-common-2.06-61.el9.noarch

How reproducible:

It always reproduces in the bare metal machine that we are using

  Model: Dell PowerEdge R340
  BIOS Version: 2.3.5
  iDRAC Firmware Version: 4.22.00.53

Steps to Reproduce:

1. Prepare a boot entry like this:

  set timeout=10
  set default=0
  menuentry 'Agent-Based Installer' {
    search --set=root --label agentboot
    load_video
    set gfx_payload=keep
    insmod gzio
    linux /images/pxeboot/vmlinuz random.trust_cpu=on console=tty0 console=ttyS0,115200n8 ignition.firstboot ignition.platform.id=metal ro
    initrd /images/pxeboot/initrd.img /images/ignition.img /images/pxeboot/rootfs.img
  }

What is most relevant of this boot entry is the size of the initrd files, specially the rootfs:

  # ls -lh pxeboot/initrd.img ignition.img pxeboot/rootfs.img 
  -r--r--r--. 1 root root 256K May  2 20:15 ignition.img
  -r--r--r--. 1 root root  81M May  2 20:20 pxeboot/initrd.img
  -r--r--r--. 1 root root 952M May  2 20:20 pxeboot/rootfs.img

Total size is approximately 1 GiB.

2. Ensure that TPM is enabled in the BIOS.

3. Boot the machine.

Actual results:

Grub fails with the following error message:

  error: ../../grub-core/kern/mm.c:552:out of memory.
  Press any key to continue...

After that the kernel is started anyhow, but it fails to locate the root filesystem and panics.

Expected results:

The initrd should be loaded and the machine should boot correctly.

Additional info:

We found that the issue is related to having TPM enabled. We applied the following patch to grub2-common-2.06-61.el9.noarch:

  https://github.com/rhboot/grub2/commit/b09440df05755c665cac9b93dd654e661c655c38

Then we rebuilt the RPM used the resulting grubx64.efi. With that the boot still fails in the same way. But it does work if we also disable TPM.

So the workaround is to disable TPM *and* apply the patch.

We would like to be able to boot with TPM enabled or disabled.

Comment 1 Marta Lewandowska 2023-08-08 12:34:47 UTC
Thanks for the patch, and thank you for your patience. :)


Note You need to log in before you can comment on or make changes to this bug.