Hello.

grub 2.12 and also 2.14rc1 - same problem. Below are logs from 2.14rc1.

I have a Linux system (6.15.3) where I need to fix/install grub, so I boot from rescuecd and then:

# mdadm --assemble /dev/md0 /dev/sd[abcd]3
mdadm: /dev/md0 has been started with 4 drives.
# mdadm --assemble /dev/md1 /dev/sd[abcd]4
mdadm: /dev/md1 has been started with 4 drives.
# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdc4[0] sda4[3] sdb4[2] sdd4[1]
      3747415296 blocks super 1.2 [4/4] [UUUU]
      bitmap: 0/28 pages [0KB], 65536KB chunk

md0 : active raid1 sdc3[0] sda3[3] sdb3[2] sdd3[1]
      2094592 blocks super 1.2 [4/4] [UUUU]
# vgscan
  Found volume group "vg_storage" using metadata type lvm2
# vgchange -a y
  3 logical volume(s) in volume group "vg_storage" now active
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
  lv_home vg_storage -wi-a-----   3.00t
  lv_log  vg_storage -wi-a----- 200.00g
  lv_root vg_storage -wi-a-----  30.00g
# mount /dev/vg_storage/lv_root /D/
# mount /dev/md0 /D/boot
# mount /sys /D/sys -o bind
# mount /proc /D/proc -o bind
# mount /dev /D/dev -o bind
# chroot /D
# cd /
# grub-install /dev/sda
Installing for i386-pc platform.
grub-install: error: ../grub-core/kern/disk.c:grub_disk_open:240:disk `md0' not found.

The problem seems to be because grub finds md array but adds it as "md/0" while later it expects "md0"

# grub-install -vvv /dev/sda 2>&1 | grep -E "(md0|md/0)"
grub-install: info: /dev/md0 is not present.
grub-core/disk/diskfilter.c:grub_diskfilter_vg_register:977:diskfilter: Found array md/0
grub-install: info: Found array md/0.
grub-core/disk/diskfilter.c:insert_array:1247:diskfilter: Inserting hostdisk//dev/sdc (+2162160,4193280) into md/0 (mdraid1x) grub-install: info: Inserting hostdisk//dev/sdc (+2162160,4193280) into md/0 (mdraid1x) grub-core/disk/diskfilter.c:insert_array:1247:diskfilter: Inserting hostdisk//dev/sdd (+2162160,4193280) into md/0 (mdraid1x) grub-install: info: Inserting hostdisk//dev/sdd (+2162160,4193280) into md/0 (mdraid1x) grub-core/disk/diskfilter.c:insert_array:1247:diskfilter: Inserting hostdisk//dev/sdb (+2162160,4193280) into md/0 (mdraid1x) grub-install: info: Inserting hostdisk//dev/sdb (+2162160,4193280) into md/0 (mdraid1x) grub-core/disk/diskfilter.c:insert_array:1247:diskfilter: Inserting hostdisk//dev/sda (+2162160,4193280) into md/0 (mdraid1x) grub-install: info: Inserting hostdisk//dev/sda (+2162160,4193280) into md/0 (mdraid1x)
grub-install: info: /dev/md0 is not present.
grub-install: info: /dev/md0 is not present.
grub-core/kern/disk.c:grub_disk_open:200:disk: Opening `md0'...
grub-core/kern/disk.c:grub_disk_open:200:disk: Opening `md/0'...
grub-core/disk/diskfilter.c:scan_disk_partition_iter:138:diskfilter: Scanning for DISKFILTER devices on disk md/0
grub-install: info: Scanning for DISKFILTER devices on disk md/0.
grub-install: info: Scanning for mdraid1x devices on disk md/0.
grub-install: info: Scanning for mdraid09_be devices on disk md/0.
grub-install: info: Scanning for mdraid09 devices on disk md/0.
grub-install: info: Scanning for dmraid_nv devices on disk md/0.
grub-install: info: Scanning for ldm devices on disk md/0.
grub-install: info: scanning md/0 for LDM.
grub-install: info: Scanning for lvm devices on disk md/0.
grub-core/kern/disk.c:grub_disk_close:303:disk: Closing `md/0'.
grub-core/kern/disk.c:grub_disk_open:285:disk: Opening `md0' failed.
grub-core/kern/disk.c:grub_disk_close:303:disk: Closing `md0'.
grub-install: error: ../grub-core/kern/disk.c:grub_disk_open:240:disk `md0' not found.



If I change quickly to

$ diff -up grub-2.14~rc1/grub-core/disk/diskfilter.c{~,}
--- grub-2.14~rc1/grub-core/disk/diskfilter.c~ 2025-05-06 15:14:03.000000000 +0000 +++ grub-2.14~rc1/grub-core/disk/diskfilter.c 2025-11-13 09:20:29.756608568 +0000
@@ -1131,7 +1131,7 @@ grub_diskfilter_make_raid (grub_size_t u
     {
       /* Strip off the homehost if present.  */
       char *colon = grub_strchr (name, ':');
-      char *new_name = grub_xasprintf ("md/%s",
+      char *new_name = grub_xasprintf ("md%s",
                                       colon ? colon + 1 : name);

       if (! new_name)

then success

# /grub-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.

and system boots.


If grub relies on /dev/md/XX schema then shouldn't it convert all names in encounter from mdXX to md/XX, too? Or add both forms to its internal structures.


Log from grub-install -vvv /dev/sda:
https://ixion.pld-linux.org/~arekm/grub/grub-install.txt

and from patched grub-install:
https://ixion.pld-linux.org/~arekm/grub/grub-install-patched.txt




ps. NEWS file for 2.14rc1 tarball wasn't updated (not sure if it should be at this stage though)
--
Arkadiusz Miśkiewicz, arekm / ( maven.pl | pld-linux.org )


Reply via email to