Skip to content

Feature request: add new memtest86+ to recovery options via systemd-boot #291

Open
@wagnerck

Description

@wagnerck

The open-source memtest86+ (http://memtest.org/, distinct from the commercial memtest86 owned by PassMark at https://www.memtest86.com/) is under active development again. V6 is going to go into beta testing later this April, and it includes new features to make it useful once more, such as UEFI support, DDR5 testing, and more. But the most interesting feature that I'm seeing is that it compiles EFI executables by default, which work as expected when added to the /boot/efi partition.

This would allow us to add the new memtest86+ to our default Pop!OS installs, as another boot option that users can choose along with the recovery partition. I feel like this would be very useful for troubleshooting purposes, and could be a proof-of-concept for adding other hardware troubleshooting tools to the EFI partition. The memtest.efi file is 135k and should not cause any space issues on /boot/efi.

The following commands will build the new memtest86+ (v6 alpha) to include both an ISO you can burn to a USB stick and a memtest.efi file (although additional packages may be required, xorriso was the only additional one I had to install myself):

$ git clone https://github.com/memtest86plus/memtest86plus
$ cd memtest86plus/build64
$ sudo apt install xorriso
$ make iso
$ ls
app      floppy.img  lib          memtest.efi  memtest_shared      tests
boot     iso         Makefile     memtest.iso  memtest_shared.bin
esp.img  ldscripts   memtest.bin  memtest.mbr  system

Then copy memtest.efi to /boot/efi/EFI/memtest/memtest.efi, and create /boot/efi/loader/entries/memtest.conf that contains the following:

title memtest86+
efi /EFI/memtest/memtest.efi
options smp

This works in a UEFI VM and on my oryp6. See the following photos:
IMG_0154
IMG_0155

You can also add it to the firmware's boot device listing via efibootmgr, but I feel like the more important thing is having it in the systemd-boot menu, since that's where our users go to choose the recovery partition, and the command to open up that menu is universal across hardware (i.e. hold down the spacebar).

And if there's also a way to add this to the installer ISO, as an option in the initial boot menu, that would make this useful for folks at the factory who are doing installation and testing, as well as for people trying to install Pop!OS and can't because they have a hardware problem. I don't know if that would be done with an EFI file or with something else, like the floppy image.

I've been told that it was determined that we can't do this kind of thing with the commercial memtest86 from PassMark, but this project appears to be fully GPL2 (https://github.com/memtest86plus/memtest86plus/blob/main/LICENSE) so there shouldn't be any insurmountable licensing issues.

Caveats: memtest86+ v6 is still in an alpha state, with a beta in late April 2022, so while testing might be worth doing right now, we probably shouldn't actually add this to the shipping product until later. Maybe the beta will be stable enough to start shipping it, maybe not.

Also, we would clearly need to test this on a wide variety of hardware, especially our desktop PC line (Thelio and Meerkat) because memtest86+ has a new keyboard detection system (as outlined on the GitHub page) which may not reliably detect external USB keyboards on all systems just yet, or may require booting with CSM and/or legacy modes enabled.

I'm not sure how difficult this would be to add to our installer, but I feel like the best option here would be to treat it like the recovery partition, since it also will only be present on UEFI systems. Pop!OS could also possibly update the EFI executable independent of the OS, using the same mechanism used to update the recovery partition.

You can supposedly change the order of the options in the systemd-boot menu with a sort-key option in the configuration file (see https://systemd.io/BOOT_LOADER_SPECIFICATION/), but I couldn't get it to work. I think it needs to have a sort-key in all of the configuration files under /boot/efi/loader/entries/ for this to work correctly, but I didn't mess with the ones automatically generated by Pop!OS to test this.

Finally, even if the EFI executable doesn't turn out to be feasible to include in Pop!OS, we should be happy that there's once again going to be a fully open-source memtest that we can refer users to, that won't nag them to install a "Pro" version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions