Create Live USB

Table of Contents

1 Software

  • unetbootin

2 Create Linux USB

2.1 Using dd

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx && sync
# restore
dd count=1 bs=512 if=/dev/zero of=/dev/sdx && sync

2.2 From Mac

hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso
diskutil list, insert usb, diskutil list => /dev/disk1
diskutil unmountDisk /dev/diskN
sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m
diskutil eject /dev/diskN

3 Create Mac USB

sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia \
--volume /Volumes/Untitled \
--applicationpath /Applications/InstallXXX.app \
--nointeraction

4 Install Arch Linux on Macbook

4.1 UPDATE

Stopped because I want to buy DPT-RP1 for paper reading. That thing does not work on Linux. I'm going to use the VNC through docker solution.

4.2 Reinstall OS X

Although I can download image and burn to disk, I found the internet recovery is convenient.

When booting, hold Cmd-Option-R, then erase the disk, and reinstall the latest Mac OS.

key desc
cmd-R reinstall the latest OS that was installed on this mac
option-cmd-R upgrade to latest OS for this mac
shift-option-cmd-R reinstall the OS that comes with the mac

4.3 Partition

It is recommanded to keep archlinux with OS X, because only OS X can install firmware updata, adjust start up sound, etc.

Partition the disk on OS X.

  • run Disk Utility
  • select the drive, click partition
  • add new partition by pressing +. The partition will be reformated in Arch, so type does not matter.

Inside arch, run cgdisk, and delete the partition. When creating the first partition, add 128MiB gab by typing +128M when cgdisk asks for it.

For simplicity, creating one partition is fine. The swap partition can be replaced by a swap file. Do not use LVM because

  • hard to set up right
  • need to load a module when booting, otherwise the /dev/mapper/... address is not resolved.

The mac EFI partition can be directly used. Thus you only need to create one partition for the root system. Mount the EFI partition and chroot will be just fine. The grub bootloader in arch will add files to the EFI partition, so next time you start your computer, arch will be default. Pressing option while booting can enter macOS.

4.3.1 Install rEFInd

rEFInd is used to give options to boot to macOS or linux.

Download and run refind-install. The SIP must be disabled first. To do that:

reboot and hold Cmd-R to enter recovery mode. Then open terminal from utility menu and type

csrutil disable

Reboot. To enable it, follow the same process with command:

csrutil enable

4.3.2 Wifi

The wifi chipset of my 2013 late macbook pro is BCM4360. It is supported by broadcam-wl or broadcam-wl-dksm driver. The former is in AUR, need to recompile each time kernel is updated, thus do not use it. The later one is from official repo, and will get updated automatically.

Load the module by modprobe wl.

I'm using wicd-client to manage the wifi. You need the following packages:

  • wpa_suppliant
  • wicd
  • wicd-gtk

Run wicd-client to configure (no need root). Make sure dhcpcd is NOT active, they conflict with each other.