GRUB“核心映像中可能缺少某些模块”警告

GRUB“核心映像中可能缺少某些模块”警告

我的 RAID 中的一个硬盘崩溃了,我添加了一个新硬盘。
现在我想将 GRUB 安装到新硬盘上:使用grub-install /dev/sdb。我收到以下警告:

Installing for i386-pc platform.
grub-install: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
grub-install: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
Installation finished. No error reported.

update-grub2得到:

Generating grub configuration file ...
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
Found linux image: /boot/vmlinuz-3.13.0-32-generic
Found initrd image: /boot/initrd.img-3.13.0-32-generic
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
Found linux image: /boot/vmlinuz-3.13.0-30-generic
Found initrd image: /boot/initrd.img-3.13.0-30-generic
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
/usr/sbin/grub-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done

输出cat /proc/mdstat

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md3 : active raid1 sdb4[3] sda4[2]
      1847608639 blocks super 1.2 [2/2] [UU]

md1 : active raid1 sdb2[3] sda2[2]
      524276 blocks super 1.2 [2/2] [UU]

md2 : active raid1 sdb3[3] sda3[2]
      1073740664 blocks super 1.2 [2/2] [UU]

md0 : active raid1 sdb1[3] sda1[2]
      8387572 blocks super 1.2 [2/2] [UU]

unused devices: none

我重新安装了两个内核,apt-get install --reinstall但这些错误/警告仍然存在。
有人知道我该如何摆脱它们吗?

更新:

由于这只是一个警告,而不是错误(而且 GRUB 必须仍在 sda 上),所以我重新启动了系统。系统启动后,警告消失了。我不知道是什么触发了警告。

答案1

我在重建降级的 SW-RAID 阵列时遇到了同样的问题,并在另一个网站上遇到了这个问题:

出现警告的 g​​rub-2.00 源位于 ./grub-core/disk/diskfilter.c 中,并有以下注释:

/* TRANSLATORS: This message kicks in during the detection of
   which modules needs to be included in core image. This happens
   in the case of degraded RAID and means that autodetection may
   fail to include some of modules. It's an installation time
   message, not runtime message.  */

(取自https://bbs.archlinux.org/viewtopic.php?id=160785

换句话说,当您的 RAID 阵列性能下降时就会发生这种奇怪的错误,而当您的阵列正常运行时,该错误就会消失(在您的情况下确实如此)。

当我的 RAID 阵列最终完成同步时,update-grub 和 grub-install 上的错误都消失了。

答案2

今天也遇到了同样的问题。结果发现这是由于grub-probe尝试通过 访问分区而导致的/dev/sda,这与 缓存不一致/dev/sda1sda2等等)。

您可以使用以下方法修复它

blockdev --flushbufs /dev/sda1

(如有必要,对其他分区重复此操作)。

答案3

发生这种情况是因为在从 raid 交换驱动器后,grub 设备映射 (/boot/grub/device.map) 不再正确。只需运行

grub-mkdevicemap -n

用于更新设备地图和

grub-install

对应设备。

答案4

使用 grub2-install 从单个磁盘迁移到 raid1 时,我遇到了非常相似的症状,即以下多条警告行。但我不愿意重新启动只是为了“测试”这是否是一个致命问题。在我的例子中,我想将 /boot 放到 4 磁盘 RAID1 上,而其他分区将被分成 2 磁盘 RAID1:

grub2-install: warning: Couldn't find physical volume ‘(null)’. Some modules may be missing from core image..

grub2-mkconfig 在生成的配置中也显示出多个错误:

/usr/sbin/grub2-probe: warning: Couldn't find physical volume `(null)'. Some modules may be missing from core image..

我发现问题在于我创建 RAID 阵列时没有指定元数据版本。较旧的 grub 版本在创建阵列时需要 --metadata=0.90。在 /boot 分区上重新执行此操作后,grub2-install 100% 成功。请记住,带有 /boot 的原始分区是 /dev/sda1,因此下面的命令缺少 3 个磁盘 + 1 个磁盘,而不是所有 4 个磁盘。

前:

$ mdadm --create --level 1 /dev/md2 --raid-devices=4 /dev/sd{b,c,d}1 missing

后:

$ mdadm --create --level 1 /dev/md2 --raid-devices=4 --metadata=0.90 /dev/sd{b,c,d}1 missing

与设备映射相关,grub 有“grub-mkdevicemap”命令。该命令已在 grub2-install 中被“--recheck”标志取代:

老的:

$ grub-mkdevicemap -n
$ grub-install /dev/sda

新的:

$ grub2-install --recheck /dev/sda

另外请记住,如果使用多个磁盘,请在所有磁盘上重复该命令。这可以防止仅在一个磁盘上安装了 grub 但该磁盘恰好坏掉的情况(这会导致系统无法启动):

$ for disk in sd{a,b,c,d} ; do grub2-install --recheck /dev/$disk ; done
Installing for i386-pc platform.
Installation finished. No error reported.
Installing for i386-pc platform.
Installation finished. No error reported.
Installing for i386-pc platform.
Installation finished. No error reported.
Installing for i386-pc platform.
Installation finished. No error reported.

相关内容