Francesco de Gasperin ⋇ personal page

Here I explain for a moderately expert user, how to install Debian on a Macbook Pro 10,1 retina (MBPr). I must admit it was not easy (it took me a couple of days), but mainly because the laptop is very new and no much information is online so far (Oct. 2012). But I guess the support for the new hardware will improve quickly. The main issues are dealing with EFI and the lack of an ethernet card and of a cd reader, for this last reason you will also need three external USB sticks/hard drives (I guess there are smartest way to do all this using less USB sticks, but I actually had quite a lot of them around).

Installation:

First some operation on MacOS:

  1. Download recovery disk assistant and rEFInd (we will use the latter later).
  2. Then you would like to make a backup of your MacOS installation. You can use an external USB stick (you need 650 MB) or a partition on an external USB hard drive. In this last case you can use MacOS “disk utility” to partition the USB hard drive and create a 650 MB partition.
  3. Use “recovery disk assistant” to make a recovery image of MacOS on the USB stick or hard drive partition (it is straight forward). You will not be able to see this partition anymore with “disk utility”.

To recover MacOS from any disaster the procedure is also quite straight forward:

  1. boot holding the “alt” key and launch the recover partition already embedded in the hard drive of the MBPr. If for some reason you destroyed also this partition, then you can still
  2. boot holding the “alt” key with the USB recovery stick/hard drive plugged in and boot from this.

Now that we are a bit safer, with “disk utility” resize the MacOS partition to something like 100 GB and leave all the rest unpartitioned for linux (we are going to change it later).

From another linux box download the amd64 image of the testing release, then plug your second USB stick (in my case the device is /dev/sdc), and:

dd if=debian-testing-amd64-CD-1.iso of=/dev/sdc

then download the b43 firmware with

apt-get install b43-fwcutter

copy the firmware from /lib/firmware/b43/ to the third USB stick.

Boot the MPBr holting the “alt” key and boot the linux USB stick in text/expert mode and with the “noapic” version appended to the kernel parameters. Go until the “detect network” step and -before that- fire up a console, mount the USB stick with the firmware to whatever directory with

mount -t ext3 /dev/sdc1 /mnt

and copy all the firmware files to /lib/firmware/b43/ (you’ve to create it) and go back to “Detect network hardware”. Et voila’, the wireless works. Now go until the partition step, create a single partition for linux and set it to be the root partition and install the system into it. Arrive until the bootloader step and continue without it and eventually reboot. Now boot the linux USB stick again but in “rescue mode” (with noapic!), redo the firmware part in order to start the wireless and go to the “Detect disks” section and choose to open a shell in the root partition (sda4 in my case). Then:

  1. Add the “experimental” release to the /etc/apt/source.list.
  2. Add the “noapic irqpool” options in the /etc/default/grub file in the “GRUB_CMDLINE_LINUX” variable. This will add this two parameters to future command lines generated by grub. (NOTE: apparently with new kernels this is not necessary anymore)
  3. Get the latest kernel (I have used the 3.8.2) from kernel.org (to obtain the latest kernel you can follow this other post) and compile/install it with the usual make-kpkg procedure:
    fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
    I used as a config file the one shipped with the latest experimental kernel in Debian plus a “make oldconfig”.
  4. Finally install Grub (for EFI) with

    apt-get install -t experimental grub-efi
    mkdir /boot/efi
    mount /dev/sda1 /boot/efi # to mount the EFI partition

    it’s a good idea to add the relative entry to the fstab

    update-grub # to create the new grub.cfg
    grub-install --directory=/usr/lib/grub/x86_64-efi # to create a grubx86.efi image in /boot/efi/debian

Here some interesting info on this last part:
http://mennucc1.debian.net/macbook_linux_efi.html
http://dentifrice.poivron.org/laptops/macbookpro8,2/

Now if you want EFI to recognize the grub image you have to copy it to this path on the EFI System Partition: /boot/efi/boot/bootx64.efi. This is where the EFI firmware looks for a boot loader when it has not been configured for a specific path, typically on removable media. Alternatively, reboot in MacOS and install rEFInd from there. REFInd is extremely simple to install and saves a lot of headaches; in fact, it scans the EFI partition and makes all the images it finds “bootable” adding a nice interface for free.

Once rEFInd is installed, you should be able to find your kernel listed among Grub entries and boot it.

Configuration:

Sound:
it works out of the box, but pommed move the wrong channel, you can set the proper one from kmix.

Video:
Install the nvidia driver (I used those in testing) and run
m-a a-i -k <kernel dir> -l <kernel version> nvidia
to create/install the deb package. To activate the driver you also need a xorg.conf which specifies it (in my case, by default, I got the opensource driver loaded, which anyway works). Unfortunately with NVIDIA proprietary driver you loose the possibility to switch to the text console. This is not the case with the nouveau driver. On the other hand suspend to RAM seems to work only with NVIDIA driver.

Update (8/2014): I decided to switch to the nouveau driver. Suspend to RAM works as well as the monitor backlight and the HDMI. I actually find the driver more stable then the proprietary one. The change is easy. Just download the new xorg.conf, blacklist the nvidia (or remove it, otherwise be sure to un-blacklist nouveau) and just to be safe run: “update-alternatives –config glx”. Apparently it is also necessary to remove the “nomodeset” from the linux command line, in case you had it.

Update(8/2014): here is a working solution for the 100% cpu usage of kworker.

Touchpad:
It is recognized out of the box but if you want something more usable you have to specify some parameters in the xorg.conf.

Wireless:
It works out of the box. Sometimes it is really unstable.

Suspend to RAM:
It works with both nouveau and NVIDIA proprietary drivers.

iSight
It works but I had to turn on a couple of options in the kernel (uvcvideo related)

Thunderbold monitor:
It actually works, with the proper resolution using TwinView. Even the ethernet card embedded in the monitor is automagically recognized by Debian and works fine. The only drawback is that it works ONLY if you boot with the monitor already plugged in. This is clearly a major issue, but it is already much more than what I expected. Furthermore, the font dimensions, that you have to set pretty big in the retina display are ridiculously huge on the thunderbolt. Here some more detailed info.

I report propblems instead in running it with neuveau driver. The ethernet cable works, but not images are displayed.

Ethernet adapter:
Same issue of the thunderbolt monitor, it works as long as you boot with the adapter plugged in. Resuming after sleep also inhibit the use of the adapter and a reboot is required.

HDMI:
It works out of the box for the video. For the audio the easiest thing is to use pulseaudio for every application by putting

pcm.!default {
type pulse
}

ctl.!default {
type pulse
}

in your ~/.asoundrc configuration file. Then you can switch from the speaker to the HDMI output using pavucontrol.

Reboot
If I try to reboot I got a “invalid ROM content” error when the laptop restarts. The kernel options “i915.modeset=0 radeon.modeset=0” solve this problem.

Backlight
It works with the new pommed out of the box with nuouveau. For nvidia proprietary driver I have to run: “setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0”

Categories: Debian, Linux, Mac

Leave a Reply