GRUB "Some modules may be missing from core image" warning

Solution 1:

Had the same thing today. Turns out it's caused by grub-probe trying to access partitions through /dev/sda, which is not cache-coherent with /dev/sda1 (and sda2 etcetera).

You can fix it using

blockdev --flushbufs /dev/sda1

(repeat for other partitions as necessary).

Solution 2:

I was having the same problem while rebuilding a degraded SW-RAID array, and tripped over this on another website:

The grub-2.00 source where the warning arises is in ./grub-core/disk/diskfilter.c and has this comment:

/* 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.  */

(Taken from https://bbs.archlinux.org/viewtopic.php?id=160785)

In other words, this strange error occurs when you have degraded RAID arrays, and should disappear (which it did in your case) once your arrays are functioning properly.

When my RAID arrays finally finished syncing, the error disappeared on both update-grub and grub-install.


Solution 3:

Since it was only a warning, not an error (and GRUB has to be still on sda) I restarted the system.
The system booted and the warnings are gone.
I dont know what triggered the warnings.


Solution 4:

Using grub2-install while migrating from a single disk to raid1, I had very similar symptoms, being multiple warning lines as follows. I wasn't willing to reboot just to "test" whether or not this was a fatal problem however. In my case I wanted to put /boot onto a 4-disk RAID1 while the other partitions were going to be separated 2-disk RAID1s:

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

grub2-mkconfig also showed multiple errors in the resulting configuration:

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

I found the problem was that I had created the RAID array without specifying the metadata version. Older grub versions require --metadata=0.90 when creating the array. After re-doing this bit on the /boot partition, grub2-install worked 100%. Bear in mind that the original partition with the /boot was /dev/sda1, hence why the commands below have 3 disks + 1 missing instead of all 4 disks.

Before:

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

After:

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

Related to device map, grub had "grub-mkdevicemap" command. This has been replaced with "--recheck" flag in grub2-install:

Old:

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

New:

$ grub2-install --recheck /dev/sda

Also please remember, if using multiple disks, to repeat the command on all disks. This prevents the situation where you have grub installed on one disk only but that disk happens to die on you (which would result in an unbootable system):

$ 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.