Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 893614 - sys-apps/memtest86+-6.10: "error: not a valid root device." in grub2
Summary: sys-apps/memtest86+-6.10: "error: not a valid root device." in grub2
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ben Kohler
Depends on:
Reported: 2023-02-08 15:55 UTC by lekto
Modified: 2023-06-25 11:00 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

emerge --info (,5.60 KB, text/plain)
2023-02-08 15:55 UTC, lekto
/boot/grub/grub.cfg (grub.cfg,26.46 KB, text/plain)
2023-02-08 16:14 UTC, lekto
/boot/grub/grub.cfg after change (grub.cfg,26.47 KB, text/plain)
2023-02-08 16:43 UTC, lekto
new grub.d config generator (39_memtest86+,3.72 KB, text/plain)
2023-02-08 18:03 UTC, Ben Kohler
new grub.d config generator (39_memtest86+,3.72 KB, text/plain)
2023-02-08 19:49 UTC, Ben Kohler
39_memtest86+ (39_memtest86+,3.99 KB, text/plain)
2023-05-21 22:34 UTC, Kai-Chun Ning

Note You need to log in before you can comment on or make changes to this bug.
Description lekto 2023-02-08 15:55:42 UTC
Created attachment 850170 [details]
emerge --info

Hi, I'm trying to run memtest86+ from grub. I installed it and run grub-mkconfig, now I have additional entry "Memtest86+" in grub, in it there is only one entry "*Memtest86+ 64bit UEFI", when I select it I got error:
> error: not a valid root device.
> Press any key to continue...

> # emerge -pv memtest86+ grub                                                                                                            
> These are the packages that would be merged, in order:
> Calculating dependencies... done!
> [ebuild   R   ~] sys-apps/memtest86+-6.10::gentoo  USE="bios64 boot efi64 (-bios32) (-efi32) (-iso32) -iso64" 0 KiB
> [ebuild   R    ] sys-boot/grub-2.06-r4:2/2.06-r4::gentoo  USE="device-mapper libzfs nls -doc -efiemu -fonts -mount -sdl (-test) -themes -truet
> ype" GRUB_PLATFORMS="efi-64 -coreboot -efi-32 -emu -ieee1275 (-loongson) -multiboot -pc -qemu (-qemu-mips) -uboot -xen -xen-32 -xen-pvh" 0 KiB

> # grub-mkconfig -o /boot/grub/grub.cfg 
> Generating grub configuration file ...
> (…)
> Adding boot menu entry for UEFI Firmware Settings ...
> Found memtest image: /boot/memtest86plus/memtest64.bios
> Found memtest image: /boot/memtest86plus/memtest.efi64
> done
Comment 1 Ben Kohler gentoo-dev 2023-02-08 16:00:37 UTC

Can you attach the generated grub.cfg here, and also tell me if 6.01 or 6.00 works better?
Comment 2 lekto 2023-02-08 16:14:16 UTC
Same problem with 6.00 and 6.01. My /boot partition is mdraid raid1 with metadata 1.0.
UUID of my raid partition: 8afc6b17-cf11-762c-e60a-804ceed9a825
UUID of filesystem: 0CAA-660F
Comment 3 lekto 2023-02-08 16:14:41 UTC
Created attachment 850180 [details]
Comment 4 Ben Kohler gentoo-dev 2023-02-08 16:22:44 UTC
Interesting... the root parameters (to find grub's root, /boot) are exactly the same between the linux kernel entries and the memtest entries.  The only difference I see is that the memtest entries are missing the gzio module load.

Could you try adding an "insmod gzio" around line 659 of your config, just before the "insmod part_gpt" lines, and see if that helps?
Comment 5 lekto 2023-02-08 16:38:04 UTC
Still same error.
Comment 6 Ben Kohler gentoo-dev 2023-02-08 16:39:45 UTC
Can you attach that modified grub.cfg just so I can make sure it has the change I intended?  Thanks
Comment 7 lekto 2023-02-08 16:43:18 UTC
Created attachment 850182 [details]
/boot/grub/grub.cfg after change
Comment 8 Ben Kohler gentoo-dev 2023-02-08 16:50:17 UTC
Ok that's exactly what I had in mind.  Just to be sure, all your linux kernel entries boot just fine, right?
Comment 9 lekto 2023-02-08 17:02:14 UTC
Yes, everything is working, except memtest86+.
Comment 10 Ben Kohler gentoo-dev 2023-02-08 17:10:26 UTC
Can you change "chainloader" to "linux" around line 669-670, and see if that helps?
Comment 11 lekto 2023-02-08 17:19:55 UTC
I get black screen and I have to hard reset.
I figured that I can run memtest86+ with this:
> setparams 'Memtest86+ 64bit UEFI'
> 	insmod part_gpt
> 	insmod part_gpt
> 	insmod diskfilter
> 	insmod mdraid1x
> 	insmod fat
> 	set root='(hd0,gpt1)'
> 	chainloader "/memtest86plus/memtest.efi64"
, but can't figure it how to use "search" to do it right.
Comment 12 Ben Kohler gentoo-dev 2023-02-08 17:31:06 UTC
Yeah we need a way to tell grub that it can't use mdraid for the chainload, it needs to pick one of the raid members.

AND I think I've found a possible solution:

Can you try using this search line?

search --no-floppy --fs-uuid --set=root --efidisk-only 0CAA-660F
Comment 13 Ben Kohler gentoo-dev 2023-02-08 18:03:06 UTC
Created attachment 850190 [details]
new grub.d config generator

Can you try replacing your /etc/grub.d/39_memtest86+ file with this one?

What I've done is (for EFI entries only) ditch the prepare_grub_to_access_device builtin and instead just use a single search command
Comment 14 Ben Kohler gentoo-dev 2023-02-08 19:49:57 UTC
Created attachment 850244 [details]
new grub.d config generator

Sorry, wrong order of args on that last one, this one should work better
Comment 15 lekto 2023-02-09 14:49:09 UTC
Still same error, but now grub entry is only:
> setparams 'Memtest86+ 64bit UEFI'
> 	search --no-floppy --fs-uuid --set=root 0CAA-660F --efidisk-only
> 	chainloader "/memtest86plus/memtest.efi64"

I tried to add back insmods, but it didn't change anything.
Comment 16 Ben Kohler gentoo-dev 2023-02-09 14:51:12 UTC
Maybe you can drop to a grub shell and experiment with some search options that can manage to find a single raw hd device... and maybe searching with --file instead of --uuid could work better?

I wish I had an mdraid /boot setup to test with, I guess I could try in a VM soon
Comment 17 lekto 2023-02-09 15:20:58 UTC
I gave grub console some try and noticed few things:

Search gives more results, but $root get only first result.
> grub> search --no-floppy --fs-uuid --set=root 0CAA-660F --efidisk-only
> grub> echo $root
> md/129
> grub> search --no-floppy --fs-uuid 0CAA-660F --efidisk-only
> md/129 md/129 hd0,gpt1 hd1,gpt1

> grub> search --file /memtest86plus/memtest.efi64
>  md/129 hd0,gpt1 hd1,gpt1
> grub> chainloader (md/129)/memtest86plus/memtest.efi64
> error: not a valid root device.
> grub> chainloader (hd0,gpt1)/memtest86plus/memtest.efi64
> error: not a valid root device.
> grub> chainloader (hd1,gpt1)/memtest86plus/memtest.efi64
> error: not a valid root device.
Comment 18 Ben Kohler gentoo-dev 2023-02-09 15:56:03 UTC
Thanks for the testing... doesn't really seem like --efidisk-only is doing what it's supposed to.  I'm not sure how we're going to get it to (automatically) pick one of the raid members for root.

I was really hoping that switching from "chainloader" to "linux" would work, since then it would not rely on EFI loading mechanisms, and just read from md/129 just like your linux kernel entries.

I wonder if adding "set gfxpayload=keep" would allow the "linux" boot method to work better for you.
Comment 19 Kai-Chun Ning 2023-05-21 22:34:40 UTC
Created attachment 862148 [details]

I had the same issue. The attached grub.d config generator works for me. Would you like to give it a try?
Comment 20 Ben Kohler gentoo-dev 2023-05-22 00:23:22 UTC
So with just the chainloader -> linux change, it was quite enough, but with the extra gfx* options, it did work better?
Comment 21 Kai-Chun Ning 2023-05-23 16:36:29 UTC
memtest86+ doesn't seem to scale on HiDPI screens. Without the gfx options, it only uses ~1/4 of a 1080p screen. The texts were quite small and barely readable.

The gfx options were taken from here:
Comment 22 Kai-Chun Ning 2023-05-23 16:37:42 UTC
*edit: at least doesn't scale on my system
Comment 23 lekto 2023-05-24 12:41:34 UTC
I can't test it, I switched to /boot on USB DOM module to not deal with /boot on RAID any more.
Comment 24 godlike64 2023-06-25 11:00:35 UTC
(In reply to Kai-Chun Ning from comment #19)
> Created attachment 862148 [details]
> 39_memtest86+
> I had the same issue. The attached grub.d config generator works for me.
> Would you like to give it a try?

I had run into this same issue and used this grub.d config file to fix it. I can boot normally into memtest now.