Skip to content

Instantly share code, notes, and snippets.

@jorritfolmer
Last active May 4, 2024 12:39
Show Gist options
  • Save jorritfolmer/a266f6cc772fef01285adf493ced32bd to your computer and use it in GitHub Desktop.
Save jorritfolmer/a266f6cc772fef01285adf493ced32bd to your computer and use it in GitHub Desktop.
Adding memtest86+ v7 to Red Hat Enterprise Linux 9 Grub2 UEFI menu

How to add memtest86+ to the UEFI grub2 boot menu in Red Hat Enterprise Linux 9

The two methods below can be used to boot Memtest86+ from the grub2 boot loader on Red Hat Enterprise Linux 9. This is convenient when a system is located in a datacenter instead of on your desk, and has a remote console like e.g. iLO. Unfortunately the most recent Memtest86+ v7 cannot currently detect correctable ECC errors, so the only hint is very low performance in the memtest interface like the elapsed timer not updating every second. In that case EDAC errors filling up /var/log/messages are a more reliable indicator.

Using the EFI filesystem and a /etc/grub.d config file

  1. Download the Binary Files (.bin/.efi) from https://www.memtest.org
  2. Create a new directory /boot/efi/EFI/tools/
  3. Put memtest64.efi in /boot/efi/EFI/tools/
  4. Create /etc/grub.d/20_memtest64 with the following content:
    #!/usr/bin/sh
    cat << 'EOF'
    menuentry "Memtest86+ v7.00 EFI" {
        insmod part_gpt
        insmod search_fs_uuid
        insmod chain
        search --no-floppy --set=root --file /EFI/tools/memtest64.efi
        chainloader (${root})/EFI/tools/memtest64.efi
    }
    EOF
    
    Note: the single quotes around EOF in the first line make sure that ${root} isn't inadvertently expanded by the shell but included as-is.
  5. Update the EFI grub2 config file using grub2-mkconfig --update-bls-cmdline -o /boot/efi/EFI/redhat/grub.cfg

Using a Boot Loader Specification (BLS) file

  1. Download the Binary Files (.bin/.efi) from https://www.memtest.org
  2. Put memtest64.efi in /boot
  3. Create /boot/loader/entries/memtest64.conf with the following content:
    title Memtest86+ v7.00 BLS
    version 1
    linux /memtest64.efi
    
  4. Updating grub isn't necessary in this case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment