Comment 29 for bug 222126

Revision history for this message
Pete (pxw) wrote :

I did some tests to provide data about this bug - failure of intel mac MBR boot loaders to restart after ubuntu install.

Used:
Ubuntu parted partition editor in ubuntu 704 and 810.
MacBook2.1 with 80GB disk, assisted by a second external system and efi bootloader.

1. The /dev/sda sector0 and MBR was wiped to 00 leaving only the 55aa msdos MBR disk signature.

MBR here meaning = the 4x16byte partition entries above 446 bytes.

# dd if=/dev/zero of=/dev/sda bs=510 count=1
# hexdump -Cn512 /dev/sda
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200

2. Then using the 704 live cd -

 # parted /dev/sda toggle 1 boot
 This was done twice, no net effect, but causing a write to the disk MBR.

 The MBR as 704 parted left it (there is a boot flag at 0x1ce on partition#2, unexplained).

00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fe |................|
000001c0 ff ff ee fe ff ff 01 00 00 00 27 40 06 00 80 fe |..........'@....|
000001d0 ff ff af fe ff ff 28 40 06 00 30 a1 7e 02 00 fe |......(@..0.~...|
000001e0 ff ff af fe ff ff 58 e1 88 02 08 20 ae 00 00 fe |......X.... ....|
000001f0 ff ff 83 fe ff ff 60 01 37 03 de 0e e9 02 55 aa |......`.7.....U.|
00000200

 gptsync reports "Status: Tables are synchronized, no need to sync."

 Ubuntu 704 installation can then boot on restart using MBR loaders without using gptsync (boot sector code below MBR partition data appeared later).
 ===================

3. Wipe the MBR again to check 810 parted (from xububtu810 on external disk)

root@wdc:/home/pxw# hexdump -Cn512 /dev/sda
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200

root@wdc:/home/pxw# gptsync /dev/sda
reports Current MBR partition table:
 No partitions defined

Status: MBR table must be updated.

Offers to update, Not done. just checking its valid for gptsync, but leave as is for test.

root@wdc:/home/pxw# parted
Then use 810 parted toggle operation to trigger write to disk.

This resets the sector0 mbr to one partition, full disk size, valid for gptsync,
and the same format found after initial partitioning by macosx10.4.8 diskutility.

root@wdc:/home/pxw# hexdump -Cn512 /dev/sda
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001c0 01 00 ee fe ff ff 01 00 00 00 af f8 50 09 00 00 |............P...|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200
(disk size shown here in 512byte sectors is 0x950F8AF = 156301487 =whole disk)

This requires running gptsync from the ubuntu refit package to create full MBR partiton data to allow grub or windows loader to boot.

After running gptsync the MBR is updated ready for MBR booting.
root@wdc:/home/pxw# hexdump -Cn512 /dev/sda
(boot code appears before here)-----
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fe |................|
000001c0 ff ff ee fe ff ff 01 00 00 00 27 40 06 00 00 fe |..........'@....|
000001d0 ff ff af fe ff ff 28 40 06 00 30 a1 7e 02 00 fe |......(@..0.~...|
000001e0 ff ff af fe ff ff 58 e1 88 02 08 20 ae 00 80 fe |......X.... ....|
000001f0 ff ff 83 fe ff ff 60 01 37 03 de 0e e9 02 55 aa |......`.7.....U.|
00000200
======

Solution:

The refit package should be part of the installation, and a user option provided after partitioning to sync MBR for intel mac MBR loaders. (Not necessary for efi/gpt loaders).
This will improve the install/restart experience for intel apple mac users.
It will still be necessary to run gptsync after any re-partitioning.

But preferably revert to the previous partitioner version for apple intel macs, unless there are good reasons not to do so.

(Full details in attachment)
======