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重新安装了这两个内核,但这些错误/警告仍然存在。
有谁知道我可以摆脱他们?

在重build降级的SW-RAIDarrays时,我遇到了同样的问题,并在另一个网站上跳过了这个问题:

出现警告的grub-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

换句话说,这个奇怪的错误发生在降级RAIDarrays时,一旦arrays运行正常,应该消失(在你的情况下)。

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

今天有同样的事情 原因是grub-probe尝试通过/dev/sda来访问分区,这与/dev/sda1 (和sda2等)不兼容。

你可以使用它来修复它

 blockdev --flushbufs /dev/sda1 

(根据需要重复其他分区)。

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

在从单个磁盘迁移到raid1的同时使用grub2-install,我有非常相似的症状,是多个警告行如下。 我不愿意重新启动只是为了“testing”这是否是一个致命的问题。 在我的情况下,我想把/引导到一个4磁盘RAID1,而其他分区将要分开2磁盘RAID1s:

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

grub2-mkconfig在结果configuration中也显示了多个错误:

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

我发现问题是我创build了RAIDarrays而没有指定元数据版本。 较早的grub版本在创build数组时需要–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. 

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

grub-mkdevicemap -n

用于更新设备映射和

grub-install

为相应的设备。