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 have a Macbook Pro 5,2 and I've had a sporadic problem with having to reinstall GRUB after a system update. This has happened with several of the recent versions of Ubuntu, although I don't have an exact record of which ones.

Every once in a while, after a system update with the update manager, I can no longer boot into Ubuntu unless I repair the GRUB installation manually. To do that I follow this procedure:

https://help.ubuntu.com/community/Grub2#Reinstalling_GRUB2

by following the instructions under ChRoot. That always works to reinstall things, but as you can imagine, it's not my favorite thing to do and takes about a half hour each time.

One problem I run into when trying to follow those instructions is that when I get to step #11 where I am supposed to run grub-install /dev/sda, it always tells me that I cannot execute that command because it would have to use "blocklists" which are inherently unstable, and the the only way to proceed is to use the --force option on grub-install. So I use the --force option and it does install it, but the fact that it does not go according to the instructions has me concerned that perhaps that is the source of the instability that the warning is telling me about. But it won't let me reinstall it any other way.

As background information I might mention as background that I have Refit installed on the Mac side, in case that is a source of the problem because it's conflicting with or fighting with Grub over the boot sector or something like that. I also have not been able to boot into OS/X from Grub even though it's on the Grub startup menu. It just hangs and does nothing if I select that. In order to boot into OS/X I have to use the hardware support on the Mac by pressing the option key while it's booting and then selecting the OS/X partition, which then boots via Refit. Conversely I cannot boot into Ubuntu via Refit even though that partition shows up on the Refit menu (as a Windows partition because I think Refit assumes anything that isn't OS/X is "Windows"). Finally here is the output of sudo fdisk -l for my system:

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util 
fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000001

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          26      204819+  ee  GPT
/dev/sda2   *          26       12972   103986412   af  HFS / HFS+
/dev/sda3           12972       25767   102782192   83  Linux
/dev/sda4           25768       59272   269128912   83  Linux

OSX is installed on sda2. The linux root is installed on sda3 and my /home folder is on sda4. The entire Macbook Pro dual boot process is a bit of a mystery to me, so I am including as much information as I can in case some of it is useful. Thanks in advance for any help.

share|improve this question
add comment

1 Answer

My first reaction is to note that you're using a hybrid MBR, which is an ugly and dangerous hack that Apple uses to simplify dual-boots with OS X. Your fdisk output only shows the MBR side of the hybrid MBR, but both OS X and Linux ignore this, instead favoring the GPT side. To show the GPT partitions, you'll need to use parted, gdisk, or some other GPT-aware utility.

Second, the "blocklists" error suggests that you've booted in BIOS mode (using the compatibility system Apple created for use by Windows), but your GPT doesn't include a BIOS Boot Partition, which GRUB 2 uses on GPT disks to store part of its BIOS-mode boot loader. One way around this error is to tweak your partitions so that you do have a BIOS Boot Partition. This can probably be done relatively painlessly, but there might be unintended consequences to such a change. In particular, if you need to resize any partitions with GParted, it's likely to wipe out the hybrid MBR, which will prevent the system from booting Linux in its current configuration because the hybrid MBR is what activates the Mac's BIOS compatibility mode. This problem can be corrected by creating a fresh hybrid MBR.

Since you don't seem to have Windows, you may want to look into booting Linux in EFI mode, which will obviate the need for the BIOS compatibility layer and the hybrid MBR. I've got a Web page about doing this: http://www.rodsbooks.com/ubuntu-efi/index.html. In brief, the procedure from a working Ubuntu installation is to uninstall grub-pc and to install and configure grub-efi or some other EFI-capable boot loader. This method has its drawbacks, though. In particular, on some systems some hardware (possibly including video hardware) may not be activated, which in extreme cases can make the system unusable.

Incidentally, rEFIt isn't likely to be a problem; it's an EFI-mode boot manager that doesn't conflict with BIOS-mode boot programs. rEFIt seems to have been abandoned, though. My fork, rEFInd, picks up development, adding features and fixing bugs. It's got some options that are particularly useful for booting Linux, but some of these apply only if you've got a 3.3.0 or later kernel, which no version of Ubuntu yet provides.

share|improve this answer
    
In your case switching to EFI should be without consequences. I have the same GFX card in my MBP when i compare our models on wikipedia and it's working splendid –  tomodachi Jun 12 '12 at 14:31
add comment

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.