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

one HDD crashed from my RAID and I added a new HDD.
Now I wanted to install GRUB to the new HDD: with grub-install /dev/sdb. I get these warnings:

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.

On update-grub2 I get:

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

Output of 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

I reinstalled both kernels with apt-get install --reinstall but these errors/warnings persists.
Does anyone know how I can get rid of them?

Update:

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 1:

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 2:

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