Comment 0 for bug 998097

Revision history for this message
Stas Davydov (stas-davydov) wrote :

Root issue:
 grub ignore protective GPT record if that record is not the first one in MBR.
Need to correct:
 If protective GPT record appears on any place in MBR - grub must consider system as GPT.

I have hybrid GPT/MBR. Hybrid MBR contains protective record 0xEE but that record is NOT first.
Here is output of gdisk (hybrid MBR):
Number Boot Start Sector End Sector Status Code
   1 468992 101480447 primary 0x07
   2 234375168 234569727 primary 0xEF
   3 * 550782882 574927413 primary 0x83
   4 1 468991 primary 0xEE

gdisk (GPT):
Number Start (sector) End (sector) Size Code Name
   1 2048 206847 100.0 MiB EF00 EFI system partition
   2 206848 468991 128.0 MiB 0C01 Microsoft reserved part
   3 468992 101480447 48.2 GiB 0700 win7
   4 101480448 138344447 17.6 GiB AF00 other
   5 390625280 527343615 65.2 GiB 8301 copyfilesWIN7
   6 527343616 550780927 11.2 GiB AF00 backupfile
   7 581042176 625141759 21.0 GiB 2700 Samsung_diag
   8 138344448 234375167 45.8 GiB 0700 DATA
  11 574927414 581042175 2.9 GiB 8200
  12 234375168 234569727 95.0 MiB EF02 grub
  13 550782882 574927413 11.5 GiB 0700 linux

After that it result in such errors:
root@helena:~# grub-install /dev/sda
/usr/sbin/grub-setup: warn: This msdos-style partition label has no post-MBR gap; embedding won't be possible!.
/usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: will not proceed with blocklists.

invoking grub-mkconfig manually gives:
root@helena:~# grub-mkconfig -o test.conf
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-24-generic
Found initrd image: /boot/initrd.img-3.2.0-24-generic
Found linux image: /boot/vmlinuz-3.0.0-19-generic
Found initrd image: /boot/initrd.img-3.0.0-19-generic
Found linux image: /boot/vmlinuz-2.6.38-14-generic
Found initrd image: /boot/initrd.img-2.6.38-14-generic
Found linux image: /boot/vmlinuz-2.6.38-8-generic
Found initrd image: /boot/initrd.img-2.6.38-8-generic
Found memtest86+ image: /boot/memtest86+.bin
grub-probe: error: cannot find a GRUB drive for /dev/sda4. Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sda5. Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sda6. Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sda7. Check your device.map.
done

I have tried diferent approach - was removed hybrid MBR (retained only protective record). After that grub-install succeed. After that I have created hybrid MBR (the same as above).
But after reboot I have got "grub rescue" prompt and error: no such partition.

root@helena:~# lsb_release -rd
Description: Ubuntu 12.04 LTS
Release: 12.04

root@helena:~# apt-cache policy grub-pc
grub-pc:
  Installed: 1.99-21ubuntu3
  Candidate: 1.99-21ubuntu3
  Version table:
 *** 1.99-21ubuntu3 0
        500 http://ua.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: grub-pc 1.99-21ubuntu3
ProcVersionSignature: Ubuntu 2.6.38-14.58-generic 2.6.38.8
Uname: Linux 2.6.38-14-generic x86_64
ApportVersion: 2.0.1-0ubuntu7
Architecture: amd64
Date: Fri May 11 17:45:17 2012
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64+mac (20110426)
SourcePackage: grub2
UpgradeStatus: Upgraded to precise on 2012-05-07 (3 days ago)