[Bug 757201] Re: Overlapping partitions created on Apple GPT
Rolf Leggewie
757201 at bugs.launchpad.net
Wed Jun 17 11:00:29 UTC 2015
lucid has seen the end of its life and is no longer receiving any
updates. Marking the lucid task for this ticket as "Won't Fix".
** Changed in: parted (Ubuntu Lucid)
Status: Triaged => Won't Fix
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to parted in Ubuntu.
https://bugs.launchpad.net/bugs/757201
Title:
Overlapping partitions created on Apple GPT
Status in parted package in Ubuntu:
Fix Released
Status in parted source package in Lucid:
Won't Fix
Status in parted source package in Maverick:
Invalid
Status in parted source package in Natty:
Fix Released
Bug description:
Binary package hint: parted
Release: Natty daily 2011.04.10. Bug also occurs in Maverick and Lucid.
Package: parted 2.3-5ubuntu4
Parted in Ubuntu is patched to sync the hybrid-MBR with the GPT
partition table on Apple systems. Under certain circumstances, a
broken hybrid-MBR will be produced with multiple overlapping
partitions of partition-ID 0xEE.
The effect can be reproduced, and the cause diagnosed, see TEST CASE
and DIAGNOSIS below.
INCIDENCE AND EFFECTS:
A typical case where this bug may manifest is a dual- or triple-
booting Mac. First the user installs Mac OS X, partition table looks
like this:
1. EFI System Partition
2. Mac OS X (HFS+)
Next Ubuntu is installed alongside, partition table is now:
1. EFI System Partition
2. Mac OS X (HFS+)
3. Grub BIOS Boot Partition
4. Linux root (ext4)
5. Linux swap
The resulting hybrid MBR is:
1. EFI protective partition (0xEE)
2. Mac OS X (0xAF)
3. Grub BIOS Boot Partition (0xEE, overlaps partitions 1 & 2)
4. Linux root (0x83)
There are instances in the forums of such situations, eg:
http://ubuntuforums.org/showthread.php?t=1556993
http://ubuntuforums.org/showthread.php?t=1684602
The author of gdisk has also seen this bug: http://www.rodsbooks.com/gdisk/hybrid.html
'I'm seeing a lot of problem reports from Mac users who attempt to dual-boot with Linux because one of the utilities involved creates a buggy hybrid MBR with an extra type-0xEE partition that overlaps others.'
I will attach the output of 'parted print' and 'fdisk -l' for a
triple-boot system where I encountered this bug.
Both Ubuntu and Mac OS X will continue to boot in my experience, as will Windows if present. However, disk utilities may become very confused, and may cause damage attempting to fix the broken partition table. Also, Mac OS X will believe it is not on a GPT-formatted disk, and will not be able to install firmware upgrades.
TEST CASE:
1. Add a new disk to an Ubuntu system or VM. I'll assume this is
/dev/sda .
2. Create a GPT partition table with an EFI system partition:
a. Run 'parted /dev/sda' as root
b. In parted, create the table and partition:
(parted) mktable gpt
(parted) mkpart EFI fat32 1MiB 201MiB
(parted) set 1 boot on
(parted) quit
c. Initialize the EFI system partition so parted will recognize it:
# mkfs.vfat -F 32 /dev/sda1
3. Now we'll add some partitions, and see the bug.
a. Run parted as root such that it will emulate running on an Apple
system: 'PARTED_GPT_APPLE=1 parted /dev/sda'
b. In parted, create a BIOS Boot Partition for grub2. We'll also create
some extra partitions to make the problem easier to notice.
(parted) mkpart HFS hfs+ 201MiB 500MiB
(parted) mkpart grub ext2 500MiB 502MiB
(parted) set 3 bios_grub on
(parted) mkpart linux-root ext4 502MiB 700MiB
(parted) quit
4. Examine the MBR with 'fdisk -l /dev/sda'. The results:
Device Boot Start End Blocks Id System
/dev/sda1 1 26 205823+ ee GPT
/dev/sda2 * 26 64 306176 0 Empty
/dev/sda3 1 64 514047+ ee GPT
/dev/sda4 64 90 202752 83 Linux
Notice that the BIOS Boot Partition (sda3) overlaps the first two
partitions. The expected result would be something like:
Device Boot Start End Blocks Id System
/dev/sda1 1 26 205823+ ee GPT
/dev/sda2 * 26 64 306176 0 Empty
/dev/sda3 64 64 2048 da Non-FS data
/dev/sda4 64 90 202752 83 Linux
Or perhaps even:
Device Boot Start End Blocks Id System
/dev/sda1 1 26 205823+ ee GPT
/dev/sda2 * 26 64 306176 0 Empty
/dev/sda3 64 90 202752 83 Linux
(Device name /dev/sda3 should be sda4, bug in fdisk?)
DIAGNOSIS:
The proximate cause of this bug is line 317 in gptsync.patch, which
sets the StartingLBA = 1 for any partition of type 0xEE. This should
be changed to only apply to the FIRST partition.
http://bazaar.launchpad.net/~ubuntu-
branches/ubuntu/natty/parted/natty/view/head:/debian/patches/gptsync.patch
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/parted/+bug/757201/+subscriptions
More information about the foundations-bugs
mailing list