Debian on MacBook Pro Retina 15″

This is a fast&furious how-to about installing Debian on a MacBook Pro Retina 15″ bought on January, 2014¹.
Please note that this how-to may become outdated: last update happened on 16 April, 2014.
Please note that this how-to involves dangerous operations: if you choose to follow this how-to your car may burn, your cat may rape your sister and you may buy a windows phone… no warranty!

I choose to install Debian Jessie 8.0 because:

  • it offers better support to the MBP Retina recent hardware
  • it isn’t actually the stable release but it is pretty stable
  • Jessie will be freezed on November 5 (“Remember, remember, the fifth of November!”) and will become the next stable release in about a year (May 2015)

Installing Debian on MacBook Pro Retina:

  1. download the Debian Jessie testing image (http://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-dvd/) and create a bootable USB (dd if=debian-testing-amd64-DVD-1.iso of=/dev/sdX)
  2. boot your macbook pro holding down command+R
  3. use the disk utility, select the disk on the left panel (for example “251GB APPLE SSD”)
  4. on the partition scheme resize the “Macintosh HD” partition, drag the bottom right edge of the partition scheme up unless you have enought space for Debian (I’ve reserved only 50 GB to MacOSX because I really don’t use it), apply
  5. insert the Debian USB, reboot and hold down the options key (aka alt), remember to connect the LAN adapter before boot to Debian installer (hotplug wont work and wifi needs a non-free firmware), use tg3 as kernel module for ethernet adapter if requested
  6. select the EFI Boot relative to your Debian USB key and continue with the Debian installer (please note that I’ve selected XFCE on advanced options as Desktop Environment)
  7. when the installer arrives at the partitioning step select to proceed manually
  8. you can create the common partitions (boot, swap, root) but I suggest to setup an encrypted system²
  9. complete the install and reboot, you can’t boot Debian at this point, boot MacOS and go further…
  10. download the rEFInd USB bootable version (http://www.rodsbooks.com/refind/) and create a bootable USB
  11. insert the rEFInd USB, reboot and hold down the options key (aka alt)
  12. select the EFI Boot relative to your rEFInd USB key, rEFInd should permit to you to boot your Debian
  13. if you can boot your Debian by the rEFInd USB key just return to MacOS and install rEFInd permanently (it’s easy and a good tutorial is available on its website)

Complete the installation:

  1. update your apt sources.list to include the non-free packages
  2. install additional packages³: apt-get install firmware-linux-nonfree broadcom-sta-dkms
  3. reboot to use wifi and lan adapter
  4. to avoid random controller freeze you need to set a particular kernel boot option, edit /etc/default/grub and add the option libata.force=noncq (es. GRUB_CMDLINE_LINUX_DEFAULT=”quiet libata.force=noncq”) then reboot your system

Please note that the Intel video card works flawlessly, the Retina display is simply awasome but… but you need to adapt your desktop environment to use it on an high (very high) resolution (2880×1800), stay tuned, I will post about XFCE optimization for high DPI display as soon as I can! actually after some time spent to try to adapt XFCE on high resolution I’ve choose anyway to reduce the resolution to 1920×1200 mainly because most of the websites are not ready for high resolutions (low res design). This is not an XFCE fault, XFCE works well with high resolution4.

Please note that if you make use of kvm virtual machines you can be really disappointed about poor performance (install system base of Debian may take hours): don’t worry, you have to use the ext4 mount options nobarrier or barrier=0. If your vm is already installed simply update its /etc/fstab configuration. It’s a little more difficult to apply barrier=0 during installation:

  1. start Debian installer on the virtual machine and go further
  2. when the filesystem is ready (aka when the installation of base system starts) use CTRL+ALT+2 combo to move on the kvm console
  3. type sendkey ctrl-alt-f2 to move on another terminal of the vm
  4. use CTRL+ALT+F1 to comeback on the vm and press enter to start activate the command line
  5. execute the command mount -o remount,barrier=0 /target to disable the ext4 barrier feature
  6. use CTRL+ALT+F2 combo to return on the kvm console
  7. type sendkey ctrl-alt-f1 to return on the usual installation wizard of the vm
  8. use CTRL+ALT+F1 to comeback on the vm and complete the installation

If you want to use an external monitor no problem, just apply your custom setup with the xrandr command, for example:
xrandr --output DP1 --mode 1920x1080 --output eDP1 --mode 1920x1200 --below DP1
Run xrandr without arguments to list your screen(s), their names and their available modes.

Happy hacking!

2014-03-21 added libata.force=noncq custom kernel option
2014-03-21 added some info about my challenge to use XFCE on Retina
2014-03-21 added some note about problems about KVM virtual machines
2014-04-13 added some info about the use of an external monitor
2014-04-16 fixed some typos and fixed last update date

¹lspci of the MacBook Pro Retina 15″ used to produce this tutorial:

00:00.0 Host bridge: Intel Corporation Crystal Well DRAM Controller (rev 08)
00:01.0 PCI bridge: Intel Corporation Crystal Well PCI Express x16 Controller (rev 08)
00:02.0 VGA compatible controller: Intel Corporation Crystal Well Integrated Graphics Controller (rev 08)
00:03.0 Audio device: Intel Corporation Crystal Well HD Audio Controller (rev 08)
00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05)
00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)
00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d5)
00:1c.2 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 (rev d5)
00:1c.3 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 (rev d5)
00:1c.4 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #5 (rev d5)
00:1f.0 ISA bridge: Intel Corporation HM87 Express LPC Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)
02:00.0 Network controller: Broadcom Corporation BCM4360 802.11ac Wireless Network Adapter (rev 03)
03:00.0 Multimedia controller: Broadcom Corporation Device 1570
04:00.0 SATA controller: Samsung Electronics Co Ltd Apple PCIe SSD (rev 01)
05:00.0 PCI bridge: Intel Corporation Device 156d
06:00.0 PCI bridge: Intel Corporation Device 156d
06:03.0 PCI bridge: Intel Corporation Device 156d
06:04.0 PCI bridge: Intel Corporation Device 156d
06:05.0 PCI bridge: Intel Corporation Device 156d
06:06.0 PCI bridge: Intel Corporation Device 156d
07:00.0 System peripheral: Intel Corporation Device 156c
08:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]
09:00.0 PCI bridge: Intel Corporation DSL3510 Thunderbolt Controller [Cactus Ridge]
0a:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM57762 Gigabit Ethernet PCIe

²create an encrypted system

  1. create a small ext4 boot partition (1G)
  2. create an encrypted partition in the remaining space
  3. create an LVM group in the encrypted partition
  4. create two logical LVM partitions: the swap partition (double the size of your RAM), the root ext4 partition

³firmware package includes tg3 and broadcom package build the wl module needed for the wifi card

4you need to properly set the XFCE dpi option and you need to rebuild the composer theme because it uses raw images to compose its windows (download source package xfwm4-themes, edit the theme makefile and do some imagemagick tricks, feel free to ask if you are interested)

Tags: , , , , ,

About Giulio Turetta

Sviluppo e curo siti web dal 1998, amo internet e le opportunità che ci offre. Grazie anche a te, che fai parte di questo mondo fantastico.

17 responses to “Debian on MacBook Pro Retina 15″”

  1. Ahmed says :

    Is it worth it to buy a macbook pro and install Debian on it?

    I’m upgrading from Lenovo T400, and everything worked out of the box except amd driver.

    • Giulio Turetta says :

      Hi Ahmed, the anwser is “maybe”. Pro: the design of the macbook is fantastic, it’s light and thin, its screen is definitely better than any other laptop, it’s also silent due to the aluminium chassis and the overall quality is higher. Con: its price, it’s not expandable (on the latest models you can’t add more ram, it’s soldered!), no wired network card, no cdrom/dvd reader

      • cobbaut says :

        I also have Debian on MBP (retina 11,2).

        No wired network card…but the dongle is cheap. It has to be connected before you boot though.

        I don’t use grub because refind boots the kernel. I added this line to rc.local to prevent the random ssd freeze:
        echo 1 > /sys/block/sda/device/queue_depth

        xfce does not give me an option to reboot/suspend/switch user. All three options are greyed out. Otherwise it works like a charm!

        paul

      • Giulio Turetta says :

        Hi Paul! Thank you for your comment.
        I’ll try your solution for the SSD problem as soon as possibile.
        I don’t remember how but there is a way to enable reboot and user switching with xfce (you need to install additional packages).
        About the suspend functionality, it was not actually tested by me. I’ll give it a try as soon as possibile.

  2. Ahmed says :

    Is it worth it to buy a MacBook Pro and install Linux on it?

    I’m upgrading from T400, and I want a nice laptop to use

  3. Andrea Benfatti says :

    Hi, i’m going to install debian on my macbook pro retina 15″, have you found some bugs, i have installed ubuntu and i have problem with battery life, sleep mode and second screen. Have you tried this function on your mac?

    • Giulio Turetta says :

      Hi Andrea, the main problem is having to connect the ethernet adapter before boot (same problem with internal sd card reader).
      By the way I have no other problems to report: Debian Jessie works flawlessly on battery for ~6 hours and I can setup my external monitor without problems by the xrandr command (ex. xrandr –output DP1 –mode 1920×1080 –output eDP1 –mode 1920×1200 –below DP1).

      • cobbaut says :

        Depending on how I connect an external display (or projector) I issue (as normal user, not as root):
        xrandr –output DP1 –right-of eDP1
        xrandr –output HDMI1 –right-of eDP1
        xrandr –output HDMI2 –right-of eDP1

        Just typing xrandr will tell you how the second display is connected.

      • Andrea Benfatti says :

        thank for reply, in this week a try to install Debian on my macbook following your tutorial. I hope i never have problem.

      • Andrea Benfatti says :

        There is a method to install debian without ethernet adapter? i don’t own it an i would not buy it only for install debian.

  4. Andrea Benfatti says :

    i have install debian on my mac bookpro retina 15″ but i have some problem at the first boot, when i choose debian on grub it start to boot and when should appear the login screen i get a black screen, do you know some solution?

    • cobbaut says :

      @Andrea: Make sure you have a recent kernel (3.13.x).
      Also, I don’t use grub because refind can boot the Linux kernel without grub. (Google refind for instructions)

  5. Andrea Benfatti says :

    i don’t think that grab is a probem. I think that some xorg configuration is wrong but i can’t access to debian in command-line mode and i can’t see log file

  6. Giulio Turetta says :

    @Andrea have you tried pressing ATL+CTRL(+FN)+F1 to move to another console? Have you installed Debian Jessie? Which iso?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: