[Bug 998097] Re: Grub2 not recognise GPT when presence hybrid MBR

Stas Davydov stas.davydov at gmail.com
Sun Sep 16 21:55:55 UTC 2012


>> Do you remember which choice you chose at this screen ( http://pix
.toile-libre.org/upload/original/1312973605.png ) when you installed
Ubuntu ?

I have performed manual partition of  disk.


I do NOT tring to create dualboot - so it is not like  Bug #1050940  .
The only I want is to load Ubuntu on  GPT partition in legacy mode.
I have set of problems with it which I identify as limitations (bugs?) in GRUB2 and kernel:
1. ( in grub-install) Grub2 refuse to "grub-install /dev/sda" if protective GPT entry is NOT the first.
This bug could be workarounded with method described in bug 2.

2. ( in grub booting - core.img? )I could do grub-install IF protective GPT entry is the first, and to rearainge order of records in MBR so it become not first - but in this case GRUB failed to detect GPT during booting.
During boot shown:
error: no such partition
grub rescue> ls
(hd0)

3. ( in grub-install) IF I do protective record start from sector 2048 -
then I could install GRUB in "biosdisk" (?) mode but in this case it
installed it data (102 sectors) starting from sector 1 and so corrupt
GPT header. I assume that is stage1.5/core.img data ?

4. ( in kernel?) with setup when GPT protective record is NOT first and starts from sector 2048 kernel not able recognise hybrid partition table. in dmesg I see:
[sda]: unknown partition table
same time gdisk sees correct GPT and hybrid MBR  


Most correct approach - will be to resolve bug 2. But guess  that reqires re-working ASM code.

For now I am trying diferent approach - boot core.img in biosdisk mode and then load correct module (part_gpt) through (hd0,msdos2) and then perform father actions through (hd0,gptN).
For that I need to find way to force GRUB install it stage1.5 not to sector 1 (resolve bug 3) .
I guess for that needed to tweak (or hack) boot.img to point it to new place of core.img


I could easily migrate stage1.5/core.img to diferent place with "dd" - but I do not know how point that place for stage1/boot.img

I see that size of stage1.5 is 51kB(102 sectors) so if I place it
starting from sector 1901 it will be good enough. Another option is to
use partition gpt12 (EF02) but then either grub must recognise GPT
partition table (see bug 2) or point for stage 1 it location in biosdisk
mode.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/998097

Title:
  Grub2 not recognise GPT when presence hybrid MBR

Status in “grub2” package in Ubuntu:
  New

Bug description:
  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 at 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 at 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 at helena:~# lsb_release -rd
  Description:	Ubuntu 12.04 LTS
  Release:	12.04

  root at 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)
  --- 
  ApportVersion: 2.0.1-0ubuntu13
  Architecture: amd64
  DistroRelease: Ubuntu 12.04
  InstallCmdLine: file=/cdrom/preseed/ubuntu.seed vga=788 initrd=/install/initrd.gz quiet --  debian-installer/language=ru keyboard-configuration/layoutcode=ru
  InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64+mac (20110426)
  Package: ubiquity 2.10.20
  PackageArchitecture: amd64
  ProcVersionSignature: Ubuntu 3.2.0-30.48-generic 3.2.27
  Tags:  precise
  Uname: Linux 3.2.0-30-generic x86_64
  UpgradeStatus: Upgraded to precise on 2012-05-07 (131 days ago)
  UserGroups:

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/998097/+subscriptions




More information about the foundations-bugs mailing list