Error 21 in grub during the upgrade to newer SLES 11 (SPx)

  • 7014290
  • 13-Dec-2013
  • 26-Jan-2015

Environment

SUSE Linux Enterprise Server 11 Service Pack 3
SUSE Linux Enterprise Server 11 Service Pack 2
SUSE Linux Enterprise Server 11 Service Pack 1
SUSE Linux Enterprise Server 11

Situation

Server was converted from running as a "physical server" to running as a "virtual machine" running on VMware infrastructure.  The conversion was made by using VMware vCenter Converter.

Symptoms

During the upgrade process from a previous OS version (i.e. SLES 10 SP4, or older SLES 11 SP) to a newer version of SLES 11, an error is encountered when the grub bootloader is installed.  The relevant text of the error is similar to:
grub> install --stage2=/boot/grub/stage2 (hd0,0)/boot/grub/stage1 d (hd0) (hd0,0)/boot/grub/stage2 0x8000 (hd0,0)/boot/grub/menu.lst

Error 21: Selected disk does not exist
grub> quit

If using a graphical install, you may see the following:

Resolution

  1. Revert the VM back to the snapshot before applying the update/installation.
  2. Modify the /boot/grub/device.map to point to the proper disk/partition. 
    Ideally, you will want to use either:
    • /dev/disk/by-id
      or
    • /dev/disk/by-uuid
  3. Reboot and run the upgrade again.

Cause

After conversion to a virtual machine, the /boot/grub/device.map file no longer points to a proper device.

Additional Information

When the server is on physical hardware, the /boot/grub/device.map file may incorporate the driver name in the device.  In our example it read like:
(hd0) /dev/disk/by-id/cciss-xxxxxxxxxxxxxxxxxxxx
(hd1) /dev/disk/by-id/cciss-xxxxxxxxxxxxxxxxxxxx

After being converted to a virtual server, the old name will only work as long as grub isn't modified -- which occurs when upgrading to a new OS version or service pack. 

Therefore, in order to avoid this error, use the appropriate entry in /dev for your device. Try to avoid using disk names, like cciss devices, and use the links to your disks under /dev/disk/by-id or /dev/disk/by-uuid -- pointing to devices similar to /dev/sda, /dev/sdb... in most of configurations).
############################################################################
Here is an example.  Before upgrading my machine, I see that /boot/grub/device.map shows:
(hd0)    /dev/disk/by-id/cciss-3600508b1001039565a353152494a0000
(fd0)    /dev/fd0
and that my /boot is on partition /dev/sda1 (as it is part of the '/' partition):
/dev/sda1 on / type ext3 (rw,acl,user_xattr)
In looking at the /dev/disk/by-id directory, the following is seen:
lrwxrwxrwx 1 root root  9 2015-01-22 21:34 edd-int13_dev80 -> ../../sda
lrwxrwxrwx 1 root root 10 2015-01-22 21:34 edd-int13_dev80-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2015-01-22 21:34 edd-int13_dev80-part2 -> ../../sda2
lrwxrwxrwx 1 root root  9 2015-01-22 21:34 edd-int13_dev81 -> ../../sdb
lrwxrwxrwx 1 root root 10 2015-01-22 21:34 edd-int13_dev81-part1 -> ../../sdb1
To correct this system, I will want to modify my /boot/grub/device.map to contain:
(hd0)    /dev/disk/by-id/edd-int13_dev80-part1
(fd0)    /dev/fd0

Feedback service temporarily unavailable. For content questions or problems, please contact Support.