Wednesday, January 8, 2014

Arch + XMonad / GNOME on MacBook Pro Retina 11,1 (13-inch, late 2013)

For the past few months, I've tried running OS X as my main OS on my MacBook Pro Retina (late 2013). I eventually got tired of it, so a week ago I started trying to figure out how to dual boot Arch on this machine. This is a log of the steps that had to go through. (Before doing this, I reset OS X via the recovery partition, so this is a clean install.) The following additional pages may be helpful as reference:

I'm assuming that the reader has some basic level of familiarity with Linux and can understand most of what I'm doing (or look it up if need be). If anyone has any updates or helpful info, feel free to email me and/or comment below, and I will update the guide accordingly.

Boot disk

In OS X, download the standard Arch install ISO and run
dd if=arch.iso of=/dev/sdX
to create the boot disk.

Bootloader

We will use rEFInd because it seems slightly easier than hooking up GRUB to EFI. In OS X, download the rEFInd package and run
sudo ./install.sh --alldrivers
Edit /EFI/refind/refind.conf and enable the scan_all_linux_kernels option. (I also enabled textonly mode because I thought the GUI looked tacky.) In the folder /EFI/refind/drivers_x64, remove all the drivers except the one for EXT4. (Not sure if the last step is necessary -- can someone confirm?)

Partitioning, Part 1

While still in OS X, use the partition manager to resize your OS X partition. I left it with 50 GB, but this is up to personal preference. Note that OS X actually has 3 partitions (EFI boot partition, main partition, recovery partition), but it only shows you one of them.

Internet

Boot into your Arch live USB (rEFInd should be able to detect it automatically). You need an internet connection to install the base system. I used USB tethering via an Android phone, but other options may work as well.

Partitioning, Part 2

Use cgdisk /dev/sda to set up / on /dev/sda4 and /home on /dev/sda5. Then run
mkfs.ext4 /dev/sda4
mkfs.ext4 /dev/sda5
mount /dev/sda4 /mnt
mkdir /mnt/home && mount /dev/sda5 /mnt/home
to create new EXT4 file systems on those partitions and mount them.

Base System / Partitions, Part 3

Run the following to set up the base system and fstab:
pacstrap /mnt base base-devel
genfstab /mnt >> /mnt/etc/fstab
At this step we have a basic working Linux system that you can chroot or reboot into:
arch-chroot /mnt /bin/bash

SSD Performance issues

We should edit /etc/fstab to improve SSD performance:
/dev/sda4   /       ext4    defaults,noatime,discard    0 1
/dev/sda5   /home   ext4    defaults,noatime,discard    0 2
The default boot options may cause the SSD to hang. Add the following line to /boot/refind_linux.conf to prevent this:
"Default" "ro root=/dev/sda4 libata.force=noncq"

Keyboard / Locale / Time

echo "somehostname" > /etc/hostname

# set up keyboard layout and system locale
echo "KEYMAP=dvorak" > /etc/vconsole.conf
vi /etc/locale.gen # uncomment what you want
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf

# set local time and set hardware clock to UTC
ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime
hwclock --systohc --utc

Users

# set root password
passwd

# add user
useradd -m -g users -G wheel -s /bin/bash someusername
passwd someusername
visudo # uncomment wheel
One last thing -- we should set up wifi before rebooting and logging in to the new account.

Yaourt, Wifi

Follow the instructions here to get yaourt. Then use it to install broadcom-wl from the AUR to get wifi drivers:
yaourt -S broadcom-wl
I like to manage my connection with wicd so I'll get that as well:
pacman -S wicd
systemctl enable wicd.service
Now we can reboot and start playing around with the system!

XMonad with GNOME

Normally I would forgo GNOME, but they currently have (as far as I know) the best solution to solving the high-DPI scaling issue. Grab the following packages:
pacman -S xorg-server xorg-xinit xorg-server-utils xf86-video-intel xf86-input-synaptics \
          gnome-session gnome-settings-daemon
yaourt -S xmonad-darcs xmonad-contrib-darcs
Then follow the instructions from my previous post to make XMonad and GNOME play nicely with each other.

Additional steps / troubleshooting

The above steps will get a minimal working setup on your Retina Macbook Pro. However, there are still a lot of useful things you could configure to make your life easier:

Firefox

Change layout.css.devPixelsPerPx to 2 to make it scale everything up for the retina display.

Missing Cursor

Try running
gsettings set org.gnome.settings-daemon.plugins.cursor active false

USB Automounting

udiskie is a simple daemon to automount disks with very few dependencies, which is great for a minimal setup.

Fonts

OS X ships with some great built-in fonts. I strongly recommend grabbing their fonts from these directories on your OS X install and copying them over to Linux.

1 comment:

  1. I'm thinking about installing Arch on my MacBook Pro 13 Retina as well. Your post seems to be a really good starting point. Thanks for sharing your insights.

    ReplyDelete