UEFI (ex. MacBook Pro) and memtest86+ Incompatiblity

danielle-mustillo

18 January 2017


I was trying to run a memtest86+ at startup with my MacBook Pro because I suspected there was some issues with the memory module. However, no matter how much I tried, I could not get that option to show up in grub.

Grub Menu Option for MemTest GNU GRUB by heemayl is licensed under CC BY-SA 3.0

If you don’t know what grub is, it is simply a bootloader which is a tiny program that boots a bigger piece of code. This bigger piece of code can be a Unix distro, but may also be memtest86+. The advantage of going through bootloader to do memtest86+ is that a much larger part of RAM is free to be tested (as its not preoccupied with an OS for example). Since the only thing loaded is memtest, we get almost all the ram freely available to be tested.

EFI & memtest86+

After some googling, it turns out that if you have an efi system, which is extremely common these days, then you will by necessity not be able to use memtest86+ at startup. To see why, lets open the following bash file:

vim /etc/grub.d/20_memtest86+

Which you will find this bit of code:

# We need 16-bit boot, which isn't available on EFI.
if [ -d /sys/firmware/efi ]; then
    exit 0
fi

As you can see, since my Macbook Pro is 64bit and has a UEFI, I don’t have backward compatibility with 16bit (whereas a 32bit system would be backward compatible). Even if you removed this bit of code, this test would never work due to the incompatible hardware. So, no memtest86+. This is pretty lousy.

Its worth mentioning at this point that if your computer has a BIOS you should be OK, for example my Acer has no problems doing a memtest86+ and the option is available by default. However, most new computers since the start of the decade come with EFI/UEFI so this sucks.

Solution

I have not really found a solution, I instead did a memory test within my OSX partition for the curious. Until I find a better solution this is the way to go for me!

UPDATE: So a working solution I found was to download memtest86, which is naturally confusingly named almost identically to memtest86+ but developed by a separate team. The free version allows you to do memory tests on UEFI systems, such as the Macbook Pros.

For all those interested, the memtest86 turned up nothing (ie. no issues with my RAM modules) and I still don’t have an idea of why I get random kernel panics on the Macbook Pro I’m servicing. Meh.