knutster Posted August 3, 2011 Share Posted August 3, 2011 I recently decided to blow away everything on my Macbook Pro 15" (late 2007) and install Lion and Ubuntu 11.04 in a dual boot fashion. I won't go into the details of installing Ubuntu on this particular machine here, but in the end I had the setup I wanted with rEFIt's gptsync updating my MBR properly and me able to dual boot either via rEFIt or holding the option key during boot and selecting the "Windows" partition. I then had the bright idea to enable Filevault full disk encryption. Unfortunately this: a ) resets the MBR to its virgin state making option-booting only find Lion. b ) hides rEFIt inside the encrypted partition making it non-viable. No worries, methinks, we'll just pop this puppy on the hidden /dev/disk0s1 EFI partition. After some incantations and blessing which can be Googled this was working fine. Alas, gptsync is not happy! gptsync: GPT partition of type 'Unknown' found, will not touch this disk. A quick diskutil list reveals that the once proud Lion HFS+ partition has now been converted to a partition of type Apple_CoreStorage and gptsync has no clue. After downloading the source to refit 0.14 I found the gpt partition types in lib.c in the gptsync directory. The new partition type for CoreStorage is not there and can be found with the following: vishnu:tools knut$ sudo gpt -r show -l /dev/rdisk0 start size index contents 0 1 MBR 1 1 Pri GPT header 2 32 Pri GPT table 34 6 40 409600 1 GPT part - "EFI System Partition" 409640 156250000 2 GPT part - "Lion" 156659640 1269536 3 GPT part - "Recovery HD" 157929176 1954 4 GPT part - "GRUB BIOS BOOT" 157931130 585938 5 GPT part - "LINUX BOOT" 158517068 154064691 6 GPT part - "LINUX LVM" 312581759 16 312581775 32 Sec GPT table 312581807 1 Sec GPT header vishnu:tools knut$ sudo gpt -r show /dev/rdisk0 start size index contents 0 1 MBR 1 1 Pri GPT header 2 32 Pri GPT table 34 6 40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B 409640 156250000 2 GPT part - 53746F72-6167-11AA-AA11-00306543ECAC 156659640 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC 157929176 1954 4 GPT part - 21686148-6449-6E6F-744E-656564454649 157931130 585938 5 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 158517068 154064691 6 GPT part - E6D6D379-F507-44C2-A23C-238F2A3DF928 312581759 16 312581775 32 Sec GPT table 312581807 1 Sec GPT header 53746F72-6167-11AA-AA11-00306543ECAC is the id we're looking for, note that the first three blocks need to be reversed when you put it in lib.c. It thus becomes: 726F74536761AA11AA1100306543ECAC After rolling around on the floor with various versions of Xcode and gnu-efi to get this sucker compiled I finally gave up and went for plan B. I got out Hex Fiend (Mac hex editor) and replaced the tag for the Apple Raid (Offline) partition with the above in gptsync.efi on my blessed /efi partition. So I replaced this: 444941524F5FAA11AA1100306543ECAC with 726F74536761AA11AA1100306543ECAC (two matches). After a reboot gptsync detects the Apple_CoreStorage partition as Apple Raid (Offline) and generates an MBR that works fine for option-booting or rEFIt booting my Linux partition. rEFIt can be removed at this point but I'll keep it hanging around on the EFI partition in case I need it later. I'm too lazy to file a bug on rEFIt to get Apple_CoreStorage fixed, maybe someone else feels like doing it. Attached is a version of gptsync.efi that can be used to generate a working MBR for a Filevault 2 enabled system on Lion. Don't blame me if things start burning or melting. gptsync.zip Link to comment Share on other sites More sharing options...
mister walter Posted August 18, 2011 Share Posted August 18, 2011 How did you get rEFIt working on your EFI partition? I copied the efi folder from the rEFIt disk image to the EFI partition and blessed it, however when I reboot my computer, it just sits there at a white scree. By the way, Filevault can't be enabled when a hybrid MBR is present on the main HD. A quick gdisk allowed me to enable Filevault again. Link to comment Share on other sites More sharing options...
kami83 Posted August 29, 2011 Share Posted August 29, 2011 Hi, maybe someone can tell me somethings to my Problem: http://www.insanelymac.com/forum/index.php?showtopic=266712 it is nearly the same. Thanks a lot. Cu kami Link to comment Share on other sites More sharing options...
macphire Posted September 3, 2011 Share Posted September 3, 2011 How did you get rEFIt working on your EFI partition? I copied the efi folder from the rEFIt disk image to the EFI partition and blessed it, however when I reboot my computer, it just sits there at a white scree. By the way, Filevault can't be enabled when a hybrid MBR is present on the main HD. A quick gdisk allowed me to enable Filevault again. I got this working by doing the following... as root mkdir /efi mount -t msdos /dev/disk0s1 /efi (then I copied the refit folder and tools to /efi/EFI/) (then copied new gptsync to tools folder) bless --mount /efi --setBoot --file /efi/EFI/refit/refit.efi --labelfile /efi/EFI/refit/refit.vollabel rebooted and it worked.. I have filevault 2 enabled dual boot with LMDE and haven't had any problems.... Link to comment Share on other sites More sharing options...
kami83 Posted September 3, 2011 Share Posted September 3, 2011 Hi, thanks a lot. I did it the same way and it works fine. Cu kami Hi, i have got now a new problem. I am trying to boot the Linux Partition, but i think i failed to install the bootloader correctly. Temporaly i always get: No bootable device -- inser boot disk and press any key I tested lilo and grub. Like described in this guides: http://en.gentoo-wiki.com/wiki/Apple_Macbook_Pro#LILO http://spurint.org/misc/installing-gentoo-on-a-macbookair31/ Maybe someone can tell me how to install the Linux bootloader on the Linux partition. Thanks a lot. Cu kami Link to comment Share on other sites More sharing options...
Daniel Smedegaard Buus Posted June 2, 2012 Share Posted June 2, 2012 Hi I was wondering if I could ask for your help in regards to the hacked gtpsync.efi you posted here. Anyway, I've created a couple of rEFIt boot options (a small internal partition on my SSD, and a USB stick just to be sure) with your gptsync.efi embedded. Thing is, rEFIt still says it won't touch the disk because of the "unknown" partition that is my CoreStorage cipher device. It's like I never copied your file to the rEFIt installation, except I just confirmed that I did. Your file has an md5 of f24c268f93c3e4bdb6298ec18f696e77 while the original from rEFIt 0.14 has an md5 of 9d014c1ac440be83908cc46032a7e8b0. So I can say most definitely that your gptsync.efi is the one on my rEFIt boot partition at /efi/tools/gptsync.efi. I've managed to be able to boot into Linux by using gdisk in a live cd to create a hybrid MBR, but I'm unable to boot Mac OS X. I get the password prompt, then Apple logo and the spinning wheel. Eventually the Apple logo becomes the no-smoking-minus-the-cigarette sign, and the system hangs. Any idea what might be wrong? Thank you Daniel Link to comment Share on other sites More sharing options...
Daniel Smedegaard Buus Posted June 3, 2012 Share Posted June 3, 2012 Hmmm, okay. I think I now know why rEFIt won't touch my disk. My FileVault partition has a somewhat - ahem - different GUID: Command (? for help): i Partition number (1-6): 2 Partition GUID code: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF (Unknown) Partition unique GUID: 00003C8E-06B9-0000-C45A-0000EE5C0000 First sector: 409640 (at 200.0 MiB) Last sector: 448297871 (at 213.8 GiB) Partition size: 447888232 sectors (213.6 GiB) Attribute flags: 0000000000000000 Partition name: 'Macintosh HD' Why the fudge would it be like that? That looks like an error. Can't say that I'm 100% sure this is the original GUID given to the partition by Mac OS X, but it's not given by the Kubuntu installer. I backed up the GPT before installing, but after using gparted to add two partitions for Linux in the empty space. So gparted might've messed up something here. I'm gonna try to see if I can manually alter the GUID using gdisk or another tool. Link to comment Share on other sites More sharing options...
Daniel Smedegaard Buus Posted June 3, 2012 Share Posted June 3, 2012 Okay, so I'm now up and running. What I did was basically make a backup of the existing partition table using gdisk from my Ubuntu live stick. I then installed bless (not to confuse with bless on OS X — on Ubuntu it's a hex editor ) and manually changed the garbled FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF GUID for the correct one, saved it and used gdisk again to restore the GPT on disk from the one I just edited. It'll complain that the CRC is not matching, but being gdisk, it'll just fix it when you save. Mac OS X would now boot, and rEFIt would recognize the partition as Apple CoreStorage, but still it wouldn't touch the disk, claiming "Analysis inconclusive". As rEFIt already can't properly create a working hybrid MBR in my case (it just picks up the first four GPT partitions and makes them the MBR partitions, which isn't good in my case, because my boot partition is #5 and my Linux cipher device is partition #6), I just thought, "Well f**k you then," and booted back into my Ubuntu live environment, where I used gdisk to manually create my hybrid MBR. At least it lets me pick which partitions go in the MBR. Now everything works, but I'm left wondering what the point of rEFIt really is, besides some kind of miniscule rescue environment if you don't want to use a Linux live environment or similar. Not once in this process of installing Kubuntu have I actually used rEFIt for anything — all it's been contributing with is making me do risky partitioning to accomodate it, make boot times longer and work hard to accomodate it to do what... Nothing in the end. The regular Apple EFI boot screen already offers me to boot into all recognized partitions on both internal and external storage, so it's not like I need it for triple-booting either. Am I missing something? It just seems like a piece of software made for previous generation of Macs that didn't do dual- or triple- or quadruple-booting on their own. Well, anyway, don't think I'll bother removing it either. It's just a 64 MB partition squeezed in between my filevault partition and my Linux ones. It can stay there if it likes Link to comment Share on other sites More sharing options...
Recommended Posts