17

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.

ndemou
  • 1,215
  • 2
  • 16
  • 27
pythonimus
  • 367
  • 1
  • 3
  • 12
  • Looks like you are missing something. Which RAID level you use? After you added device to RAID, you should not work with it directly. Please post result of `cat /proc/mdstat` here. – maniaque Aug 03 '14 at 13:28
  • added output to my post. RAID level is 1. resync is already done. – pythonimus Aug 03 '14 at 13:58
  • So, all your disks and md-devices are up. You should not try to install grub directly - mdadm syncs hard disc contents automatically. If you would like to install grub to md device, so use `grub-install /dev/md1`, but are you sure you need grub on md device? Do you boot from md device? – maniaque Aug 04 '14 at 14:27
  • 1
    I dit it like mentioned [here](https://help.ubuntu.com/community/Grub2/Installing#via_ChRoot) Step12: Reinstall GRUB 2 ([...] Do not specify a partition number) [...] If the system partitions are on a software RAID install GRUB 2 on all disks in the RAID. [...] Or [here](http://wiki.hetzner.de/index.php/Festplattenaustausch_im_Software-RAID/en#Bootloader_installation) – pythonimus Aug 04 '14 at 17:55

6 Answers6

22

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.

Harald
  • 329
  • 1
  • 8
  • 1
    I just changed a hard disk and rebuilt the raid. When I ran grub-install during the rebuild, I got these warnings. I can confirm that when the rebuild finished and I ran grub-install again, these warning disappeared! – Vangelis Tasoulas Sep 08 '14 at 11:15
  • 2
    Didn't vanished for me for 3 days. Rebuild was done when I first tryed to grub-install. – pythonimus Sep 08 '14 at 22:34
22

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

Fruit
  • 221
  • 2
  • 2
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.

pythonimus
  • 367
  • 1
  • 3
  • 12
2

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.
zaTricky
  • 537
  • 4
  • 13
1

This happens because the grub device map (/boot/grub/device.map) is not correct anymore, after exchanging a drive from raid. Simply run

grub-mkdevicemap -n

for updating the device map and

grub-install

for the corresponding devices.

Henrik
  • 668
  • 5
  • 19
0

It will also complain if MD is not healthy for any reason, even it works just fine (for example 1 disk removed from 3-disk RAID1):

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

#  cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]

md61 : active raid1 sdb1[0] sda1[1]
      1048564 blocks super 1.2 [3/2] [UU_]
      bitmap: 1/1 pages [4KB], 65536KB chunk

After fixing number of disks present, it will work without complaining:

# mdadm --grow /dev/md61 -n 2
raid_disks for /dev/md61 set to 2

# grub-install --recheck /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
Matija Nalis
  • 2,409
  • 23
  • 37