In light of memtest86+ not working with UEFI, is there an open source alternative or something I can use from grub to test memory?
-
You might use memory stressers that work inside an OS (e.g. inside Linux, as a userland program & process) – Basile Starynkevitch Apr 24 '18 at 08:26
-
BTW, ten years ago I had a (MSI S270 Turion) laptop with faulty memory: memtest did not detect anything, but kernel compilation failed very often. Replacing the memory modules fixed the issue – Basile Starynkevitch Apr 24 '18 at 08:29
-
2Is this a statement of principle ("must be open source") or a statement of financial necessity ("must be free")? – Chris Davies Apr 24 '18 at 09:00
-
1@roaima the closed-source memtest86 is available for gratis (mentioned in the linked AU post), so I'd say it's a statement of principle (or other necessity such as validating source code) – muru Apr 24 '18 at 15:01
-
It's a fair request for clarification, but yes libre. – Evan Carroll Apr 24 '18 at 15:08
3 Answers
Yes, there is, and it is now Memtest86+ v6 itself. This is a new version of Memtest86+, based on PCMemTest, which is a rewrite of Memtest86+ which can be booted from UEFI. Its authors still label it as not ready for production, but it does work in many configurations.
Binaries of Memtest86+ v6 are available on memtest.org.
Alternatively, the Linux kernel itself contains a memory test tool: the memtest
option will run a memory check with up to 17 patterns (currently). If you add memtest
to your kernel boot parameters, it will run all tests at boot, and reserve any failing addresses so that they’re not used. If you want fewer tests, you can specify the number of patterns (memtest=8
for example).
This isn’t as extensive as Memtest86+’s tests, but it still gives pretty good results.
Some distribution kernels don’t include this feature; you can check whether it’s available by looking for CONFIG_MEMTEST
in your kernel configuration (try /boot/config-$(uname -r)
). The kernel won’t complain if you specify memtest
but it doesn’t support it; when it does run, you should see output like
[ 0.000000] early_memtest: # of tests: 17
[ 0.000000] 0x0000000000010000 - 0x0000000000099000 pattern 4c494e5558726c7a
[ 0.000000] 0x0000000000100000 - 0x0000000003800000 pattern 4c494e5558726c7a
[ 0.000000] 0x000000000500d000 - 0x0000000007fe0000 pattern 4c494e5558726c7a
[ 0.000000] 0x0000000000010000 - 0x0000000000099000 pattern eeeeeeeeeeeeeeee
[ 0.000000] 0x0000000000100000 - 0x0000000003800000 pattern eeeeeeeeeeeeeeee
[ 0.000000] 0x000000000500d000 - 0x0000000007fe0000 pattern eeeeeeeeeeeeeeee
[ 0.000000] 0x0000000000010000 - 0x0000000000099000 pattern dddddddddddddddd
[ 0.000000] 0x0000000000100000 - 0x0000000003800000 pattern dddddddddddddddd
[ 0.000000] 0x000000000500d000 - 0x0000000007fe0000 pattern dddddddddddddddd
[ 0.000000] 0x0000000000010000 - 0x0000000000099000 pattern bbbbbbbbbbbbbbbb
[ 0.000000] 0x0000000000100000 - 0x0000000003800000 pattern bbbbbbbbbbbbbbbb
...
while the kernel boots (or in its boot logs, later).
You can use QEMU to get a feel for this:
qemu-system-x86_64 -kernel /boot/vmlinuz-$(uname -r) -append "memtest console=ttyS0" -nographic
(or whichever qemu-system-...
is appropriate for your architecture), and look for “early_memtest”. To exit QEMU after the kernel panics, press Ctrla, c, q, Enter.

- 434,908
You can add the freeware (free beer) version of the latest memtest86 into UEFI Grub2 on Ubuntu.
Based on a tutorial, I took the following steps on a remote Ubuntu 16.04 server to add memtest86 to UEFI Grub2:
Firstly, note that grub2 does not show memtest86 nor memtest86+:
This is despite the fact my boot folder clearly has memtest86+. See image below.
Download memtest86-usb.zip to laptop
Send the zip file to the remote machine, then unzip it somewhere (e.g.
/home/<username>/memtest86-usb/
)We need to analyze memtest86-usb.img using
fdisk -lu memtest86-usb.img
to see it's mount offset.We want to mount the second device listed in the above output,
memtest86-usb.img2
. The above image shows each sector is 512 Bytes, andmemtest86-usb.img2
starts at sector 514048. Therefore it starts at 514048*512 Bytes=263192576 Bytes.Create a folder (e.g.
/home/<username/memtest-tmp
) and mount it:mkdir /home/<username>/memtest-tmp sudo mount -o loop,offset=263192576 /home/<username>/memtest86-usb/memtest86-usb.img
Use lsblk to check details about the EFI partition as well as your mounted .img file
In the above picture, we note the following:
- Where the EFI partition is mounted, here it's at
/boot/efi
.- Note, in my server, I have the option of choosing the boot mode to be
legacy
orUEFI
in the BIOS setup. I had previously set it tolegacy
and thus the/boot/efi
folder did not exist. Changing the boot mode toUEFI
allowed me to see the/boot/efi
folder and verify that the EFI partition is mounted there.
- Note, in my server, I have the option of choosing the boot mode to be
- The device number. Device name is sda1; thus it's the letter a. This is important later.
- The partition number. Device name is sda1; thus it's partition 1. This is important for later
- As a sanity check, we also note that memtest86-usb.img2 was mounted to
/home/<username>/memtest-tmp
.
- Where the EFI partition is mounted, here it's at
Next, we verify that the mount point contains an
EFI/BOOT
folder` and view its contents:Next, we simultaneously copy and rename
/home/<username>/memtest-tmp/EFI/BOOT
to/boot/efi/EFI/memtest86
(assuming the target folder/boot/efit/EFI/memtest86
):Next we create a GRUB chainloader entry. Create a file /etc/grub.d/42_memtest, with contents similar to the following:
#!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above.
menuentry 'memtest86' { insmod part_gpt insmod fat set root='hd0,gpt1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1 4418-37D3 else search --no-floppy --fs-uuid --set=root 4418-37D3 fi chainloader /EFI/memtest86/BOOTX64.efi}
In the above picture, we did
set root='hd0,gtp1
, because our EFI partion was noted as device name = sda1. According to the grub2 convention...- The a in sda corresponds to the 0 in hd0
- The 1 in sda1 corresponds to the 1 in gtp1.
- We can use the gpt* format to specify partition 1 of device sda because we did
insmod part_gpt
. We can recognize the disk label type as gpt using thefdisk -l
command, and also from looking at the/boot/grub/grub.cfg
file.
Also note that we used the EFI partition's UUID, which can be obtained from the
blkid
command which shows the UUID of all partitions on your machine.We update grub2 with
update-grub2
.

- 2,510

- 149
-
1Please outline the complete steps described in the tutorial. Keep the tutorial link as reference. You do not need to include the screenshots. – Nils Feb 04 '21 at 21:02
-
1Note that the OP was already aware of memtest86, but was asking for a FLOSS solution. – Stephen Kitt Feb 04 '21 at 21:20
-
2A now-deleted answer suggests that "the file
/etc/grub.d/42_memtest
needs to be made executable". I cannot test this at the moment, so I'll leave it here for consideration. – Jeff Schaller Feb 07 '22 at 15:18 -
The commands after
set root='hd0,gpt1'
find the filesystem with UUID 4418-37D3 and set$root
to point to it. So the set command effectively does nothing and can be removed. Changing it to another disk will just be ignored. The grub.cfg probably already finds the EFI partition and sets $boot to it. Sochainloader ($boot)/EFI/memtest86/BOOTX64.efi
would work with needing to find the partition a second time. – TrentP Jan 05 '23 at 12:45
Memtest 6 should work with uefi. A beta is available at memtest.org
code is available at https://github.com/memtest86plus/memtest86plus
Memtest86+ v6.00 Beta 2 Released: 2022-06-03 v6 is NOT READY for production yet! Please consider the actual code as experimental and expect crashes and freezes. First non-beta release is expected this summer.
Even though it is beta, I tried it out, downloaded the iso, dd'ed it to a usb stick and could boot it from uefi and it ran memtest just like I'm used to.

- 391