Page 1 of 5 123 ... LastLast
Results 1 to 10 of 46

Thread: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

  1. #1
    Join Date
    Jun 2013
    Beans
    21

    MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    Hi everyone,

    I have had a very hard time getting Linux to run on a MacBook Pro 8,2 in EFI mode. I finally managed to collect all the snippets of information at various places and was able to set it up properly. This howto works at least for this specific machine:

    MacBook Pro 8,2
    Intel(R) Core(TM) i7-2675QM CPU @ 2.20GHz
    ATI Radeon HD 6750M 8GB Ram
    500 GB HDD
    1680x1050 non-glare display

    Result: I can boot into MacOS (EFI), Ubuntu (EFI) with i915 chipset enabled and radeon disabled, and Ubuntu (EFI) with radeon enabled.


    READ THIS FIRST

    This Howto is specifically addressing issues that arise when trying to install Ubuntu Linux 13.04 on a MacBook 8,2, however, it has been confirmed as working also for installing Ubuntu Linux 13.10, and for me the system still works after the upgrade to 13.10 (and even better). To determine which revision of MacBook you have, click in OS X on the Apple on the top left, then “About this Mac” -> “More Info” and see the generation in the “Model Identifier” row. The 8,2 revision has proven to be especially stubborn not to allow Linux to be run on it, and the tweaks contained in the installation section may not apply to other revisions.


    INSTALLING UBUNTU


    Preparing the boot medium

    You should only attempt this after a fresh install of MacOs. Not doing so may result in undesired effects. After you have completed the fresh install of MacOS, boot with the MacOS Installation CD and start the disk utility app from the menu instead of re-installing MacOS again (who would want to do it twice anyway). Resize the MacOS partition reasonably to make space for the Ubuntu installation. Reboot into MacOS. Get Ubuntu ISO image from here: http://www.ubuntu.com/download/desktop, be sure to select the 64bit version. Convert the .iso file to .img using the convert option of hdiutil in terminal:
    Code:
     hdiutil convert -format UDRW -o /<target directory>/target.img /ubuntu.iso
    Note: OS X tends to put the .dmg ending on the output file automatically, but that doesn't hurt. Plug in an USB thumb drive - beware: the following steps will erase all data on the USB thumb drive, so make sure you don't have anything important on it. Run
    Code:
    diskutil list
    and determine the device node assigned to your flash media (e.g. /dev/disk2) To unmount the flash drive, run
    Code:
    diskutil unmountDisk /dev/disk<N>
    (replace <N> with the disk number from the last command; in the previous example, <N> would be 2). Execute
    Code:
    sudo dd if=/<target directory>/target.img.dmg of=/dev/rdisk<N> bs=1m
    whereas <N> is the disk number identified above. Run
    Code:
    diskutil eject /dev/disk<N>
    Leave the USB stick plugged as we want to boot from it soon.


    Install a proper Boot Manager

    Now get rEFInd from here: http://sourceforge.net/projects/refi...2.zip/download If MacOS does not do that automatically, then extract it. Navigate to the extracted folder in Terminal, and issue
    Code:
    ./install.sh
    If prompted for your password, enter it. Then do
    Code:
    sudo mkdir -p /EFI/refind/drivers
    cp  /refind/drivers_x64/ext4_x64.efi /EFI/refind/drivers/.


    Start the Installation

    Reboot your MacBook. The rEFInd boot menu should appear. Select the Ubuntu EFI image for boot. When GRUB has loaded, make sure you highlight „Try out Ubuntu“ boot entry and hit the „e“ key to edit the boot line in order to fix broken graphical output with standard options. Add the following lines after „load_video“:
    Code:
    outb 0x728 1
     outb 0x710 2
     outb 0x740 2
     outb 0x750 0
    This will turn off the radeon GPU to avoid conflicting GPUs resulting in no output at all.
    It has been reported that "load_video" is non-existant in the current install medium's grub configuration. It should work if you put it after "set gfxpayload=keep" as well.

    Furthermore, in the kernel line, add after „quiet splash“:
    Code:
     i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0


    Double check you typed everything correctly! If you're done, hit F10 to boot. Once Ubuntu has loaded (it will take a short while), select „Install Ubuntu“ from the desktop. Follow the installation instructions. I created a 512 MB boot partition with ext4 starting after 128MB of free space after the MacOS partition (MacOS likes to have 128MB of free space after its partition for no apparent reason), and the rest I used for „/“, also ext4. Assign the mount points („/boot“ for the boot partition, „/“ for the other one). You might want to add another partition for swap, but with 4 GB of RAM you should be alright even without, with 8 GB in any case. Do as you deem reasonable. Do not mount the MacOS partition or the EFI partition. I recommend to encrypt your /home folder.


    Setting up Ubuntu to actually work


    Once completed, you can reboot. The MacBook will boot directly into GRUB. Now highlight the first line (Ubuntu) again and press „e“. Add the same „outb“ lines and kernel parameters as set forth above to the boot menu entry. After having logged in to gnome, start a terminal. You can also use a virtual console instead of logging in to gnome by pressing CTRL-ALT-F1 of course, as we don't need GUI for now. First of all we'll need to get rid of the boot menu editing, as that can become highly tedious. We do:
    Code:
     sudo nano /etc/default/grub
    Change the line „GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash“ to
    Code:
    „GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0“
    Uncomment (remove the "#" before) the line "GRUB_TERMINAL=console".

    Exit with CTRL-X and confirm saving the changes without changing the output name. Then do:
    Code:
    sudo nano /etc/grub.d/10_linux
    Locate the line
    Code:
    echo "    insmod gzio" | sed "s/^/$submenu_indentation/"
    with CTRL-W (you can use the string „gzio“). Immediately BEFORE this line, enter the following so it looks like this:
    Code:
    echo "    outb 0x728 1" | sed "s/^/$submenu_indentation/"
      echo "    outb 0x710 2" | sed "s/^/$submenu_indentation/"
      echo "    outb 0x740 2" | sed "s/^/$submenu_indentation/"
      echo "    outb 0x750 0" | sed "s/^/$submenu_indentation/"
    echo "    insmod gzio" | sed "s/^/$submenu_indentation/"
    ...
    Thx hyao2 for telling me how to fix no-show of grub menu!
    Again, double check your edits carefully. Save and close this file too with CTRL-X. Now you can do
    Code:
    sudo update-grub
    to make the changes show up in the grub menu. Next we should update the system by doing
    Code:
    sudo apt-get update 
    sudo apt-get dist-upgrade
    After that, reboot the system. When the screen goes black and turns bright again, hit and hold the „ALT“ key to bring up the Apple bootloader. It will show the option „EFI BOOT“. Select it and rEFInd is there again. Boot into MacOS and re-run the rEFInd installation routine again in terminal:
    Code:
    cd <directory to which refind has been unpacked>/refind/
    ./install.sh
    If you now reboot, you will get to the rEFInd menu without having to press „ALT“. Note that you should see at least 6 big boot options in rEFInd (as of June 2013). The first one is Ubuntu loading via GRUB, followed by MacOS. Then there should be at least two (depending on how many kernel upgrades you have made) penguin icons which may not be able to be properly booted. To the right there should be at least two additional Ubuntu Icons. With them, you can load the respective Ubuntu kernel directly via EFI stub. The difference between those and the left Ubuntu icon is, that with the left one we'll get to GRUB which we configured to turn off the ATI GPU. This will allow Ubuntu to make use of the integrated i915 GPU, resulting in 10 to 20 degree less temperature and higher battery life. However, the GRUB menu is no longer shown after re-installing rEFInd, I have yet to discover why the screen goes blank for the duration the GRUB menu is displayed (which I assume it is). If you wait for like 10 seconds without pressing a key, the Ubuntu loading screen appears. Should you need higher GPU performance for whatever reason, you can boot the most current kernel via the appropriate right icon. This will activate the ATI GPU, but will also result in higher temperature. I hope this saves some people the time I had to spend to get this up and running! I have yet to dig into the vgaswitcheroo configuration which I have seen reported to be working under certain circumstances. For now the selecting at boot time already exceeds my expectations and is absolutely sufficient for me.

    NOTE: with kernel 3.13 dynamic power management got introduced into the kernel, to make use of this feature and greatly enhance battery runtime under EFIStub, edit the kernel options line from within rEFInd and append
    Code:
    radeon.dpm=1
    For now, this will have to be done each time you boot via EFIStub, until I have time to figure out how to add that permanently.

    Enabling External Monitor via Displayport

    So far accessing an external monitor works only when booting with radeon enabled (as the i915 sadly does not have any access to the MacBook’s displayport). Though it didn’t work for me at first, it suddenly started working after I had fiddled around with the drivers for a bit. I’m not sure what actually enabled the displayport, I would get only a black screen before, but after this it worked:
    Code:
    sudo apt-get install fglrx-amdcccle-updates fglrx-updates
    (This was executed in radeon enabled mode) I rebooted into radeon enabled mode, and ended up with a X-error resolving routine that looked like it was part of gnome or lightdm. I exited to the console, deinstalled the proprietary drivers (who would want those anyway) by doing
    Code:
    sudo apt-get remove –purge fglrx-amdcccle-updates fglrx-updates
    and rebooted again into radeon enabled mode. I started up gnome to check if it was a KDE related thing, plugged the monitor in, and there you go, display is automatically extended to the external display. I logged out, and it worked in KDE too. No idea what made it work, but it works now!


    Enabling CD Eject Key in KDE


    Right-click on the Kickoff Application Launcher, select "Edit Applications". Navigate to the System group, select "New Item" from the icon bar. You can name the new item "Eject" like I did or whatever you like. A description could be "Eject CD". The command to be run is "eject /dev/sr0". Un-check the "Enable launch feedback" checkbox. Save. Go to the "Advanced" tab, and click on the shortkey button. Hit the Eject CD key on your MacBook Pro's keyboard, it should register as "eject". Save again and exit. It should work now (it does for me at least).


    Stuff that works out of the box for me:

    Display backlight adjustment
    Sound Volume adjustment
    Webcam
    Microphone
    Suspend to RAM and Resume (so far no crashes)
    WLAN
    Bluetooth
    iPhone Tethering via Bluetooth and USB works flawlessly too if you install
    Code:
    sudo apt-get install ipheth-utils libimobiledevice-dev libimobiledevice-utils

    Since upgrade to 13.10:

    SD Card Reader
    Keyboard Backlight hotkeys


    To be fixed:
    Enabling proprietary drivers for AMD GPU in EFI STUB boot mode. So far I seem to use out of the box drivers that don't really provide a benefit over using the i915 chipset performance-wise. Installing the fglrx driver via jockey-kde leads to system crash upon boot (which can be fixed by removing fglrx after booting into grub mode). I didn't have much time to spend on this issue yet, though.


    To be tried:
    Setting up vgaswitcheroo for dynamic GPU switching.

    Edit: After upgrading to 13.10 (replacing all packets with packet maintainer's version and re-applying changes to /etc/grub.d/00_header), keyboard backlight setting via function keys works, too, as does the SD Card Reader.
    Last edited by whatsamac; May 12th, 2014 at 10:29 AM.

  2. #2
    Join Date
    Nov 2011
    Beans
    2,336
    Distro
    Ubuntu

    Re: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    Thanks for this. I followed a similar path to get 13.04 on my 8.2 with the Intel graphics. Then, botched it by adding and removing Gnome. When my patience returns, I'll follow your steps.

    I also needed to do the outb bit resuming from suspend, otherwise it would try to use the Radeon.

  3. #3
    Join Date
    Jun 2013
    Beans
    21

    Re: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    Oh right, I have yet to test if it wakes up correctly from suspend if I booted with radeon enabled. So far I'm only using the Grub boot version with disabled radeon... Edit: Ok I got so nervous and curious that I needed to test it right away. I tested it two times, one time even with a running virtual machine (win7 on virtualbox). Both times it worked flawlessly - of course that has no statistical relevance, but it is proof of concept that it won't fail EVERY time. Note that I get a temperature of 50°C in i915 mode with plain desktop and no running programs, whereas the temperature is around 75°C now that I booted with radeon and don't have any programs running. The temperature drop is really significant So far I have not experienced a lockup or black screen on resume either way with this installation.
    Last edited by whatsamac; June 27th, 2013 at 03:49 PM.

  4. #4
    Join Date
    Nov 2011
    Beans
    2,336
    Distro
    Ubuntu

    Re: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    There's code here (http://blog.tkassembled.com/364/inte...-pro-in-linux/) that handled suspend for me. The rest of the article didn't pan out for me.

    My temps on Intel were at 50C or just below, at idle. I did a long compile and they spiked in the 80's.

    The Radeon is unusable on Linux. Temps spike and the fans max out with any activity.

    I also had to block updates to the default kernel installed on 13.04. It wouldn't boot with an updated kernel.

  5. #5
    Join Date
    Jun 2013
    Beans
    21

    Re: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    Really? Temperature goes high indeed with radeon enabled, but performance is good, too. I am running on 3.8.0-25 without any issues so far.

  6. #6
    Join Date
    Nov 2011
    Beans
    2,336
    Distro
    Ubuntu

    Re: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    Performance with the Radeon is fine. It's just way too hot and way too noisy.

    Good to know about the 3.8.0-25 kernel. I don't think I got that far in the upgrades. I remember the initial apt-get upgrade bumped the 3.8.0-19 a bit, and the machine would not boot.

    I *think* Apple released two very slightly different machines under the 8,2 label. That might account for differences in behavior, as well as for howto's that work for some and not for others.

  7. #7
    Join Date
    Jun 2013
    Beans
    21

    Re: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    Might be there are two slightly different machines, that would explain why I couldn't get it to work with any of the tutorials out there so far. I'm still struggling to enable an external Monitor - I've got it plugged into the displayport via a displayport->DVI adapter, which works under MacOS. But under Ubuntu the kde system settings recognize it and it gets enabled, but there is no output. The workspace is appropriately enlarged, but with no graphical output on the screen that doesn't really help. Any ideas anyone? This is the same if booting in i915 mode or with radeon enabled.

  8. #8
    Join Date
    Jun 2013
    Beans
    21

    Re: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    Though it didn’t work for me at first, it suddenly started working after I had fiddled around with the drivers for a bit. I’m not sure what actually enabled the displayport, I would get only a black screen before, but after this it worked:

    Code:
    sudo apt-get install fglrx-amdcccle-updates fglrx-updates
    (This was executed in radeon enabled mode) I rebooted into radeon enabled mode, and ended up with a X-error resolving routine that looked like it was part of gnome or lightdm. I exited to the console, deinstalled the proprietary drivers by doing

    Code:
    sudo apt-get remove –purge fglrx-amdcccle-updates fglrx-updates
    and rebooted again into radeon enabled mode. I started up gnome to check if it was a KDE related thing, plugged the monitor in, and there you go, display is automatically extended to the external display. I logged out, and it worked in KDE too. No idea what made it work, but it works now!

    Last thing that remains for me now is to configure X to actually use the radeon driver, so far I get lower FPS on benchmarks that I ran when I booted with radeon than when I booted in i915 mode o.O despite setting "radeon" and forcing gallium3d in xorg.conf, this does not seem to have any effect. I don't really want to install fglrx, as for my purposes open-source drivers are probably performing sufficiently as long as dual screen works, but surely they'll perform better than the i915 chipset?
    Last edited by whatsamac; July 1st, 2013 at 03:13 PM.

  9. #9
    Join Date
    Jun 2013
    Beans
    21

    Re: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    Another short update: I just updated to Kernel 3.8.0-26, both GRUB (i915) boot and EFI STUB (radeon) boot work for me with this kernel update.

  10. #10
    Join Date
    Jul 2013
    Beans
    1

    Re: MacBook Pro 8,2: howto for dual boot Ubuntu/MacOS EFI

    I cannot get Ubuntu to show up in the boot loader as an option. I've followed your instructions exactly, as well as the last post here. I continue to get "legacy OS" as the other option to boot from. It goes away after unplugging the usb stick and of course comes back as an option after plugging it in and refreshing. After formatting the drive (per the linked post recommendation) this is what I have below. Am I suppose to do something different with this legacy option? If I select it, it doesn't work and says its not bootable and drops to a prompt. I did convert the download like you said and I did download the mac desktop version.

    /dev/disk1
    #: TYPE NAME SIZE IDENTIFIER
    0: GUID_partition_scheme *3.9 GB disk1
    1: EFI 209.7 MB disk1s1
    2: Apple_HFS 3.6 GB disk1s2

Page 1 of 5 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •