MacBookPro10,x

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Tango-edit-clear.pngThis article or section does not follow the Laptop page guidelines.Tango-edit-clear.png

Reason: Stub (Discuss in Talk:MacBookPro10,x)

This page should help you set up Arch Linux on a MacBook Pro 10,1 with Retina display. Most of the steps are the same or very similar to the regular Arch Linux installation. However, because this is very new hardware, the setup requires a few different steps.

The general installation guidelines are described in Mac.

Note: To have all hardware supported, you should run this Notebook with Kernel 3.7 or newer.

Preparing for the Installation

Preparing the Hard drive

Assuming you want to dual boot with OS X, you have to shrink its partition with the Disk Utility. You can either create your Linux partition directly here, or do that later in Linux during the installation (using parted and mkfs).

Using the Thunderbolt to Ethernet adapter

As of late 2014, Thunderbolt hotplugging has been included in the mainline Linux kernel. Ethernet cables can now be used as usual through the Thunderbolt adapter. [1]

Using a USB-to-Ethernet adapter

No special configuration is necessary to get this to work.

Getting wireless firmware

In order for the Wi-Fi chipset to work, you need to get the firmware for it. You can just copy it from another b43-enabled Arch, extract it from Broadcom's driver using b43-fwcutter, or get the firmware through the b43-firmwareAUR package available in the AUR. In the end, you should have a folder named b43 with a lot of .fw files in it.

USB Tethering

If you have a smartphone, you can also try tethering your device to get connected to the internet. This should work out of the box.

Installation

Booting the live image

Download the latest ISO from the download page and prepare a live USB as outlined in USB flash installation media.

Shut down the MacBook. Plug in the USB drive. Hold the option key, then press the power button. After a few seconds, you should see Apple's boot loader display the choice of either starting up the built-in drive with OS X or the USB drive you plugged in.

Select the live USB with the arrow keys, and press Enter to boot into the live Arch Linux environment.

Note: You should not need to pass in any kernel parameters to boot successfully into the live environment.

Connecting to Wi-Fi

Note: You can skip this if you use the Thunderbolt or USB-to-Ethernet adapter for the installation.

After it has finished booting, enter a command line. Copy the entire folder with the firmware for your wireless card to /usr/lib/firmware/.

Now you should be able to use wifi-menu to connect to your Wi-Fi network.

The installation

Note: Refer to the Mac page if you do not want to have a separate partition for GRUB but rather prefer to use rEFInd (or rEFIt).

Run the installation wizard. When asked to partition your hard drive, create a small HFS partition. This is where you put the standalone GRUB package after the installation. The rest of the installation is pretty much the same as usual. When choosing the bootloader, select GRUB, and install it. Do not worry about any errors; we will create the bootable EFI image on our own afterwards.

After the installation has completed, directly copy the Wi-Fi firmware to the installed system to /tmp/install/usr/lib/firmware/.

Alternatively, install broadcom-wl-dkms from the AUR to improve Wi-Fi.

Bootloader

Direct EFI booting

See Arch boot process#Boot loader.

As of August 2013, refind can autodetect the Arch kernel, removing the need for copying the kernel into the EFI partition. Simply install refind and enable the "scan_all_linux_kernels" and "also_scan_dirs" options in refind.conf (see link above for instructions.)

GRUB

Another solution is to install GRUB. Edit /tmp/install/boot/grub/grub.cfg and edit the boot entry to load Linux mainline instead of the normal one. Also append noapic to the kernel line again.

Now cd into /tmp/install/ and create the GRUB image by calling:

grub-mkstandalone -o grub-standalone-x86_64.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi -C xz boot/grub/grub.cfg

This will create file called grub-standalone-x86_64.efi which contains GRUB and the config file. It is important to cd into the right directory to make it pick up the config file and put it into the right place within the image. Copy this file to the HFS partition you have created earlier. Downside of this method is that you need to repeat this step whenever you want to change the GRUB config.

Reboot the machine and boot into OS X. The HFS partition should be mounted and the GRUB standalone image in there. Follow the steps on this page to create the files needed to make the Apple boot loader pick up GRUB: https://mjg59.dreamwidth.org/7468.html. After creating the files, use bless on the GRUB image on the partition. If you want to boot automatically to Arch, append --setBoot.

After another reboot, you should be able to select your installed Arch Linux by keeping the alt button pressed while booting in case you have not used --setBoot while blessing.

Post installation

Wi-Fi

The Macbook Pro 10,x comes with the Broadcom BCM4331 Wireless Chipset.

There are two major options to get this chipset working in Arch Linux:

The b43-firmwareAUR package contains the open-source, reverse-engineered firmware for the chipset.

The broadcom-wl and broadcom-wl-dkms packages ship with the propriety, restricted-license drivers for the chipset.

See Broadcom wireless for more information.

Graphics

Note: In order to plug in an external display, you will need to have the NVIDIA card powered on as the HDMI and thunderbolt outputs are hardwired to use the NVIDIA card.

General Notes

The Laptop comes with an nVidia and an Intel chip. The Nouveau xf86-video-nouveau, the intel xf86-video-intel (from 3.6-rc5) and proprietary nvidia (from 302.17) drivers work. You can install the nvidia driver through nvidia or the AUR package nvidia-betaAUR.

Note: As of September, 2013 the current nvidia driver (325.15-5) does not work with the current 3.10 series kernels; X will die with an error about "Failed to allocate EVO core DMA push buffer" and leave you with a black screen (but able to SSH in to the machine). Your best current bet is to use a 3.9-series kernel and the older 319.32-series nvidia driver.

Since this device comes with a Retina (HiDPI) display, things may be really small with native resolution for some desktop environments. There are different ways to work around this "issue":

  1. Increase the DPI value to get larger fonts (other things like icons may not look great that way)
    • KDM is a great choice because the stock UI elements are vectors (not rasters which look terrible on Retina and do not scale infinitely). In addition the KWin compositor does a remarkable job on the Retina display.
  2. Lower the screen resolution to 1680x1050 (works fine at least with nouveau drivers), but things look a little bit blurry, of course
  3. Use xrandr scale option with nvidia driver to scale the resolution down to what you want. Take a look at: https://linuxmacbookproretina.blogspot.no/
  4. See HiDPI for more tweaks.

Nouveau backlight

If you are using the open-source Nouveau drivers and the active GPU is the Nvidia card, backlight levels can be adjusted by echoing a value to a file (as root):

echo 500 > /sys/class/backlight/gmux_backlight/brightness

To bring the backlight to its maximum level:

echo $(cat /sys/class/backlight/gmux_backlight/max_brightness) > /sys/class/backlight/gmux_backlight/brightness

NVIDIA backlight

If you are using the propriety nvidia drivers, note that the backlight adjustment will not work out of the box.

To enable backlight control (run as root):

setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0

Switching to/from GPUs with gpu-switch

You can switch the display output to and from the discrete or integrated intel GPU from within Arch Linux with gpu-switchAUR if you are using the open-source xf86-video-nouveau and xf86-video-intel drivers.

Installation

You can install gpu-switchAUR from the AUR.

Then, just run the script as root.

Usage

The command switches are -i, to switch to the integrated card, and -d for switching to the discrete GPU. In order to have the changes take effect, you will need to reboot.

Switch to Intel integrated GPU and turn off discrete Nvidia GPU

To switch to intel card and poweroff the discrete GPU:

cd /path/to/gpu-switch
./gpu-switch -i

Then reboot.

Poweroff the discrete GPU using vgaswitcheroo as root:

echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

This will take a second or to complete.

Then, check whether the discrete GPU is still on:

cat /sys/kernel/debug/vgaswitcheroo/switch

The output should look like this:

0:IGD:+:Pwr:0000:00:02.0
1:DIS: :Off:0000:01:00.0
2:DIS-Audio: :Off:0000:01:00.1

This is useful if you have opted to have an Arch Linux-only installation and cannot access the OS X-only tool iGPU.

Keeping the discrete GPU off at boot

If you want to keep the discrete GPU off at boot, see systemd-vgaswitcheroo-unitsAUR.

Graphic artifacting under b43-firmware

While on integrated graphics with the b43-firmware package, you might encounter moderate to severe graphic artifacting that appears to be correlated to wireless network traffic. (disconnected->no artifacting, connected->periodic artifacting, large transfer->severe artifacting/unusuable) This can be resolved by removing/blacklisting b43-firmwareAUR and using either broadcom-wl or broadcom-wl-dkms.

Enable Vsync

to prevent screen tearing, add this to /etc/X11/xorg.conf.d/20-intel.conf (create the file if it is not there already)

 Section "Device"
   Identifier "Intel Graphics"
   Driver     "intel"
   Option     "TearFree" "true"
 EndSection

and reboot

Sound and microphone

On the MacBookPro10,2 you may need to use the 'snd_hda_intel' driver with the model option 'mbp101'. This model option goes in the modprobe configuration; for example, add the following to /etc/modprobe.d/alsa-base.conf (forum post):

 options snd-hda-intel model=mbp101

Note this model option is undocumented in the list of models available online, but it works admirably. (Until you do this, the sound may seem fine through HDMI, but the built-in speakers and internal microphone may not work properly.)

Note: Reports as of September 2013 suggest this model option is no longer required and should work automatically; but as of October 2017 it still appears to be required for the microphone (but not the speakers).

For additional microphone troubleshooting tips, see Advanced Linux Sound Architecture/Troubleshooting#Microphone.

Touchpad

While xf86-input-synaptics will work, the integrated button of the touchpad may cause issues. Using the xf86-input-mtrack-gitAUR driver, with a tweaked configuration should lead to a better end result:

The following config uses a single touch for left, two for middle, three for right:

Section "InputClass"
    MatchIsTouchpad "on"
    Identifier      "Touchpads"
    Driver          "mtrack"
    Option          "Sensitivity" "0.65"
    Option          "IgnoreThumb" "true"
    Option          "IgnorePalm" "true"
    Option          "TapButton1" "1"  
    Option          "TapButton2" "3"
    Option          "TapButton3" "2"
    Option          "ClickFinger1" "1"
    Option          "ClickFinger2" "3"
    Option          "ClickFinger3" "2"
    Option          "BottomEdge" "25"
EndSection

To use natural scrolling, also add the following inside this section:

    Option          "ScrollDownButton"  "4"
    Option          "ScrollUpButton"    "5"
    Option          "ScrollLeftButton"  "7"
    Option          "ScrollRightButton" "6"

For more configurations, check the document of xf86-input-mtrack-gitAUR.

To disable the trackpad when typing, install the dispad-gitAUR utility.

Memory Card (SDHCI/SDX) Reader

There is currently a bug in the kernel (4.7.x) where the internal SD card reader times out.

As a workaround you will need to reload the sdhci kernel modules, as per: https://bugzilla.kernel.org/show_bug.cgi?id=73241#c55

 sudo rmmod sdhci-pci sdhci
 sudo modprobe sdhci debug_quirks2=4
 sudo modprobe sdhci-pci

What does not work (early August 2013, 3.10.3-1)

Graphics

  • Using vgaswitcheroo to switch between iGPU / dGPU on the 15" version will result in a black screen. The system is still running and can be rebooted safely.
    • The dGPU/nouveau is active on boot. As of 3.10.3-1, the only known way to switch to the iGPU/intel is to force this through gfxCardStatus v2.2.1 on MacOS (later versions of gfxCardStatus do *not* work.) This setting will survive reboots. To revert it, you must reboot into MacOS *twice* and/or reset the SMC (shutdown and press shift+control+alt+power at the same time. Press power again to boot.)
    • Another way to force iGPU/intel is to add following commands into one of the menuentry in grub.cfg,
      outb 0x7c2 1
      outb 0x7d4 0x28
      outb 0x7c2 2
      outb 0x7d4 0x10
      outb 0x7c2 2
      outb 0x7d4 0x40
      
      # Power down dGPU (will not work)
      #outb 0x7c2 1
      #outb 0x7d4 0x50
      #outb 0x7c2 0
      #outb 0x7d4 0x50
      

      The screen will remain blank until intel driver is fully loaded. Notice that dGPU will not be powered down (adding code above will prevent the system from booting up). Workaround is to compile and run following program (need sudo) after system is fully booted up.

      #include <stdio.h>
      #include <sys/io.h>
      
      #define GMUX_PORT_SWITCH_DISPLAY	0x10
      #define GMUX_PORT_SWITCH_DDC		0x28
      #define GMUX_PORT_SWITCH_EXTERNAL	0x40
      #define GMUX_PORT_DISCRETE_POWER	0x50
      #define GMUX_PORT_VALUE			0xc2
      #define GMUX_PORT_READ			0xd0
      #define GMUX_PORT_WRITE			0xd4
      
      #define GMUX_IOSTART		0x700
      
      typedef unsigned char u8;
      
      enum discrete_state {STATE_ON, STATE_OFF};
      enum gpu_id {IGD, DIS};
      
      static void index_write8(int port, u8 val)
      {
      	outb(val, GMUX_IOSTART + GMUX_PORT_VALUE);
      	outb((port & 0xff), GMUX_IOSTART + GMUX_PORT_WRITE);
      }
      
      static u8 index_read8(int port)
      {
      	u8 val;
      	outb((port & 0xff), GMUX_IOSTART + GMUX_PORT_READ);
      	val = inb(GMUX_IOSTART + GMUX_PORT_VALUE);
      
      	return val;
      }
      
      static void set_discrete_state(enum discrete_state state)
      {
      	if (state == STATE_ON) {	// switch on dGPU
      		index_write8(GMUX_PORT_DISCRETE_POWER, 1);
      		index_write8(GMUX_PORT_DISCRETE_POWER, 3);
      	} else {			// switch off dGPU
      		index_write8(GMUX_PORT_DISCRETE_POWER, 1);
      		index_write8(GMUX_PORT_DISCRETE_POWER, 0);
      	}
      }
      
      static u8 get_discrete_state()
      {
      	return index_read8(GMUX_PORT_DISCRETE_POWER);
      }
      
      static void switchto(enum gpu_id id)
      {
      	if (id == IGD) {	// switch to iGPU
      		index_write8(GMUX_PORT_SWITCH_DDC, 1);
      		index_write8(GMUX_PORT_SWITCH_DISPLAY, 2);
      		index_write8(GMUX_PORT_SWITCH_EXTERNAL, 2);
      	} else {		// switch to dGPU
      		index_write8(GMUX_PORT_SWITCH_DDC, 2);
      		index_write8(GMUX_PORT_SWITCH_DISPLAY, 3);
      		index_write8(GMUX_PORT_SWITCH_EXTERNAL, 3);
      	}
      }
      
      int main(int argc, char **argv)
      {
      	if (iopl(3) < 0) {
      		perror("No IO permissions");
      		return 1;
      	}
      
      	//switchto(IGD);
      	set_discrete_state(STATE_OFF);
      	//printf("Discrete state: 0x%X\n", get_discrete_state());
      
      	return 0;
      }

      For further information, please read apple-gmux driver inside linux kernel tree.

    • "rmmod nouveau" will crash if the dGPU is manually powered off via vgaswitcheroo. Once this happens, it will be impossible to shutdown / reboot cleanly. Fresh patches (2 August) will hopefully fix this in the future. (Note: to enter this failure state, you must use gfxCardStatus to force the iGPU, then use vgaswitcheroo explicitly. This is rather uncommon.)
    • The dGPU / iGPU issues do not affect the 13" rmbp, which only has an intel adapter. Much simpler!
  • Nvidia drivers 319.32 fail to suspend / resume or control the backlight out of the box.
    • Nouveau and intel work fine.
  • If you are experiencing problems with Nvidia drivers, try using emulated BIOS boot instead of EFI boot.

Discussions

Here are a couple of interesting threads:

See also

  • A Puppet module for installing and configuring Arch (optionally with KDE) on the MBP Retina 10,2, along with initial install instructions, is available at [2]. It is updated quite frequently, and run daily on its author's laptop.