TransWikia.com

Grub's console ls command detects one more drive than I really have

Unix & Linux Asked on February 17, 2021

I have two drives. The first has only one ext4 partition, which is used to store data. The second has seven partitions, including the EFI boot partition and four operating systems.
For some reason, grub’s console is detecting three drives:

grub> ls
(hd0) (hd1) (hd1,gpt1) (hd2) (hd2, gpt1) (hd2, gpt2) (hd2, gpt3) (hd2, gpt4) (hd2, gpt5) (hd2, gpt6) (hd2, gpt7)

Although grub’s ls command is listing the drives "shifted" to the right (For example showing the real (hd1,gpt1) as (hd2,gpt1), the real (hd1,gpt2) as (hd2,gpt2), etc.), the menu entries in the grub.cfg are configured correctly, according to the real drives order:

...
set root='hd1,gpt2' #Part of Fedora's menu entry. Boots normally.
...
set root='hd1,gpt3' #Part of Slackware's menu entry. Boots normally. 
...
set root='hd1,gpt1' #Part of Windows 10 menu entry. Points to EFI Boot Partition and boots normally.
...

The only operating system that complains about the partition configured on grub.cfg is FreeBSD:

...
set root='hd1,gpt5' #Part of FreeBSD's menu entry. Causes an error.
...

Trying to boot FreeBSD throws this message:

../../grub-core/net/net.c:1547:disk not found

When I change the FreeBSD menu entry to hd2,gpt5, it tries to boot, but restarts the machine. I don’t think that this behavior is related to this problem, though.

Why would grub display this "phantom" (hd0) drive? Where does it come from? Is possible to fix it?

PS: I’ve tested it, and this behavior occurs with two different instances of grub. One from Fedora and the other from Slackware. Booth instances are grub 2.04.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP