/instant-archlinux-on-mac

Instant Arch Linux on Mac & MacBook

Primary LanguageShellMIT LicenseMIT

Instant Arch Linux on Macs & MacBooks [deprecated, help welcome]

NB: This project is currently not being actively maintained, and is not usable at this moment. PRs are still very welcome in order to fix the current usability issues.

This will setup Arch Linux on your Mac or MacBook all from Mac OSX. No need for any USB drives or figuring out the proper network/video drivers to get your system to get up. It should install without any rebooting etc. Just launch it and enter your password twice and go about your business.

Warning: Backup your stuff or use a fresh iMac or MacBook. There are no guarantees this will work and it might leave your machine in an unusable state. I personally didn't worry about this to much as one can just reset it back to a [factory restore] (https://github.com/yantis/instant-archlinux-on-mac/blob/master/factory-restore.md) with "⌘ + R" at startup or "option + ⌘ + R for internet recovery.

That being said. It has been designed to not write anything in case of failure. So worst case if it doesn't work you will probably be OK. Though seriously back up anything you actually want to be safe.

Will this work with your iMac or MacBook? Possibly. It worked with all the ones I tested it with. I suspect it will most likely work and even if not perfect you will be in a much better place than trying to do it by hand. I do know for a fact that I haven't set it up to work with fusion drives yet so if your drive is a fusion drive it won't work without some minor changes.

If you have any problems feel free to shoot me an email at yantis@yantis.net

Features

  • Installs without USB.
  • Installs without needing network drivers.
  • Installs without needing video drivers.
  • Installs 100% in Mac OSX with no rebooting neeed.
  • When you do choose to use Arch Linux it should be 100% usable by simply rebooting.
  • Very quick install. If your bandwidth is fast enough the whole install takes under 10 minutes.
  • Easy to remove and revert back to normal.

Installed Programs

  • rEFInd with rEFInd minimal theme.
  • KDE Plasma, XCFE4, and Awesome window desktop managers.
  • SDDM with Archlinux Theme
  • Infinality Fonts preconfigured and installed.
  • Latest Intel, Nvidia, and AMD/ATI Radeon drivers (DKMS)
  • Network Drivers and Broadcom firmware preinstalled and setup.
  • Network manager and applets setup for lan or wifi use.
  • Powerline with Powerline fonts installed
  • ZSH, Oh-my-zsh, tmux, vim preinstalled.
  • Google Chrome
  • Sound system preconfigured (Alsa/Pulseaudio)
  • Mac OSX Drive is shared read only
  • Development Tools plus python2, python3, & ruby.
  • Thermald and cpupower
  • Mac Fan control daemon
  • Terminals: xfce4-terminal, konsole, gnome-terminal, vte3
  • xf86-input-mtrack package installed and configured.
  • Yaourt for AUR

Tested Working

  • Mountain Lion, Lion, Yosemite, El Capitan, and Sierra
  • [MacBookPro10,1] - MacBook Pro (Retina, Mid 2012)
  • [MacBookPro10,2] - MacBook Pro (Retina, 13-inch, Late 2012)
  • [iMac15,1] - iMac Retina 2014

Tested not working but in progress

  • [MacBook8,1] - MacBook 12" Oct 29th, 2016 Update - Still no working keyboard though fully working if I install a usb hub, keyboard, mouse and usb ethernet

Setup

  • If the OS is El Capitan then you need to disable System Integrity Protection by rebooting and at the chime hiting command+R and opening a terminal and typing: csrutil disable; reboot
  • Make sure FileVault encryption is turned off. If it isn't you need to disable it and reboot.
  • Use ⌘ + space to open spotlight. Type in terminal and hit return.
  • Optionally, update your software either through the terminal or App store Though if you do you may have to reboot though probably not. This step can take a while on a new machine. It usually is a 2+ GB download. You simply might want to use the GUI update application to have some indication of progress.
sudo softwareupdate -i -a

If you wanted your Mac to have 100GB and Arch Linux to have the rest type this:

curl -O https://raw.githubusercontent.com/yantis/instant-archlinux-on-mac/master/mac-install.sh && mac-install.sh 100

Same as above but using Google's URL shortener:

curl -OL goo.gl/VdgxPO && sh VdgxPO 100

There is a USB option but I haven't figured out the booting on that yet. So that is a work in progress but to do that type:

curl -O https://raw.githubusercontent.com/yantis/instant-archlinux-on-mac/master/mac-install.sh && mac-install.sh USB

Breakdown (Behind the scenes)

  • Command Line Developer tools, Homebrew, VirtualBox, Boot2docker, Docker all get silently and automatically installed.
  • Since Mac OSX doesn't support the Ext4 file system. We install a 10 day trial of Paragon ExtFS (It can be uninstalled after the install)
  • The file system gets converted to HFS+ if needed then volume gets shrunk down to make room for Arch Linux.
  • The physical volume gets mapped to virtual volumes for VirtualBox.
  • The system is profiled to be able to dynamically adapt to its hardware.
  • Boot2docker launches VirtualBox with our physical volumes mapped.
  • A docker container gets launched which then downloads this script to dynamically setup Arch Linux.
  • It unsquashes a rootfs image into a chroot environment.
  • Everything gets installed and setup in that chroot environment.
  • Once completed everything in that chroot environment gets rsynced over to the virtual mapped physical drive.
  • rEFInd is installed for dual booting Mac OSX & Linux As well as a very sexy rEFInd Minimal Theme
  • Nothing actually gets written unless everything is successful.

Issues

  • When booting up there is now a small but noticable delay of around 30 seconds. This has something to do with rEFInd and should be fixable.

Troubleshooting

The defaults for an HFS+ file system look like this. This script expects your "Macintosh HD" to be at disk0s2.

$ diskutil list

/dev/disk0
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:      GUID_partition_scheme                        *500.3 GB   disk0
1:                        EFI EFI                     209.7 MB   disk0s1
2:                  Apple_HFS Macintosh HD            499.4 GB   disk0s2
3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

The defaults for Core Storage look like this. This script expects "Apple_CoreStorage" to be at disk0s2.

$ diskutil list

/dev/disk0
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:      GUID_partition_scheme                        *500.3 GB   disk0
1:                        EFI EFI                     209.7 MB   disk0s1
2:          Apple_CoreStorage                         499.4 GB   disk0s2
3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

/dev/disk1
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:                  Apple_HFS Macintosh HD           *499.0 GB   disk1
                              Logical Volume on disk0s2
                              C3E9416F-A8DF-4E50-9BEE-87B2C538689E
                              Unencrypted
  • Make sure that FireVault is turned off
  • If the script doesn't remove Core Storage for you. You can try the trick of enabling FileVault, rebooting, disabling it and rebooting. Which should remove Core Storage.
  • Fusion drives do not work yet as it hasn't been programmed in yet.
  • Make sure to leave at least 30GB for Mac OSX (or at least whatever the drive space is plus a few GB for updates).
  • If you want to mess with a minimal install of Archlinux. It runs perfectly fine on 10GB or less of space.
  • This hasn't been tested with bootcamp but I suspect it will not work as is.
  • If for some reason on boot you get no disk found select linux and hit F2 and select "Fallback with Micokernel updates" and run as root "mkinitcpio -p linux" to regenerate the initramfs and reboot

References & Resources

Mac on Archlinux

Creating/Resizing of MacOS drives

Homebrew

Docker

EXT4

EFI

VirtualBox

SquashFS

Macbook Retina 12" 2015 (Macbook 8,1)

Macbook Retina 12" 2016

El Capitan

Github Pages