Dual Boot Arch Linux On MacBook Pro Installation
Dual Boot Arch Linux On MacBook Pro Installation
read
The installation process of Arch Linux on a Macbook Pro has quite a few caveats, but it is
about the slickest machine I've ever run. The only difference in my hardware is the
Samsung SSD, but I point out what to leave off if you have an normal HD. The Arch Linux
Wiki entry for Macbooks has gotten pretty messy and has a lot of conflicting information.
While I'm going to do my best to clean it up and add information that I found helpful, I
wanted to document my process as it may be helpful for others as well as provide a
personal resource for future reference. I got a lot of good information from other sources
so I try to credit them where applicable, but a great resource especially worth mention is
this post.
Having an extra computer handy for Google and an ethernet plugged into your Macbook
are definitely useful items to have.
The first caveat is with the installation media. It isn't clear anywhere else, but you do need
to do a few specific things to create a live USB which will boot with Apple's UEFI.
These liveUSB instructions are for Linux. May work in OSx, but might as well just fire up a
VM to be safe.
First create a partition table with at least one partition on the USB.
mkdir -p /mnt/{usb,iso}
Create a FAT32 filesystem in the partition on the USB. Change LABEL in the code to
the one used in the Arch ISO configuration. You'll find it at:
/mnt/iso/loader/entries/archiso-x86_64.conf
cp -a /mnt/iso/* /mnt/usb
sync
umount /mnt/{usb,iso}
Now you should be able to plug in the USB to your Macbook, hold the option key, and
select to boot from the Arch Linux live USB.
Partitioning
People usually get stuck on partitioning as well. There are many options, but the simplest
is the best in my opinion. Keep your EFI partition from the Mac (don't create a separate EFI
System partition for your linux drive. They can share the same partition.) Create a small
bootloader partition using Apple's HFS+ filesystem that you will later bless as bootable in
your OSx install. You'll then need a boot partition, root partition, and home partition. A
swap partition is optional and I'm not going to go into it.
cgdisk /dev/sda
Then partition your drive according to the table below. Make sure not to touch the
first three partions which already exit. You are just creating the new ones:
Just make sure you've had your ethernet plugged in. run ping google.com to make sure it's
up, but you should be good out of the box.
mkfs.ext2 /dev/sda5
mkfs.ext4 /dev/sda6
mkfs.ext4 /dev/sda7
[/mnt/etc/fstab]
Configure
arch-chroot /mnt /bin/bash echo archer #or whatever you want to call it >
en_US.UTF-8 UTF-8
en_CA.UTF-8 UTF-8
locale-gen
export LANG=en_US.UTF-8
mkinitcpio -p linux
Bootloader
This is probably one of the most confusing sections of the installation process particularly
with Macbook's dual booting. The best way to do this is to boot directly from your
Macbook's EFI boot loader so you'll need to create a boot.efi.
pacman -S grub-efi-x86_64
[/etc/default/grub]
GRUB_CMDLINE_LINUX_DEFAULT="quiet rootflags=data=writeback"`
Then you can generate the boot.efi with GRUB which you just installed. You'll want
to put this on a USB device because you're going to be switching into OSx in a
minute.
This is going to create a file in which ever directory you are called boot.efi. Place it
on a USB device. Check your devices then make a directory to mount your USB.
Copy the boot.efi file onto your USB drive.
mkdir /mnt/usbdisk && mount /dev/sdb /mnt/usbdisk cp boot.efi /mnt/usbdisk/
Now you can exit chroot with exit and umount all of your filesystems from earlier.
Reboot back into OSx.
Launch disk utility, select the /dev/sda4. Select erase, select Mac OSx Journaled,
and click Erase. This is where your grub2 image will live in.
cd /Volumes/disk0s4
cd System
mkdir Library
cd Library
mkdir CoreServices
cd CoreServices
touch SystemVersion.plist
cp /Volumes/usbstick/boot.efi boot.efi
<key>ProductBuildVersion</key>
<key>ProductName</key>
<string>Linux</string>
<key>ProductVersion</key>
<string>Arch Linux</string>
Now all you need to do is bless this partition to make it a bootable disk.
sudo bless --device /dev/disk0s4 --setBoot
Now you can reboot and hold down your Option key. Select the second EFI disk on
the list and hit enter to boot into Arch. Do the same but select the first to boot into
OSx.
Xorg
The dreaded Xorg server. Luckily it goes pretty smoothly with the right drivers for your
video card. You can change settings and play with your touchpad synaptics, backlighting,
and everything else later. There is plenty of documentation out there. We're just going to
get it running. Thsetup is for nvidia video card. If you're running an intel card for video
then check the Wiki.
Sound
pacman -S alsa-utils
alsamixer
Desktop
Alright. I don't use a desktop. I just use a WM called awesome. It's in the official
repositories and it is kickass. That's what I'll show you how to install.
pacman -S awesome
You'll want to create a config file because it doesn't come with one.
mkdir -p ~/.config/awesome/
cp /etc/xdg/awesome/rc.lua ~/.config/awesome
There are many different themes available, but for now use the default theme.
Change it later if you like. We'll copy the default theme over and then change the
theme_path in the rc.lua config file for awesome.
beautiful.init(awful.util.getdir("config") .. "/themes/default/theme.lua")
terminal = "xfce4-terminal"
pacman -S xfce4-terminal
I don't use a login manager so add exec awesome to your startup script ~/.xinitrc
Now from your tty you can startup your new WM with startx.
WiFi
This part was probably the biggest pain in the ass of my entire install. The drivers don't
load properly at first and everything is just better off when done manually instead of
through the package manager.
Thanks to Reddit user jb270 on a thread I found recently and a bit of digging, I found a
pretty fool proof way to get things rolling.
Change into the b43 folder and run this to download dependencies and install the
package.
makepkg -si
Make sure to unload all known drivers before loading the new one. It can cause
headache down the road if you don't:
modprobe b43
Run dmesg and grep your wireless card to make sure everything worked fine.
If your interface is not called wlan0 then run ip addr to find your interface name.
Now we're going to disable the normal dhcpcd service and install probably the
easiest to use Network Manager.
You'll be using the gnome-keyring to save your wifi passwords and since you don't
want the rest of the GNOME desktop, add this to your ~/.xinitrc file:
source /etc/X11/xinit/xinitrc.d/30-dbus
eval $(/usr/bin/gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)
export GNOME_KEYRING_CONTROL
export GNOME_KEYRING_PID`
Now you just need to enable NetworkManager dameons and start the nm-applet
nm-applet
The applet should appear in the top right hand corner of your awesome windows
manager. The rest should be pretty self-explanatory.
The rest you should be able to figure out, but commment here or ping me on Twitter
@codelitt