Deltamodel

a structured approach ...

Install Arch Linux on a MacBook pro (or Surface pro)

Apple’s MacBooks and Microsoft’s Surface devices impress with very good hardware and are both excellent work devices even years after a purchase. While Apple takes its devices out of support after about eight to ten years and no longer distributes the latest version of MacOS, it is currently always possible to install the latest Windows update on the Surface devices, but the devices might reach performance limits under Windows.

However, with a current Linux, even aging MacBooks and MS Surface devices can not only be operated very performantly, both device classes are also available (depending on their age) for relatively little money on Ebay as second-hand goods.

While e.g. an Ubuntu or OpenSuse can be installed very comfortably via the LiveCD or Live-Stick, Arch Linux makes somewhat higher demands on the installation, but the user is rewarded with a high-performance and lean system and also learns a lot about how Linux works.

The installation instructions presented here should work for both a MacBook and a Surface device and were reproduced on a MacBook Pro (Mid 2012) and a Surface Pro 2.

A backup of the device is recommended.

Preparation

For the installation of Arch Linux a current image is needed (https://www.archlinux.org/download/ ).

The image can be transferred to a USB stick using etcher or dd. It is important to make sure that the USB stick is specified correctly, because the device will be transferred completely.

sudo dd if=imagefile.iso of=/dev/sdb1 -bs=1m

Then insert the USB stick into a free port and restart the Macbook by holding down the ALT key (Surface pro PowerButton and Volume up key). A selection appears that allows booting from the USB stick (on the Surface the settings for booting via USB are enabled).

Installation of the system

First steps after booting from USB stick

For a simple network connection, it is recommended to connect the Macbook via Ethernet at the beginning and test if a connection exists.

ping google.com -c 3

Also, it makes sense to set the appropriate if necessary (e.g.German keyboard layout).

loadkeys de-latin1

With the Surface, the internet connection can be configured directly via WLAN using iwctl.

Partitioning

To install Arch Linux, the hard disk must be partitioned. This example assumes that Arch Linux should be the only system and MacOS (Windows) is completely removed. A parallel operation is possible with older MacBooks for example via Bootcamp, a parallel installation of Linux and Windows is also possible. For partitioning, fdisk can be used.

fdisk /dev/sda

First all existing partitions are deleted with d. Subsequently, three new partitions are created with n.

  1. Start Sector default, End Sector +512M, type EFI
  2. Start Sector default, set the size to the size of the RAM (e.g. 8G) and set with t to Linux swap.
  3. Create a third partion for the rest of the disk and set it to x86-64 with t.

Finally the partition table can be written with w —> ATTENTION: all data is gone!

After the partitioning is done, the three partitions are formatted and the root and optionally the swap partition are mounted


mkfs.fat -F32 /dev/sda1
mkswap -L p_swap /dev/sda2
mkfs.ext4 -L p_arch /dev/sda3
swapon -L p_swap
mount -L p_arch /mnt

Base system

The base system can be installed via the pacstrap script. Depending on the internet connection this may take a while.

pacstrap /mnt base base-devel linux linux-firmware vim intel-ucode

Create fstab

genfstab -L -p /mnt >> /mnt/etc/fstab

The -L creates a fstab with labels instead of UUIDs and the -p prevents the addition of pseudo file systems.

Important —> check if the fstab was really created

 cat /mnt/etc/fstab

System configuration

The system is configured in an arch-chroot environment.

 arch-chroot /mnt

Time zone

timedatectl list-timezones
timedatectl set-timezone Europe/Berlin

alternatively

ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
hwclock --systohc --utc

set locals

 vim /etc/locale.gen

Search now in VIM with e.g. with /de_DE for the German for your locals and remove the hash at the beginning of the line with x. Then switch on the US locals (search en_US).

Save the changes and exit VIM with :wq.

Now generate the locals

locale-gen

Let the system and the installed programs know your locals

echo LANG=de_DE.UTF-8 > /etc/locale.conf

In order to set the keyboard settings system-wide and to make the terminal looks appealing, the keymap and the terminal font can be saved persistently.

echo KEYMAP=de-latin1 > /etc/vconsole.conf
echo FONT=lat9w-16 >> /etc/vconsole.conf
  • Set computer name
 echo archbook > /etc/hostname

In the /etc/hosts

127.0.0.1	localhost
::1		localhost
127.0.1.1	archbook

Create the files necessary for the system startup

mkinitcpio -p linux

Boot manager

pacman -S grub  efibootmgr
mkdir /boot/efi
mount /dev/sda1 /boot/efi
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

set root password

passwd

On the Surface it is now best to install the network support packages directly, on the MacBook pro this can be done after reboot

pacman -S  dhcpcd networkmanager
systemctl enable dhcpcd
systemctl enable NetworkManager
exit
umount /mnt
reboot

Configuration of the system after reboot

After restarting, log in with user root and the assigned password.

Internet and WLAN

Check internet

ping google.com -c 3

If there is no connection, check if dhcpcd is installed and activate the network device.

pacman -Qs dhcpcd

If required install dhcpcd with

pacman -S dhcpcd

and then activate it.

systemctl enable dhcpcd
systemctl start dhcpcd

WLAN

The Macbook has a Broadcom WLAN chip for which there is a driver in the community repository. The Surface Pro’s WLAN chip should be recognized directly and does not require any additional drivers.

pacman -S broadcom-wl
modprobe wl
systemctl disable dhcpcd
systemctl enable dhcpcd

Create standard user

Since it is not recommended to work permanently as root, a new user should be created. (in this example archuser)

useradd --create-home --groups wheel --shell /bin/bash archuser
passwd archuser

To enable the user to install programs with sudo, sudo should be installed and permission for sudo should be granted to the wheel group with visudo.

pacman -S sudo
EDITOR=vim visudo

In the editor make sure that the line

%wheel ALL=(ALL) ALL 

does not start with a hash.

Install graphical user interface

pacman -S gnome-control-center gnome-shell gnome-terminal gnome-tweaks
pacman -S gdm
systemctl enable gdm
pacman -S networkmanager
systemctl enable NetworkManager
reboot

Configuration in GNOME

For the configuration in GNOME the default language is set in the system settings dialog. For the installation of further packages pacman can be used in the terminal or after installation from the AUR a graphical tool like pamac.