Difference between revisions of "MacBook"

From ArchWiki
Jump to: navigation, search
(update Pkg/AUR templates to reflect new package status)
(grub from [core] provides grub-efi-x86_64)
Line 214: Line 214:
 
=== Installing GRUB to EFI partition directly ===
 
=== Installing GRUB to EFI partition directly ===
  
* If you would like to use GRUB as your main bootloader and use the "boot while holding the Alt/Option key" method to go back to Mac OS X rather than using alternatives such as rEFIt (http://refit.sourceforge.net/, mentioned previously in [[#BIOS-compatibility]] and [[#Mac OS X, Windows XP, and Arch Linux triple boot]]) then you must install {{Pkg|grub-efi-x86_64}} to your Mac's '''already-existing''' EFI partition (see below).  
+
* If you would like to use GRUB as your main bootloader and use the "boot while holding the Alt/Option key" method to go back to Mac OS X rather than using alternatives such as rEFIt (http://refit.sourceforge.net/, mentioned previously in [[#BIOS-compatibility]] and [[#Mac OS X, Windows XP, and Arch Linux triple boot]]) then you must install {{Pkg|{{Pkg|grub}} to your Mac's '''already-existing''' EFI partition (see below).  
  
 
{{Note| These instructions are known to work on a Macbook Pro (Early 2011). Please read the procedure carefully '''as well as the details following it'''.}}
 
{{Note| These instructions are known to work on a Macbook Pro (Early 2011). Please read the procedure carefully '''as well as the details following it'''.}}
Line 220: Line 220:
 
'''Procedure''':
 
'''Procedure''':
  
* Install {{Pkg|grub-efi-x86_64}}
+
* Install {{Pkg|{{Pkg|grub}}
  
 
* Make a directory named {{ic|efi}} in {{ic|/boot}}  
 
* Make a directory named {{ic|efi}} in {{ic|/boot}}  
Line 241: Line 241:
 
'''Details (quoted from [https://wiki.archlinux.org/index.php/GRUB_EFI_Examples#M5A97]):'''
 
'''Details (quoted from [https://wiki.archlinux.org/index.php/GRUB_EFI_Examples#M5A97]):'''
  
Finish the standard Arch install procedures, making sure that you install {{Pkg|grub-efi-x86_64}} and partition your boot hard disk as GPT.
+
Finish the standard Arch install procedures, making sure that you install {{Pkg|{{Pkg|grub}} and partition your boot hard disk as GPT.
  
 
From [https://wiki.archlinux.org/index.php/Grub#Install_to_UEFI_system_partition]:
 
From [https://wiki.archlinux.org/index.php/Grub#Install_to_UEFI_system_partition]:

Revision as of 10:32, 3 November 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Installing Arch Linux on a MacBook (Pro) is quite similar to installing it on any other computer. However, due to the specific hardware configuration on a MacBook, there are a few deviations and special considerations which warrant a separate guide. For more background information, please see the Installation Guide, Beginners' Guide. This guide contains installation-instructions that can be used on any Apple computer whose hardware is supported by the Linux kernel. Please see 'related' pages (on the top right of this page) for model-specific tips and troubleshooting.

Overview

Specifically, the procedure for installing Arch Linux on a MacBook is:

  1. Install OS X: Regardless of the desired end-configuration, it helps to start from a clean install of OS X.
  2. Firmware update: This should help reduce errors and provide newer features for the hardware.
  3. Partition: This step either resizes or deletes the OS X partition and creates partitions for Arch Linux.
  4. Install Arch Linux: The actual installation procedure.
  5. Post-install configuration: MacBook specific configuration.
Tip: rEFIt is a popular bootloader for EFI-firmware computers (including Macs). It can be installed at any time during the installation. For instructions, please see #rEFIt.

Installation of Mac OS X and firmware update

Apple has excellent instructions for installing OS X. Follow their instructions. Once OS X is installed, go to Apple Menu > Software Update and update all software. Once this has run, you will need to reboot your computer. Do this, and then run Software Update again to check to make sure that all updates have been installed.

If you are not going to have OS X installed, make backups of these files:

/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport

You will need this file later for iSight functionality.

/Library/ColorSync/Profiles/Displays/<FILES HERE>

You will need the file(s) here for adjusting the color profile.

Partitions

The next step in the installation is to re-partition the hard drive. If OS X was installed using the typical procedure, then your drive should have a GPT format and the following partitions:

  • EFI: a 200 MB partition at the beginning of the disk.It is often read as msdos or FAT by some partitioning tools and usually labeled #1.
  • Mac OS X: the (HFS+) partition that should take up all of the remaining disk space. Usually labeled #2.
  • Recovery: A recovery partition (only for Mac OS X 10.7+).

How to partition depends on how many operating systems you want install. The following options will be explained:

If you do not know which option to pick, we recommend the dual boot so you can still return to OS X whenever you want.

Arch Linux only

This situation is the easiest to deal with. Mostly, partitioning is the same as any other hardware that Arch Linux can be installed on. The only special consideration is the MacBook firmware boot sound. To ensure that this sound is off: mute the volume in OS X before continuing further. The MacBook firmware relies on the value in OS X, if available. Note that if you choose to get rid of the OS X partition, there is no easy way to update your machines firmware unless you use an external drive to boot OS X. You can boot in EFI mode (recommended) or bios-compatibility mode, if in doubt choose EFI.

To install using EFI, follow the instruction to make a EFI bootable media. Once done double check that your USB key actually boots in EFI mode checking the EFI kernel variables. You will need to format the EFI partition with the hfsplus filesystem (hfsprogsAUR) instead of vfat otherwise mactel-bootAUR will fail, and in Macbooks you cannot use efibootmgr.

EFI

  • This requires GRUB to work
  • Boot installation medium and switch to a free tty.
  • Run cgdisk (gptfdisk package).
  • Create the necessary partitions.
Note:
  • The swap partition is optional, on machines with a RAM of size 4GB or more, good performance can be expected without a swap partition. Also, a swap file can be created later, see Swap file.
  • For more information on partitioning, see Partitioning hard disks: General information.

Simple example (no LVM, crypto):

partition  mountpoint  size    type  label
/dev/sda1  /boot/efi   200MiB  vfat  EFI
/dev/sda2  /boot       100MiB  ext2  boot
/dev/sda3  -           adjust  swap  swap
/dev/sda4  /           10GiB   ext4  root
/dev/sda5  /home       remain. ext4  home

BIOS-compatibility

  • Boot installation medium and switch to a free tty.
  • Run parted. The simplest way is to change the partition table to msdos and then partition as normal. GRUB is compatible with GPT.
  • Create the necessary partitions.

Mac OS X with Arch Linux

The easiest way to partition your hard drive, so that OS X and Arch Linux will co-exist, is to use partitioning tools in OS X and then finish with Arch Linux tools.

Warning: It is highly recommended that this only be attempted after a clean install of OS X. Using these methods on a pre-existing system may have undesired results.
Note: If you have any problems, try using gparted (i.e. instead of using Disk Utility and/or cgdisk). It is capable of shrinking the OS X partition and creating Linux partitions ready for installation.

Procedure:

  • In OS X, run Disk Utility.app (located in /Applications/Utilities)
  • Select the drive to be partitioned in the left-hand column (not the partitions!). Click on the partition tab on the right.
  • Select the volume to be resized in the Volume scheme.
  • Decide how much space you wish to have for your OS X partition, and how much for Arch Linux. Remember that a typical installation of OS X requires around 15-20 GiB, depending on the number of software applications and files.
  • Finally, type the new (smaller) size for the OS X partition in the size box and click Apply. This will create a new partition out of the empty space. You will delete this partition later.
Note: if you wish to have a shared partition between OS X and Arch Linux, then additional steps will need to happen here. Please see #HFS partition sharing.
  • If the above completed successfully, then you can continue. If not, then you may need to fix your partitions from within OS X first.
  • Boot the Arch install CD by holding down the alt key during Boot. Follow one of the procedures below according to your choice of boot-method.

EFI

  • Run cgdisk
  • Delete the partition you made in Disk Utility.app and create the necessary partitions for Arch Linux. OS X likes to see a 128 MiB gap after partitions, so when you create the first partition after the last Mac OS X-partition, type in +128M when cgdisk asks for the first sector for the partition. A simple example (no LVM, crypto):
Note:
  • The swap partition is optional, on machines with a RAM of size 4GB or more, good performance can be expected without a swap partition. Also, a swap file can be created later, see Swap#Swap file.
  • If you want to be able to boot GRUB from the Apple boot loader, you can create a small hfs+ partition (for convenience, use OS X to format it in Disk Utility.app afterwards). Follow the GRUB EFI install procedure, and mount your /boot/efi directory to the hfs+ partition you created. Finally, finish up again in OS X by blessing the partition. This will set GRUB as the default boot option (holding alt at startup goes to the mac boot options screen still. See http://mjg59.dreamwidth.org/7468.html)
  • For more information on partitioning, see Partitioning.
  • OS X's EFI partition can be shared with archlinux, making the creation of an additional EFI partition dedicated to arch completely optional
partition  mountpoint  size       type  label
/dev/sda1  /boot/efi   200MiB     vfat  EFI
/dev/sda2  -           ?          hfs+  Mac OS X
/dev/sda3  -           ?          hfs+  Recovery
/dev/sda4  -           100MiB     hfs+  Boot Arch Linux from the Apple boot loader (optional)
/dev/sda5  /boot       100MiB     boot  boot
/dev/sda6  -           ?          swap  swap (optional)
/dev/sda7  /           10GiB      ext4  root
/dev/sda8  /home       remaining  ext4  home

BIOS-compatibility

  • Run parted as root.
  • Delete the empty space partition and partition the space as you would for any other installation. Note that MBR is limited to 4 primary partitions (including the efi partition). That leaves 2 primary partitions for arch. One strategy is to have a system and home partition, and use a swap file (I have not tried to use logical partitions). Another is to dedicate one partition to a shared partition (see below).
  • Next, create new filesystems on those partitions which need them, especially the partition which will contain /boot. If you're not sure how to do this using mkfs.ext2 (or whatever), run /arch/setup and work through until you get to Prepare Hard Drive and use the "Manually configure block devices..." option, then exit the installer. This is necessary so that rEFIt will set the right partition type in the MBR in the next step (without an existing filesystem, it seems to ignore the partition type set by parted), without which GRUB will refuse to install to the right partition.
  • At this point you should reboot your computer and have rEFIt fix the partition tables on your hard drive. (If you do not do this, you may have to reinstall GRUB later on in order to have your Mac recognize the Linux partition.) When you are into the rEFIt menu, select update partition table, then press Y. Reboot.

Mac OS X, Windows XP, and Arch Linux triple boot

This may not work for everyone but it has been successfully tested on a Macbook from late 2009.

The easiest way to partition your hard drive, so that all these operating systems can co-exist, is to use disk utility in Mac OS X, use the formatter on windows XP install CP, and then finish with Arch Linux tools.

Warning: It is highly recommended that this only be attempted after a clean install of Mac OS X. Using these methods on a pre-existing system may have undesired results. At least back your stuff up with timemachine or clonezilla before you begin.

Procedure:

  • In Mac OS X, run Disk Utility (located in /Applications/Utilities).
  • Select the drive to be partitioned in the left-hand column (not the partitions!). Click on the partition tab on the right.
  • Select the volume to be resized in the volume scheme.
  • Decide how much space you wish to have for your Mac OS X partition, how much fo XP, and how much for Arch Linux. Remember that a typical installation of Mac OS X requires around 15-20 GiB, and XP about the same, depending on the number of software applications and files. Something like OSX 200Gb, XP 25Gb, Arch 25Gb should be fine.
  • Put your decisions into action by pressing the + button and adding the new partitions, Label them as you like and make sure that your XP partition is the last one on the disk and is formatted for FAT32. It is probably best to have Arch formatted in HFS format as to not confuse you later, it will be reformatted anyway.

So in linux terms your partitions will be something like:

  • sda (disk)
  • sda1 (Mac boot partition - you cannot see this one in OSX)
  • sda2 (OSX install in HFS+)
  • sda3 (Arch install temporarly in HFS)
  • sda4 (XP install in FAT32)
  • Finally, click apply. This will create a new partition out of the empty space.
Note: Using this method you may not be able to have a shared partition between Mac OS X and Arch Linux, this is because the mac will only allow for 4 active partitions. You will however be able to mount a HFS partition in Arch for one workaround. There are other workarounds possible also.
  • If the above completed successfully, you can continue. If not, then you may need to fix your partitions from within Mac OS X first.
  • You will not be needing boot camp this way, the program rEFIt is much more flexible (though not as flexible as GRUB). Download and install rEFIt [[1]]
  • Go into a terminal in OS X and perform the following, this will enable the rEFIt boot manager.
cd /efi/refit
./enable.sh
  • Reboot to check the rEFIt is working, it should appear on boot. When it comes up go to the rEFIt partition manager and agree to the changes.
  • Put your XP install CD and boot it with rEFIt - You may have to reboot a few times until it is recognized by the boot loader. Install XP and once it is installed use the OSX install CD to get your drivers running nicely in XP.
    • Note: when installing XP make sure you select your XP partition and format it again inside the XP installer. If you do not reformat it will not work.
  • Boot the Arch install CD, log in as root and run # /arch/setup.
  • Follow the install as normal but note that you will have to tell that arch installer to mount sda3 as the root partition and format it as ext3, there will not be a /boot or swap partition so ignore those warnings.
  • At this point, if you are dual booting, you should reboot your computer and have rEFIt fix the partition tables on your hard drive. (If you do not do this, you may have to reinstall GRUB later on in order to have your Mac recognize the Linux partition.) When you are into the rEFIt menu, select update partition table, then press Y.
# reboot
  • Done! You can continue to #Installation but make sure you read #Booting directly from GRUB for the stage "* (for booting with EFI) After the install boot loader stage, exit the installer and install GRUB."

Booting directly from GRUB

Installing GRUB to EFI partition directly

Note: These instructions are known to work on a Macbook Pro (Early 2011). Please read the procedure carefully as well as the details following it.

Procedure:

  • Make a directory named efi in /boot
  • Mount the already-existing EFI partition on your Mac to this /boot/efi directory
  • Install GRUB to this directory
  • Make a directory named locale in /boot/grub
  • Copy grub.mo from /usr/share/locale/en\@quot/LC_MESSAGES/ to /boot/grub/locale
  • Generate a configuration for GRUB
  • Done! GRUB will now start on reboot and you can boot into your newly installed Archlinux.
  • Remember to hold ALT/Option key while starting your computer if you want to boot back into Mac OS X.


Details (quoted from [2]):

Finish the standard Arch install procedures, making sure that you install {{{1}}}

Then, reboot.

Bluetooth

Note: Bluetooth should work out-of-the box. The hid2hci utility is used by default since bluez 4.91

See the article on Bluetooth to install and configure all software needed.

Webcam

iSight

Note: Linux kernel from 2.6.26 includes the Linux UVC driver natively. MBP 6.2+ (Kernel ~2.6.37+) iSight works out of the box without the need to use firmware from OS X.

You can use many applications to test the camera:

  • MPlayer
# mplayer tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 -fps 30
  • Cheese
  • Skype
  • Ekiga

A simple solution to take snapshots is:

# mplayer tv:// -vf screenshot

and the pressing the s key to take a snapshot. Files are of the format shot\d\d\d\d.png and are reported in the standard output.

Facetime HD

The Facetime HD webcam (included on 2013 MBAs onwards) is no longer UVC device, and therefore, does not work out of the box.

Temperature Sensors

For reading temperature just install and configure lm_sensors. See Lm sensors page.

Color Profile

We can use color profiles from Mac OS.

First, install xcalibAUR from the AUR.

Second copy pre-saved color profiles placed in /Library/ColorSync/Profiles/Displays/ on Mac OS partition to ~/colorprofiles/ for example.

There are color profile files agree with in MacBook models; select the right one:

  • Color LCD-4271800.icc for MacBook Pro with CoreDuo CPU
  • Color LCD-4271880.icc for MacBook with Core2Duo
  • Color LCD-4271780.icc for MacBook (not Pro) based on CoreDuo or Core2Duo.
Tip: Also Mac OS allows to save current color profile from Displays > Color section of the Mac OS System Preferences, in this case file is saved to /Users/<username>/Library/ColorSync/Profiles.

Finally you can activate it by running

# xcalib ~/colorprofile.icc
Note: Previous command set the color profile only for the current session; this mean that you must run it every time you login in your system. For automating it you can execute the command by Autostart Application, concording with your DE (or add the command to your login manager's initialization script, e.g. /etc/gdm/Init/Default).

Apple Remote

First, to correctly install and configure the lirc software that control IR see Lirc wiki.

Then make LIRC use /dev/usb/hiddev0 (or /dev/hiddev0) by editing /etc/conf.d/lircd. Here is how mine look:

#
# Parameters for lirc daemon
#
LIRC_DEVICE="/dev/usb/hiddev0"
LIRC_DRIVER="macmini"
LIRC_EXTRAOPTS=""
LIRC_CONFIGFILE="/etc/lirc/lircd.conf"

Use irrecord (available when installing lirc) to create a configuration file matching your remote control signals (alternatively, you can try to use the lircd.conf below):

# irrecord -d /dev/usb/hiddev0 -H macmini output_conf_file

Start lircd and use irw to check if it works.

Example of an /etc/lirc/lircd.conf:

begin remote

  name  lircd.conf.macbook
  bits            8
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  pre_data_bits   24
  pre_data       0x87EEFD
  gap          211994
  toggle_bit_mask 0x87EEFD01

      begin codes
          Repeat                   0x01
          Menu                     0x03
          Play                     0x05
          Prev                     0x09
          Next                     0x06
          Up                       0x0A
          Down                     0x0C
      end codes

end remote

HFS partition sharing

First, we need hfsprogsAUR package from AUR.

we have to list our partitions. Use

fdisk -l /dev/sda

example output:

# fdisk -l /dev/sda
    Device  Boot     Start         End      Blocks   Id  Type
 /dev/sda1               1          26      204819   ee  GPT
 /dev/sda2              26       13602   109051903+  af  Unknown
 /dev/sda3   *       13602       14478     7031250   83  Linux
 /dev/sda4           14478       14594      932832+  82  Linux swap / Solaris

As we see, the "Unknown" partition is our OS X partition, which is located in /dev/sda2.

Create a "mac" folder in /media:

# mkdir /media/mac

Add at the end of /etc/fstab this line:

/dev/sda2    /media/mac     hfsplus auto,user,rw,exec   0 0

Mount it :

mount /media/mac

and check it:

ls /media/mac

HFS+ Partitions

HFS+ partitions, now the default in Mac OS X, are not fully supported by Linux and are mounted as read-only by default. In order to write to an HFS+ partition, it is necessary to disable journaling. This can be accomplished using Mac OS X Disk Utility. Refer to this Apple support page for more information.

Home Sharing

UID Synchronization

In OS X

Note: It is strongly recommended that UID/GID manipulation be done immediately after a new user account is created, in OS X as well as in Arch Linux. If you installed OS X from scratch, then this operation is guaranteed to work after logging into your account for the first time.
Step 1: change UID and GID(s)

Pre-Leopard

  1. Open NetInfo Manager located in the /Applications/Utilities folder.
  2. If not done for you already, enable access to user account transactions by clicking on the closed lock at the bottom of the window, and entering your account password, or root password if you have created a root account.
  3. Navigate to /users/<new user name> where <new user name> is the name of the account that will have read/write access to the folder that will be shared with the primary user in Arch.
  4. Change the UID value to 1000 (the value used by default for first user created in Arch).
  5. Also change the GID value to 1000 (the value used by default for user account creation in Arch).
  6. Navigate to /groups/<new user name>, automatically saving the changes you have made so far.
Note: If you get an error message that the transaction is not allowed, log out and log back in.

Leopard

In Leopard, the NetInfo Manager application is not present. A different set of steps is required for UID synchronization:

  1. Open System Preferences.
  2. Click on Users & Groups.
  3. Unlock the pane if not already done so.
  4. Right-click on the desired user and select Advanced Options.
  5. Write down the value of the User ID field, you will need it later on. Change both the UID and GID to match the UID and GID of the account wished to be shared with in Arch (1000 by default for the first user created in Arch).
Step 2: change "Home" permissions
  1. Open up Terminal in the /Applications/Utilities folder.
  1. Enter the following command to reclaim the permission settings of your home folder, replacing <your user name>, <your user group> and <your old UID> with the user name whose UID and GID values you just changed, the group name whose GID value you just changed and the old UID number, respectively.
# find /User/<your user name> -user <your old UID> -exec chown <your user name>:<your user group> {} \;

In Arch

To synchronize your UID in Arch Linux, you are advised to perform this operation while creating a new user account. It is therefore recommended that you do this as soon as you install Arch Linux.

Now you must substitute Arch's home with Mac OS's home, by modify entries of /etc/fstab.

Avoid long EFI wait before booting

If your Macbook spends 30 seconds with "white screen" before booting you need to tell the firmware where is the booting partition.

Boot Mac OS X, if do not have it installed, you can use the install DVD (select language, then click Utilities->Terminal), or another MacBook with Mac OS X (connect the two computers via firewire or thunderbolt, start the other Macbook keeping pressed T, boot your MacBook keeping pressed Options).

Either way, once you got a Mac OS X terminal running on your MacBook you need to execute, as root, a different command if the boot partition is EFI or it is not:

# bless --device /dev/disk0s1 --setBoot            # if the booting partition is EFI

or

# bless --device /dev/disk0s1 --setBoot --legacy   # if the booting partition is not EFI

(given that if your GRUB or EFI is on sda1, /dev/disk1s2 if it is on sdb2, etc). See also https://bbs.archlinux.org/viewtopic.php?pid=833215 and https://support.apple.com/kb/HT1533 .

Mute startup chime

If you forgot to mute before installing, you can still mute again if you have a Mac OS X install disk. Boot from it, select language, then click Utilities > Terminal, and enter

# /usr/bin/nvram SystemAudioVolume=%01

(or whatever volume you want).

rEFIt

Note:
  • You probably want to have a look at refind, which is some type of successor of rEFIt.
  • This is not a requirement. It only gives you a menu to choose between OS X and Arch Linux upon every boot.

For more see, refit myths.

In OS X, download the ".dmg" from Refit Homepage and install it.

Note: If you have already partitioned your hard disk in preparation for the Arch installation, rEFIt may not be enabled by default. You will have to run the "enable.sh" script installed in /efi/refit/.

Open up Terminal and enter:

cd /efi/refit;
./enable.sh

Problems with rEFIt

If you experience problems after the install of Arch or rEFIt, especially is the right OS is not showing up to boot to or if it dumps you at a GRUB prompt stuck like the following:

GRUB>_

Then have a look at this link:

http://mac.linux.be/content/problems-refit-and-grub-after-installation

It can give you a basic idea on how to boot off the Arch live cd, mount the problem Arch install, chroot, use gptsync, and reinstall GRUB. This is probably for more advanced users who can translate the commands from a debian system to an Arch system and also apply it to the partitions on their machine. Be careful not to install GRUB in the wrong spot.

If you need a copy of gptsync you can wget it from here: http://packages.debian.org/sid/gptsync or try these, for 64 bit:

wget http://ftp.us.debian.org/debian/pool/main/r/refit/gptsync_0.14-2_amd64.deb

and for i386:

wget http://ftp.us.debian.org/debian/pool/main/r/refit/gptsync_0.14-2_i386.deb

since they are .deb packages you will need the program deb2targzAUR.

Model-specific information

MacBook

Mid 2007 13" - Version 2,1

Note: I used the 201212 ISO image.
Warning: Current linux-3.8.x packages do not work with their EFI stub and refind-efi. Either use an older package (linux 3.7.10-1 works with refind-efi 0.6.8-1) or you may use a bootloader which does not rely on EFI stub. Similiar issues are reported with gummiboot.

Since older Macbooks have a 32bit EFI running, the usual installation image is not recognized. You need to either remove the UEFI support from the disc (Unified_Extensible_Firmware_Interface#Remove_UEFI_boot_support_from_ISO) or build a 32bit EFI version of the disc. The paragraphs below will take the first path to success, booting into BIOS mode and its pitfalls. For a try the other way round, read Unified_Extensible_Firmware_Interface#Create_UEFI_bootable_USB_from_ISO first.

First prepare your harddisc according to your wishes. In this scenario it was a "Linux only" approach with

/dev/sda1 HFS+ AF00 200M -> EFI boot system on Apple HFS+ partition
/dev/sda2 ext4 8300 147G -> arch system
/dev/sda3 swap 8200 1G   -> swap

The hfsprogsAUR package contains the tools to handle HFS/HFS+ filesystems. The rEFInd bootloader recognizes it on its own. Usually the partition for the EFI bootloader is a FAT32 (vfat) partition. In this case I tried rEFIt first, which apparently needs the HFS+ filesystem to work, and kept it at that.

The mount points are:

/dev/sda2 -> /
/dev/sda1 -> /boot/efi

The bootloader in use was rEFInd instead of rEFIt. To install it, the rEFInd homepage provides a good guide. The pitfall here is, that the system bootet in BIOS compatibility mode and not in EFI mode. You can't therefore use efibootmgr, because the EFI variables (even with 'modprobe efivars') are not available. While installing the system get mactel-bootAUR from the AUR. The hfs-bless utility comes in handy, when blessing the EFI bootloader. This is done by calling e.g.:

hfs-bless /boot/efi/EFI/refind/refind.efi

Since the Linux kernel does come with EFI stub enabled, it seemed a good idea to run it through a bootloader first. Especially if it runs not out of the box. But using rEFInd makes GRUB (or any other bootloader) obsolete, because of that.

Not running out of the box is unfortunately the initial stage for the kernel. Since we installed it in BIOS mode, two modules are missing to grant access to the root partition while booting. Hence the 'initfsram-linux.img' can not be found/loaded. Adding the following modules to your 'MODULES' line in /etc/mkinitcpio.conf solved this (original post).

/etc/mkinitcpio.conf
MODULES="ahci sd_mod"

Rebuild your kernel image:

mkinitcpio -p linux

The bootloader rEFInd can scan kernels even out of the '/boot/efi/...' directory and assumes an efi kernel even without the extension '.efi'. If you don't want to try out special kernels, this should work without the hassle to copy each kernel after building to some spot special.

If you happen to get multiple entries for one boot image, it often results of a previous installation of a bootloader within the MBR. To remove that, try the following - taken from the original post. This is valid for GPT partitioned discs, so please check your environment and save your MBR first.

# dd if=/dev/zero of=/dev/sda bs=440 count=1

MacBook Pro

10,1

MacBook Air

Mid 2013 13" - Version 6,2

Dedicated forum thread

Installing and booting

Booting from a normal 2013.6 USB key works fine, but I couldn't seem to get either GRUB or Syslinux working.

I was able to boot by first installing Arch Linux following the Macbook guide at the wiki (having a separate FAT32 /boot partition). Skip the bootloader installation.

Installing rEFInd from OS X (important!) and installing the EFI stub loader made me able to boot fine.

Dedicated thread.

Note: Installing rEFInd from Linux (or from OS X, but to the esp) also works fine
Stability problems
Note: Passing libata.force=1:noncq to the kernel parameters solves the problem.

This is the big worry for me. Every now and then my system hangs for a brief moment and everything involving net or disk access just hangs there for a while and then it seems to work. So far it only seems to happen when I run something disk- or CPU-intensive. Also had an occassion when I couldn't start X and just got this repeating all over my screen:

ata1.00: failed command: WRITE FPDMA QUEUED
ata1.00: cmd 61/08:f0:10:8c:c2/00:00:0b:00:00/40 tag 30 ncq 4096 out
res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.00: status: { DRDY }

On the next attempt it worked fine. I did SMART short and long tests on my disk and they returned fine:

smartctl -a

There are some messages in my boot that indicate this could be disk and/or ACPI related.

These are with 2013-06 ISO, 3.9.7-1 2013 x86_64 kernel.

journalctl -b Seems to only work with the headphone jack, not with the speakers.

dmesg


WiFi

WiFi does not work out of the box. Install broadcom-wl-dkmsAUR to connect to a network.

Touchpad

Since 3.10.3 kernel touchpad works perfect with xf86-input-synaptics.

Audio

In order to get audio, put the following in /etc/asound.conf:

defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1

Seems to only work with the headphone jack, not with the speakers. This bug may be fixed by this patch: https://bugzilla.kernel.org/show_bug.cgi?id=60811

Mid 2012 13" - Version 5,2

Kernel panics using default boot media under arch kernel 3.5. Adding 'intremap=off' fixes this. Additionally, there are problems loading the 'applesmc' module (meaning the temperature sensors, fan, and keyboard backlight do not work). These problems are fixed in the linux 3.6-rc4 mainline kernel (I have tested).

Mid 2012 11.5" - Version 5,1

If you have issues with waking from sleep while in X11 such as a black screen or showing the console with a frozen mouse cursor then remove xf86-input-synaptics and install mtrack-git from aur. This fixed errors such as

 (EE) [dix] bcm5974: unable to find touch point 0

and backtraces that causes X11 to crash. This might apply to Version 5,2 assuming they use the same trackpad.

Installing using the Archboot 2012.06 image

Several people have reported problems installing Arch Linux on the MBA version 5,2 (See problems booting archlinux on a MacBook Air Mid 2012). A common problem is that the screen is not detected and therefore goes black when the installer boots. To fix this problem one has to select the normal install (Not the LTS) during boot and press tab to edit the boot flags. Then add noapic flag to the boot line. This should fix the screen going black. Install the system as you normally would. It may help later in the configuration process if the support packages are installed already at this stage.

When the install has finished again add the noapic flag to the GRUB boot line (if you use GRUB) and also add i915.diescreaming=1 (or perhaps i915.die). This should keep the screen from going black when booting the new system. After you enter the system the wireless driver should be loaded. If you installed the support packages during installation you should have the wifi-menu command. Run it and select the network you want to use. One could also use wpa_supplicant but wifi-menu is quite fast to use at this stage. Now you are ready to upgrade the system. As of writing there have been a lot of changes to Archlinux since the 2012.06 image of Archboot was released (filesystem and glibc). Therefore the upgrade process can be a bit difficult. The current solution has sucessfully upgraded a standart archboot version to a up-to-date version as of October 2012 and this step should be obsolete in future releases of archboot.

First ignore the new "big" changes to Arch Linux,

 pacman -Suy --ignore glibc,libarchive,curl,filesystem 

If this only upgrades pacman then run the command again. Remember to make sure that pacman is ignoring the packages you don't want upgraded now. Otherwise you may break the system and have to reinstall! Now upgrade to the new filesystem,

pacman -S filesystem --force

As described in Glibc upgrade guide there may be conflicts with installed packages that require the /lib directory. Follow the guide and remove any packages that use /lib. The stock 3.4.2 kernel from Archboot should be on this list so first upgrade this,

pacman -S linux

This may give some errors saying that the system may not boot because of missing modules. Ignore this warning for now. The stock install may also contain gcc in the /lib directory so also remove this if needed and any other packages that have conflicts. Now Glibc should be the only package in /lib so run the system upgrade and accept all changes,

pacman -Su

Finally reinstall the kernel so that it can find the correct modules.

Now this command shouldn't give any errors like last time. You can also reinstall gcc at this point. After a rebooted the system should startup and the new kernel should have fixed the problem with the screen going black. If want to boot Xorg then you may need to remove the i915.diescreaming=1 line from GRUB. If not then attach a external screen and try to fix the problem that way. Some people have reported commands that may help on the forum.

Mid 2011 - Version 4,x

Works out-of-the-box since kernel 3.2. It is recommended to use Archboot, install GRUB and use EFI.

Early 2008 - Version 1,1

Everything works out of the box though you'll need b43-fwcutter (or simply b43-firmware) for the wireless adapter to work.

Since this model has only one USB port, you may find it easiest to install Arch with a powered USB hub. Plug a USB network adapter (wireless or ethernet adapter to plug into a USB port) and your Arch installation media into the USB hub.

If you found that you can not get any result by scaning wireless network after boot until unload module b43 and ssb and reload them again as following:

rmmod ssb

rmmod b43

modprobe b43

There is a good chance you will found something wrong with DMA from the dmesg log.

And even if you can scan wireless access point after reloading the modules. You will still probably found that you can connect some access points, but can not connect to other routers.

According to a more detailed discussion here: http://crunchbang.org/forums/viewtopic.php?id=17368, add pio=1, qos=0 options to the b43 module can solve this problem.

I tested this for a 13' MacBook Air 1,1 with a BCM4321 chipset, and it works.

(I think above information is useful because it cost me several days to figure out his problem, however, I'm not a native English speaker, so please help me improvement this text by correcting any grammer and expression errors and delete this comment after that.)

See also