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've been trying to get the dual boot to work for a few days now. I installed rEFIT and then installed Ubuntu, when installing I selected the option to put the grub loader on the ubuntu partition. After installing, I don't see the Ubuntu install in the rEFIT loader, and I cannot repair the partition table. I boot OS X and get the output from the partition inspector, which is below.

*** Report for internal hard disk ***

Current GPT partition table:
 #      Start LBA      End LBA  Type
 1         409640    781659639  Mac OS X HFS+
 2      781660160    970772479  EFI System (FAT)
 3      970772480    976772479  Linux Swap

Current MBR partition table:
 # A    Start LBA      End LBA  Type
 1              1       409639  ee  EFI Protective
 2         409640    781659639  af  Mac OS X HFS+
 3 *    781660160    970772479  83  Linux
 4      970772480    976772479  82  Linux swap / Solaris

MBR contents:
 Boot Code: None

Partition at LBA 409640:
 Boot Code: None
 File System: HFS Extended (HFS+)
 Listed in GPT as partition 1, type Mac OS X HFS+
 Listed in MBR as partition 2, type af  Mac OS X HFS+

Partition at LBA 781660160:
 Boot Code: None
 File System: ext4
 Listed in GPT as partition 2, type EFI System (FAT)
 Listed in MBR as partition 3, type 83  Linux, active

Partition at LBA 970772480:
 Boot Code: None
 File System: Unknown
 Listed in GPT as partition 3, type Linux Swap
 Listed in MBR as partition 4, type 82  Linux swap / Solaris

Does anyone know how I can go about fixing this?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

First, there appears to be an error in your GPT layout: The partition beginning at sector 781660160 is identified on the GPT side as an EFI System Partition (ESP); but on the MBR side, it appears as a Linux partition with an ext4 filesystem. Given the way this identification has been done, I trust the MBR data on this one. Chances are you or the installer mistakenly set the "boot flag" on the partition. Using libparted-based programs, setting the "boot flag" on a GPT partition actually sets the ESP type code, which should never be set on a Linux partition. (The ESP is required to hold a FAT filesystem and should hold EFI boot loaders and related files, not a Linux installation.) This error isn't likely to be causing your problem, but it's conceivable it's a contributing factor. Thus, I recommend booting a Linux emergency system and using GParted, parted, gdisk, or some other tool to adjust the type code appropriately. Using GParted or parted, remove the "boot flag" from the Linux partition; or using gdisk, change the type code from EF00 to 8300. Note that these tools will probably show another ESP, this one with a FAT filesystem. You should leave it configured as an ESP (with its "boot flag" or EF00 type code, depending on the tool you use).

Second, I recommend you switch from a BIOS-mode boot of Linux to an EFI-mode boot. This will obviate the need to use a hybrid MBR, which you're using now. Hybrid MBRs are ugly and dangerous hacks. You can install a suitable EFI-mode boot loader without too much difficulty. The easiest to set up is likely to be my rEFInd, which is a fork of the (now-discontinued) rEFIt; however, the procedure I'm about to describe works only with 3.3.0 and later kernels. Ubuntu 12.10 and later, including Ubuntu 12.04.2 (but not the original 12.04) come with suitable kernels. The procedure is:

  1. Download the rEFInd binary .zip file from its downloads page.
  2. Install rEFInd under OS X. This is easily done by using the install.sh script.
  3. Install the rEFInd driver for ext4fs. You can do this by copying the ext4_x64.efi file from the rEFInd package to the /EFI/refind/drivers_x64/ directory (which you'll have to create). (This assumes you install to the default location; if you install rEFInd to your ESP or install manually elsewhere, you'll need to adjust the path appropriately.)
  4. Reboot. rEFInd should appear.
  5. In rEFInd, use the arrow keys to select one of the Linux penguin icons, which rEFInd should identify as launching a Linux kernel with a filename that begins with vmlinuz.
  6. With one of the Linux kernels selected, hit F2 or Insert twice. A text-mode text editor should appear.
  7. Add ro root=/dev/sda2 to the boot options and press Enter. Linux should launch.
  8. In Linux, run the mkrlconf.sh script that came with rEFInd. This will create a configuration file that should obviate the need to add ro root=/dev/sda2 to your Linux options the next time you boot; instead, Linux should launch directly when you select its option and hit the Enter key.

At this point, your system will be basically functional. You can remove the hybrid MBR by using the gdisk program (specifically, by typing x followed by n followed by w) or by making any minor change to your partitions with parted or GParted. You may also want to tweak the rEFInd configuration by editing the /EFI/refind/refind.conf file under OS X; see the rEFInd documentation for details.

share|improve this answer
    
Awesome, thanks! That worked perfectly. –  cam Apr 27 '13 at 4:24
add comment

Did you try an option boot? For this you hold option while booting and may fix it. Secondly you may have installed it incorrectly. I did so 2 times before realizing I was making a mistake.

share|improve this answer
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.