I have a long winded puzzle, but before I put in all the info, my goal is to have a boot loader boot and be able to choose Ubuntu Linux, or Windows 7 (I'm no longer using Mac OS). I'm posting here for assistance since I know you folks are the pros as it relatest to booting macs. So here's what I have. iMac 27" with two internal drives. Depending on the mood of the mac (I kid you not) these will show up as /dev/disk0 and /dev/disk1, but they will sometimes swap. Here's what they look like from the mac side:
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme 1.0 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS Mavericks 97.9 GB disk0s2
3: Microsoft Basic Data Games 97.9 GB disk0s3
4: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 697.9 GB disk0s4
5: Microsoft Basic Data 106.1 GB disk0s5
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme 240.1 GB disk1
1: EFI EFI 209.7 MB disk1s1
2: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 119.7 GB disk1s2
3: Microsoft Basic Data Win7 120.0 GB disk1s3
0FC63DAF-8483-4772-8E79-3D69D8477DE4 on disk0 is a large ext3 partition, and, oddly, the same id on disk1 is my Ubuntu install. The same setup as seen from that Ubuntu install:
Model: ATA ST31000528AS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 20.5kB 210MB 210MB fat32 EFI System Partition boot
2 210MB 98.1GB 97.9GB hfs+ Mavericks
3 98.3GB 196GB 97.9GB ntfs Mav-Test msftdata
4 196GB 894GB 698GB ext3
5 894GB 1000GB 106GB ntfs msftdata
Model: ATA ST240HM000-1G515 (scsi)
Disk /dev/sdb: 240GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 20.5kB 210MB 210MB fat32 EFI System Partition boot
2 210MB 120GB 120GB ext3 Apple_HFS_Untitled_2
3 120GB 240GB 120GB ntfs Basic data partition msftdata
I've run the below from the Mac side after mounting /dev/disk1s1:
sudo bless --folder=/Volumes/efi --file=/Volumes/efi/EFI/ubuntu/grubx64.efi --setBoot
sudo bless --mount=/Volumes/efi --file=/Volumes/efi/EFI/ubuntu/grubx64.efi --setBoot
sudo diskutil unmount /Volumes/efi
sudo bless --device /dev/disk1s1 --setboot
After accidently booting into OS X, my current state is, if left alone on reboot, will from /dev/sdb3, which as shown above is Windows 7.
When holding the Alt/Option key on boot I am greeted with three entries:
Mavericks Windows EFI Boot
The first two go to the respective OS, while selecting EFI Boot takes me to a grub bootloader and I can get into Ubuntu Linux. Bless shows me this:
Boot option is 8BE4DF61-93CA-11D2-AA0D-00E098032B8C:Boot0080
Processing boot option 'Mac OS X'
Boot option matches XML representation
Found device: disk1s1
Disk boot device detected
mount: /Volumes/efi
Mount point for /Volumes/efi is /Volumes/efi
GPT detected
Booter partition required at index 2
System partition found
Preferred system partition found: disk0s1
Preferred system partition found: disk1s1
Returning booter information dictionary:
<CFBasicHash 0x7fee69e07900="" <span="">[0x7fff79d15f00]>{type = mutable dict, count = 3,
entries =>
0 : <CFString 0x10fff6e70="" <span="">[0x7fff79d15f00]>{contents = "System Partitions"} = (
disk1s1,
disk0s1
)
1 : <CFString 0x10fff7650="" <span="">[0x7fff79d15f00]>{contents = "Data Partitions"} = (
disk1s1
)
2 : <CFString 0x10fff7670="" <span="">[0x7fff79d15f00]>{contents = "Auxiliary Partitions"} = (
)
}
/dev/sda1 as seen from Ubuntu: [08:52:21 iMac:/media/boot$] ls -lR
.:
total 1
drwxr-xr-x 3 root root 512 Jan 6 2014 EFI
./EFI:
total 1
drwxr-xr-x 3 root root 512 Jan 6 2014 APPLE
./EFI/APPLE:
total 1
drwxr-xr-x 2 root root 512 Jan 6 2014 EXTENSIONS
./EFI/APPLE/EXTENSIONS:
total 15361
-rwxr-xr-x 1 root root 15729264 Feb 15 08:00 Firmware.scap
/dev/sdb1 as seen from Ubuntu: [08:53:15 iMac:/media/boot$] ls -lR
.:
total 1
drwxr-xr-x 6 root root 512 Jan 6 2014 EFI
./EFI:
total 2
drwxr-xr-x 3 root root 512 Dec 26 2013 APPLE
drwxr-xr-x 2 root root 512 Jan 6 2014 Boot
drwxr-xr-x 3 root root 512 Jan 6 2014 Microsoft
drwxr-xr-x 2 root root 512 Apr 19 2014 ubuntu
./EFI/APPLE:
total 1
drwxr-xr-x 2 root root 512 Dec 26 2013 EXTENSIONS
./EFI/APPLE/EXTENSIONS:
total 15361
-rwxr-xr-x 1 root root 15729264 Jan 6 2014 Firmware.scap
./EFI/Boot:
total 1324
-rwxr-xr-x 1 root root 1355736 Jan 6 2014 bootx64.efi
-rwxr-xr-x 1 root root 0 Jan 6 2014 bootx64.efi.grb
./EFI/Microsoft:
total 1
drwxr-xr-x 2 root root 512 Jan 7 2014 Boot
./EFI/Microsoft/Boot:
total 3132
-rwxr-xr-x 1 root root 672640 Jan 7 2014 bootmgfw.efi
-rwxr-xr-x 1 root root 0 Jan 6 2014 bootmgfw.efi.grb
-rwxr-xr-x 1 root root 1355736 Jan 6 2014 bootx64.efi
-rwxr-xr-x 1 root root 0 Jan 6 2014 bootx64.efi.grb
-rwxr-xr-x 1 root root 1178240 Jan 7 2014 MokManager.efi
it appears that this mac doesn't implement EFI 100%, so eh...as of now I have a system booting direct to Ubuntu Linux, which is 50% of where I need to be...next is to have grub go to Windows 7, but that's not a discussion for this list. Hope this helps someone.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
From your file lists, it looks like you're trying to boot Windows 7 in EFI mode on your Mac. This task is notoriously tricky to pull off. I used to have a bookmark to a Web forum page where this topic was discussed extensively, but I seem to have lost the link. Perhaps you can find it by Googling. The last I checked, though, the success rate was low. It's supposed to be easier to pull off with Windows 8, but I haven't studied the matter in any detail. Traditionally, booting Windows on Macs is handled via Boot Camp, which works by creating a hybrid MBR as a sort of trigger to enable BIOS support in the Mac's firmware and as a way to let Windows see the disk in a way that's helpful to it. This is a very kludgey solution, but it does work.
If you plan to remove OS X from the computer, the best way to dual-boot Linux and Windows on a Mac is to treat the computer as a BIOS system: Convert the disks from GPT to a pure MBR setup (you can use my gdisk to do this) and install a BIOS-mode version of GRUB on the disk. This way, you won't have the ugly and dangerous hybrid MBR lying around and you'll be able to manage your boot loaders in any of the well-documented ways for doing this on a BIOS-mode Linux/Windows dual-boot. When the Mac boots and sees a conventional MBR, it should try to boot it using its CSM, and everything should go smoothly. The trickiest parts of doing this will be converting your disks to a pure-MBR state and setting up a BIOS-mode boot loader. The former task, as I said, can be handled by gdisk. The latter task can probably be done by Boot Repair.
If you want to keep OS X around, I recommend you first read up on hybrid MBRs. Then understand that to boot Windows, your hybrid MBR must include the Windows boot partition. The EFI version of GRUB you're currently using can't boot a BIOS-mode boot loader, so it will be useless for booting Windows. You'll need to use the Mac's built-in boot manager, rEFIt, or rEFInd to control the boot process. You'll also need to re-install Windows using Boot Camp, or at least figure out how to switch from the EFI-mode Windows boot loader you've got now to a BIOS-mode boot loader. (This conversion is unusual and is poorly documented; I don't know of any sites that give step-by-step instructions for doing it. Unless you've got user data or extensive customizations, it's almost certainly easier to re-install Windows.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All,
I have a long winded puzzle, but before I put in all the info, my goal is to have a boot loader boot and be able to choose Ubuntu Linux, or Windows 7 (I'm no longer using Mac OS). I'm posting here for assistance since I know you folks are the pros as it relatest to booting macs. So here's what I have. iMac 27" with two internal drives. Depending on the mood of the mac (I kid you not) these will show up as /dev/disk0 and /dev/disk1, but they will sometimes swap. Here's what they look like from the mac side:
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme 1.0 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS Mavericks 97.9 GB disk0s2
3: Microsoft Basic Data Games 97.9 GB disk0s3
4: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 697.9 GB disk0s4
5: Microsoft Basic Data 106.1 GB disk0s5
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme 240.1 GB disk1
1: EFI EFI 209.7 MB disk1s1
2: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 119.7 GB disk1s2
3: Microsoft Basic Data Win7 120.0 GB disk1s3
0FC63DAF-8483-4772-8E79-3D69D8477DE4 on disk0 is a large ext3 partition, and, oddly, the same id on disk1 is my Ubuntu install. The same setup as seen from that Ubuntu install:
Model: ATA ST31000528AS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 20.5kB 210MB 210MB fat32 EFI System Partition boot
2 210MB 98.1GB 97.9GB hfs+ Mavericks
3 98.3GB 196GB 97.9GB ntfs Mav-Test msftdata
4 196GB 894GB 698GB ext3
5 894GB 1000GB 106GB ntfs msftdata
Model: ATA ST240HM000-1G515 (scsi)
Disk /dev/sdb: 240GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 20.5kB 210MB 210MB fat32 EFI System Partition boot
2 210MB 120GB 120GB ext3 Apple_HFS_Untitled_2
3 120GB 240GB 120GB ntfs Basic data partition msftdata
I've run the below from the Mac side after mounting /dev/disk1s1:
sudo bless --folder=/Volumes/efi --file=/Volumes/efi/EFI/ubuntu/grubx64.efi --setBoot
sudo bless --mount=/Volumes/efi --file=/Volumes/efi/EFI/ubuntu/grubx64.efi --setBoot
sudo diskutil unmount /Volumes/efi
sudo bless --device /dev/disk1s1 --setboot
After accidently booting into OS X, my current state is, if left alone on reboot, will from /dev/sdb3, which as shown above is Windows 7.
When holding the Alt/Option key on boot I am greeted with three entries:
Mavericks Windows EFI Boot
The first two go to the respective OS, while selecting EFI Boot takes me to a grub bootloader and I can get into Ubuntu Linux. Bless shows me this:
Boot option is 8BE4DF61-93CA-11D2-AA0D-00E098032B8C:Boot0080
Processing boot option 'Mac OS X'
Boot option matches XML representation
Found device: disk1s1
Disk boot device detected
mount: /Volumes/efi
Mount point for /Volumes/efi is /Volumes/efi
GPT detected
Booter partition required at index 2
System partition found
Preferred system partition found: disk0s1
Preferred system partition found: disk1s1
Returning booter information dictionary:
<CFBasicHash 0x7fee69e07900="" <span="">[0x7fff79d15f00]>{type = mutable dict, count = 3,
entries =>
0 : <CFString 0x10fff6e70="" <span="">[0x7fff79d15f00]>{contents = "System Partitions"} = (
disk1s1,
disk0s1
)
1 : <CFString 0x10fff7650="" <span="">[0x7fff79d15f00]>{contents = "Data Partitions"} = (
disk1s1
)
2 : <CFString 0x10fff7670="" <span="">[0x7fff79d15f00]>{contents = "Auxiliary Partitions"} = (
)
}
/dev/sda1 as seen from Ubuntu:
[08:52:21 iMac:/media/boot$] ls -lR
.:
total 1
drwxr-xr-x 3 root root 512 Jan 6 2014 EFI
./EFI:
total 1
drwxr-xr-x 3 root root 512 Jan 6 2014 APPLE
./EFI/APPLE:
total 1
drwxr-xr-x 2 root root 512 Jan 6 2014 EXTENSIONS
./EFI/APPLE/EXTENSIONS:
total 15361
-rwxr-xr-x 1 root root 15729264 Feb 15 08:00 Firmware.scap
/dev/sdb1 as seen from Ubuntu:
[08:53:15 iMac:/media/boot$] ls -lR
.:
total 1
drwxr-xr-x 6 root root 512 Jan 6 2014 EFI
./EFI:
total 2
drwxr-xr-x 3 root root 512 Dec 26 2013 APPLE
drwxr-xr-x 2 root root 512 Jan 6 2014 Boot
drwxr-xr-x 3 root root 512 Jan 6 2014 Microsoft
drwxr-xr-x 2 root root 512 Apr 19 2014 ubuntu
./EFI/APPLE:
total 1
drwxr-xr-x 2 root root 512 Dec 26 2013 EXTENSIONS
./EFI/APPLE/EXTENSIONS:
total 15361
-rwxr-xr-x 1 root root 15729264 Jan 6 2014 Firmware.scap
./EFI/Boot:
total 1324
-rwxr-xr-x 1 root root 1355736 Jan 6 2014 bootx64.efi
-rwxr-xr-x 1 root root 0 Jan 6 2014 bootx64.efi.grb
./EFI/Microsoft:
total 1
drwxr-xr-x 2 root root 512 Jan 7 2014 Boot
./EFI/Microsoft/Boot:
total 3132
-rwxr-xr-x 1 root root 672640 Jan 7 2014 bootmgfw.efi
-rwxr-xr-x 1 root root 0 Jan 6 2014 bootmgfw.efi.grb
-rwxr-xr-x 1 root root 1355736 Jan 6 2014 bootx64.efi
-rwxr-xr-x 1 root root 0 Jan 6 2014 bootx64.efi.grb
-rwxr-xr-x 1 root root 1178240 Jan 7 2014 MokManager.efi
./EFI/ubuntu:
total 4734
-rwxr-xr-x 1 root root 126 Jul 23 2014 grub.cfg
-rwxr-xr-x 1 root root 956792 Jul 23 2014 grubx64.efi
-rwxr-xr-x 1 root root 1178240 Jul 23 2014 MokManager.efi
-rwxr-xr-x 1 root root 1355736 Jan 6 2014 shimx64
-rwxr-xr-x 1 root root 1355736 Jul 23 2014 shimx64.efi
As stated at first above, my goal is to simply have grub pop up and be able to choose Ubuntu or Windows 7. Thanks for any insight you can give.
Some more intel on this. After using my phone to get a video of the errors I saw, I was getting the below on choosing EFI Boot:
Failed to open \EFI\BOOT\grubx64.efi
and referencing:
https://wiki.debian.org/GrubEFIReinstall
it appears that this mac doesn't implement EFI 100%, so eh...as of now I have a system booting direct to Ubuntu Linux, which is 50% of where I need to be...next is to have grub go to Windows 7, but that's not a discussion for this list. Hope this helps someone.
From your file lists, it looks like you're trying to boot Windows 7 in EFI mode on your Mac. This task is notoriously tricky to pull off. I used to have a bookmark to a Web forum page where this topic was discussed extensively, but I seem to have lost the link. Perhaps you can find it by Googling. The last I checked, though, the success rate was low. It's supposed to be easier to pull off with Windows 8, but I haven't studied the matter in any detail. Traditionally, booting Windows on Macs is handled via Boot Camp, which works by creating a hybrid MBR as a sort of trigger to enable BIOS support in the Mac's firmware and as a way to let Windows see the disk in a way that's helpful to it. This is a very kludgey solution, but it does work.
If you plan to remove OS X from the computer, the best way to dual-boot Linux and Windows on a Mac is to treat the computer as a BIOS system: Convert the disks from GPT to a pure MBR setup (you can use my
gdisk
to do this) and install a BIOS-mode version of GRUB on the disk. This way, you won't have the ugly and dangerous hybrid MBR lying around and you'll be able to manage your boot loaders in any of the well-documented ways for doing this on a BIOS-mode Linux/Windows dual-boot. When the Mac boots and sees a conventional MBR, it should try to boot it using its CSM, and everything should go smoothly. The trickiest parts of doing this will be converting your disks to a pure-MBR state and setting up a BIOS-mode boot loader. The former task, as I said, can be handled bygdisk
. The latter task can probably be done by Boot Repair.If you want to keep OS X around, I recommend you first read up on hybrid MBRs. Then understand that to boot Windows, your hybrid MBR must include the Windows boot partition. The EFI version of GRUB you're currently using can't boot a BIOS-mode boot loader, so it will be useless for booting Windows. You'll need to use the Mac's built-in boot manager, rEFIt, or rEFInd to control the boot process. You'll also need to re-install Windows using Boot Camp, or at least figure out how to switch from the EFI-mode Windows boot loader you've got now to a BIOS-mode boot loader. (This conversion is unusual and is poorly documented; I don't know of any sites that give step-by-step instructions for doing it. Unless you've got user data or extensive customizations, it's almost certainly easier to re-install Windows.)