# memtest86plus-5 doesn't work... with grub legacy?

## eccerr0r

I did see https://forums.gentoo.org/viewtopic-t-1103284-highlight-memtest86plus.html but it didn't seem to help.  But anyway...

I have two general setups, one uses grub2 and other uses grub legacy.  Memtest86+-5 seems to crash and reboot instantly when I use kernel memtest.bin and boot in grub-legacy (and memtest (without .bin) complains that it's of the wrong file format).

On the grub2 machine, linux16 memtest.bin seems to work fine.

Anyone still have a grub-legacy setup and have memtest86plus-5 working?  Might have to migrate the rest of my legacy machines to grub2...

All machines are 64-bit multilib boxes, and I tried copying the binary from the grub2 machine to the grub-legacy machine and it seems to likewise fail...  I also found an old memtest86plus-4 binary which seems to work just fine under grub-legacy, so something to do with how memtest86+-5 is built ? ...

----------

## tholin

I have an old laptop with grub legacy and have also noticed that memtest86+ doesn't work anymore.

My grub legacy entry for memtest86+ looks like this:

```
title Memtest86Plus

    root (hd0,0)

    kernel /boot/memtest86plus/memtest
```

Some old leftover grub1 folders on other systems also look the same so booting the memtest (no .bin) used to work. The memtest.bin is a MBR boot sector executable and memtest is ELF.

Legacy grub has a bunch of heuristics for detecting what type of kernel you are feeding it. I assume that heuristics is broken with recent memtest86+ versions and you only get a wrong file format message.

An old post install elog message used to recommend this line for legacy grub: "kernel --type=netbsd /boot/memtest86plus/memtest.netbsd"

memtest.netbsd was just a copy of the ELF file so the heuristics was suppose to detect it as netbsd kernel.

----------

## eccerr0r

Looks like the above link may need to be applied and the netbsd-ELF version used for grub legacy?  I was able to seem to get the netbsd-elf version to somewhat do something but even after with the patch it still seems to hang.

Sigh... such is trying to maintain old setups.  Have to upgrade to grub2 ... ?

----------

## eccerr0r

Woah... now what the heck.

My i7 and i5 both do crap with memtest86+5 in x64 mode.  The i7 reports tons of bad RAM everywhere, some RAM not even written at all.  My i5 simply reboots when partly into a test.

Both seem to run Linux solid and can build software just fine without crashing despite the memtest86+ issues.  Plus I have another copy of memtest86+5 that was built on a 32-bit setup, and it seems to pass on the i7.

Dang, seems that there are stealth configuration everywhere or something, computer status is not consistent.  Ugh, memory technology is hiding so much nowadays it seems.  Soon bad RAM will be an OS automatically managed construct... I mean, what is NVMe doing with its bad blocks?

----------

## APolozov

This memtest86+-5.01-r5 in the Gentoo is too old and  have some bugs with new CPUs and big (more 4GB) RAM.

Latest version memtest86+ is 5.31b, relised in april 2020 after coronalockdown, that version have some fixes.

I use this version on my working flash drive and everything is OK, It remains to implement the new version in Gentoo.

----------

## eccerr0r

I think the memtest86+-5.01-r5 is actually being compiled incorrectly in Gentoo.  There's an outstanding bug on this - after applying the patch my x86-64 machines start to work fine again.

However these may be two separate issues as the problem appears to manifest at two different places.  The  issue I was initially detailing here, I wouldn't even get a report of the memory in the machine, their speeds, etc.  The bug report indicated above, these machines I would at least get the machines to detect the RAM in the machines and report their speeds before crashing or having other undesirable behavior.

---

And I think I found the bug I was initially seeing - may be related to yet another outstanding bug that was not ported to memtest86+-5 and thus require a bootloader update ...  Ahhhh....actually...code bloat....

Alas after testing the proposed fix, it still doesn't work.  Something funny going on, need to test a build made from a 32-bit machine to see if it works... which is a bit weird, how would a 32-bit machine build 64-bit code without an x-compiler...

----------

## mike155

sys-apps/memtest86+-5.31b has been added to the Portage tree (see: https://bugs.gentoo.org/728766). 

Let's test if that version works. We should also test whether the installation instructions, which are printed at the end of  'emerge --oneshot sys-apps/memtest86+', are still useful:

```
 * memtest86+ has been installed in /boot/memtest86plus/

 * You may wish to update your bootloader configs by adding these lines:

 *  - For grub2 just run grub-mkconfig, a configuration file is installed

 *    as /etc/grub.d/39_memtest86+

 *  - For grub legacy: (replace '?' with correct numbers for your boot partition)

 *     > title=memtest86+

 *     > root (hd?,?)

 *     > kernel /boot/memtest86plus/memtest.bin

 *  - For lilo:

 *     > image  = /boot/memtest86plus/memtest.bin

 *     > label  = memtest86+

 * 

 * Note: For older configs, you might have to change from 'memtest' to 'memtest.bin'.
```

----------

## eccerr0r

5.31b still fails on grub-legacy, both straight and netbsd elf boot.  Anyone still using lilo? syslinux? Do they work?

However memory test passes on my i7 now instead of barfing everywhere (grub2).

Runs fine on my Atom and Pentium-M (but the Pentium-M fails to detect chipset or RAM information including speed) using grub2.

TBH the post-install comment about grub-legacy in the ebuild should be deleted since I've yet to hear anyone who got it working on it...

----------

## Tony0945

There is both a memtest and a memtest.bin in that directory. What's the difference?

----------

## eccerr0r

One is MBR (memtest.bin) and the other is ELF (no extension, for netbsd boot).  Neither work with grub-legacy.

They crossed names in the past making it even more confusing.  Older installs had memtest (no extension, MBR) and memtest.netbsd (ELF) ... or something like that.  And the old version, usually at least one or the other will work under grub-legacy.

----------

## mike155

```
# file memtest*

memtest86+/memtest:              ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped

memtest86+/memtest.bin:          DOS/MBR boot sector

memtest86+/memtest.iso:          ISO 9660 CD-ROM filesystem data 'MT531' (bootable)

memtest86-bin/memtest86-bin.efi: MS-DOS executable PE32+ executable (DLL) (EFI application) x86-64, for MS Windows
```

----------

## Tony0945

If we burn the iso does it work?

----------

## eccerr0r

I think the Gentoo-built 5.01 will not work if you have latest gcc; the 5.31b one may...

----------

## Tony0945

Tried to boot grub-legacy with:

```
title=MEMTEST86+

root (hd0,0)

kernel /boot/memtest86plus/memtest.bin vga=0x346 rootfstype=ext4 root=/dev/sda1 net.ifnames=0
```

It does indeed fail with "Error 28: selected item does not fit in memory".  Since the size is 179K this leaves me perplexed.

I'll unmasked the unstable and try again.

----------

## eccerr0r

Interesting, I probably have a different grub-legacy installed but the one I have loads and hangs/crashes/reboots right away.  Might have a version previous to the one that can detect the "oom" situation....

----------

## Tony0945

grub 0.97-r14

Tried it without the extra stuff on the line and same problem.

Burnt a CD and booted it with F!2.  Took 34 minutes to check 8GB, no errors.   

That's not much help for those that don't have a CD/DVD drive any longer.

----------

## eccerr0r

Yeah sad I have one computer without an optical drive and also will hang POST if you have a USB-storage plugged in...

Talk about unlucky machine...

----------

## mike155

I switched to UEFI boot on my brand new AMD 5700G machine. I installed sys-apps/memtest86-bin and I'm able to boot this version of Memtest86:

I ran "emerge sys-apps/memtest86-bin"

I copied the binary to /boot/EFI/Memtest86/memtest86-bin.efi

I added an entry to the UEFI boot manager using efibootmgr:

```
# efibootmgr -d /dev/nvme0n1 -c -L "Memtest86" -l '\EFI\Memtest86\memtest86-bin.efi'
```

Below is the UEFI boot manager configuration:

```
# efibootmgr -d /dev/nvme0n1

BootCurrent: 0000

Timeout: 1 seconds

BootOrder: 0000,0001,0002,0003

Boot0000* Gentoo Linux

Boot0001* Gentoo Linux Backup

Boot0002* Memtest86
```

When I start my machine, I press F8 to enter the UEFI Boot manager

I select the Memtest86 entry and Memtest86 runs perfectly fine

I tried to make sys-apps/memtest86+ run with my UEFI boot manager. But I haven't found a way yet. I could install GRUB, of course. But I wanted to get rif of GRUB and the CSM, that's why I switched to UEFI boot...

----------

## eccerr0r

Wasn't memtest86-bin restricted rights (i.e. no longer OSS?)

----------

## mike155

 *Quote:*   

> Wasn't memtest86-bin restricted rights (i.e. no longer OSS?)

 

Well, it's not open source... But you can download and use it without restrictions. See: https://www.memtest86.com/help.html#license

 *Quote:*   

> What are the license restrictions on MemTest86 Free Edition?
> 
> MemTest86 Free Edition is free to download with no restrictions on usage

 

----------

## eccerr0r

Yeah, that's what I recalled.  I was a bit more concerned with memtest86+ which is still OSS ... and Gentoo failing to compile it correctly ...

----------

