Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm on a triple boot MacBook (OSX, Ubuntu, Windows). Windows started misbehaving and needed to be re-installed (as it often does). After reinstalling windows, the MBR now points to Windows directly and not GRUB.

GRUB recovery which works on most MRB Partition Table, did not on this GPT Partition table:

$ sudo grub-install --root-directory /media/ubuntu /dev/sda

Ubiquity knows how to do this correctly. Which command can I run to recover GRUB/MBR on an Intel Mac?

SOLUTION: This was not simple but I found out how to do it. Thanks to Colin Watson and to the Debian IntelMac[1] Documentation for each giving me parts of the solution.

Here is what I did:

1) Boot From LiveCD

2) Go to places and mount partition with Ubuntu

3) Press CTRL-L in nautilus or use the mount command to find out where that partition is mounted (example: /media/123)

4) Open a Terminal (Application > Accessories > Terminal)

5) Run the following commands:

$ for x in dev proc sys; do sudo mount --bind /$x /media/123/$x; done

$ sudo chroot /media/123

# dhclient

# apt-get install grub-pc os-prober gptsync

# gptsync /dev/sda # Say YES

# grub-install --force /dev/sda #Tried sda4 (the ubuntu partition) but resulted w/blink _ at boot

# update-grub

# exit

$ sudo reboot

[1] http://wiki.debian.org/IntelMac/BootLoader#Upgrading

share|improve this question

2 Answers 2

I would have simply not used grub for your windows/linux partition and gone with rEFit:

http://refit.sourceforge.net/

This would mean your windows partition would show up in a menu when first booting right next to mac osx and ubuntu.

To recover your current partition you should point the grub repair at the MBR (not GPT) and use the /boot/grub location. I don't know if you've installed the boot to sda or sda1 as the disk boot record seems more sensible in this case.

sudo grub-install --root-directory /media/ubuntu /dev/sda1

share|improve this answer
    
I will experiment with refit later. Currently I am looking to solve a problem in GRUB. In ubiquity it said the bootloader was to be installed to /dev/sda. Upon inspection of dd output it seems GRUB is installed on the MBR of the drive (first 512 bytes of sda) and yet the command I posted doesn't work. The command you posted makes it look like ubiquity installs the MBR on sda1 even though it says it will install it on sda. –  komputes Nov 17 '10 at 16:41
    
you are a savior. I used your steps in conjunction with TestDisk MBR fixing and it got my OS X Lion + Ubuntu Dual boot up and running which was disturbed severely after an upgrade to Lion. –  cpz Mar 13 '12 at 4:29

I don't see any benefit in using refit but everyone as he/she pleases.

To restore your Grub2 boot into ubuntu with SuperGrub2Disk (available here: http://www.supergrubdisk.org/) and simply run sudo update-grub and you're done.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.