Maybe you have been in the need to use a memtester like
memtest86+. Maybe to test Ram-Overclocking (like XMP/DOCP), stability (like „more than 2 sticks of ram on AMD AM5“), because you suspect a faulty stick, or just as burn-in-test. Maybe you also realized, that memtest86+ – for the longest time – only supports booting in legacy CSM-Mode (aka. „legacy BIOS“). While this isn’t a big deal, when you have memtest on a bootable stick on a Board with CSM-Support (which is still true for most mainboards), it can be a challenge, when the Mainboard is (U)EFI-Only, when you try to add a boot-entry from a running Linux-System, or when having no physical access, like on Servers, when you are using the respective Out-Of-Band-Management-System. Or maybe, you just want to have memtest on hand, because you regularily have the need to run it for whatever reason.
Whatever the reason may be: It would be helpful to be able to EFI-Boot memtest86+. Guess what, the current Version 6.10 supports booting via EFI, just the old outdated packages of your distro most likely don’t. However, it is not that complicated, to add the entries manually:
Note: As a prerequisite you – of course – should have made absolutely sure, that you are booted in an EFI-Environment.
Here’s how it works:
1: Get memtest, extract it and copy it to the ESP-Partition
$ wget https://www.memtest.org/download/v6.10/mt86plus_6.10_64.iso.zip
$ unzip mt86plus_6.10_64.iso.zip
$ mkdir /boot/EFI/efi/memtest
$ cp memtest64.efi /boot/efi/EFI/memtest/
2: Make a new boot-Entry
# find out, on which partiton EFI actually is:
df -lh /boot/efi
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 511M 6.1M 505M 2% /boot/efi
blkid | grep vfat
/dev/sda1: UUID="1234-5678" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="12345678-9012-3456-7890-123456789012"
# create bootable EFI-entry (note the windows-style escaped path-notation):
$ efibootmgr --create --disk /dev/sda --part 1 --label "memtest86+ - x86_64" --loader \\EFI\\memtest\\memtest64.efi
# verify (especially the path and partition!)
$ efibootmgr -v
Boot0000* Integrated NIC 1 Port 1 Partition 1 VenHw(98765432-1098-7654-3210-987654321098)
Boot0001* memtest86+ - x86_64 HD(1,GPT,12345678-9012-3456-7890-123456789012,0x800,0x64000)/File(\EFI\memtest\memtest64.efi)
Boot0002* Red Hat Enterprise Linux HD(1,GPT,12345678-9012-3456-7890-123456789012,0x800,0x64000)/File(\EFI\redhat\shimx64.efi)
# Set next boot (one-time configuration):
$ efibootmgr --bootnext 0001
# Due to new entries, your boot-ordering may have been messed up, so set a new one if needed:
$ efibootmgr -o 0002,0001,0000
# And verify again...
Boot0000* Integrated NIC 1 Port 1 Partition 1
Boot0001* memtest86+ - x86_64
Boot0002* Red Hat Enterprise Linux
…Now reboot. The EFI should guide you directly to memtest86+. If not, you most likely have messed up the target path or partition, just adjust as needed in a second try. To remove entries, that are not needed anymore, just use something like
efibootmgr -b 0001 -B (but it really does not hurt to have memtest86+ at hand permanentely).
The above example has been tested on a Red Hat Enterprise Linux 7.9, but should be adaptable to most other distros as well. On some distros with newer Software (like Arch) this will be most likely not needed anymore. Besides that, if you have the need to do memtests often on various PCs, it may be easier to archieve the same goal with netboot-environments, but you have to tweak your DHCP-Server to archieve this.