- Arch-Linux live Image download
- VirtualBox + Extension Pack download
- A USB KEY for Arch Linux This device will be formatted, back up any data left on it
- The knowledge to use the terminal/command line
*All instructions have been taken form the Arch wiki link
Since we want to install Arch-Linux for EFI systems, we need to boot in EFI mode. This is not possible, if the install-media is recognized as a optical disk. Thus we are going to convert the disk to an VDI disk image.
- Install VirtualBox and the Extension Pack
- Open Terminal (Spitlight: Terminal)
- Type in the command:
VBoxManage convertfromraw path/to/arch.iso path/to/arch.iso.vdi
Note, the spaces! To easily get the path, you can just drop the item from Finder into the Terminal window. The last argument is the output file, this you cant drop it, but will need to drop the iso and append .vdi or something like this to the String. - The program should have created a file with .vdi at the end, you don't need the iso anymore, delete it.
Since modern Apple devices have High DPI we are going to use VirtualBox for the creation of the usb key.
- Create a new Box which is named Arch (VB will automatically select Arch as OS and the correct bitness - 32 or 64 bit)
- Select the Box and click Settings
- Go to
System>Motherboard
and Tick theEnable EFI (special OSes only)
checkbox - Go to
Storage
and remove the empty disc slot under Controller: IDE - Click on the disc icon on the righ beside
Controller: SATA
choose the arch-linux live vdi image - Remove all drives Controller: SATA/IDE
- Exit Settings and Boot the System
- After starting up the VirtualBox you should be presented with a simple menu, if not, retrace your steps and try again
- You should not need to do anything, after a short delay the live usb will boot. If this is not the case the choose option which mentions Arch Linux (ex.
Arch Linux archiso x86_64 UEFI USB
on my system) - After the boot process you should be presented with a command prompt (
root@archiso ~#
), this is the root prompt, be careful from now on when messing with partitions, you can mess up anything attached to the system in this prompt. - Verify that the system is booted in EFI mode with
ls /sys/firmware/efi/efivars
, after hitting enter there should pop up a lot of text describing the system efi variables. If this is not the case, then you have booted using BIOS and can't install Arch Linux for EFI systems (thats a lie, it can be done, but its inconvenient). - Since we are using VirtualBox, there should be no need to set up a connection, VirtualBox uses the connection from your HOST-PC. Check, if we really have internet access:
ping google.com
You can abort any command by pressing CTRL+C - Type
timedatectl set-ntp true
to ensure the system clock is accurate.
- Insert the USB-KEY you want to install the System to
- On the host os, click on
Devices>USB
and klick on your device, it should now be connected to the guest os - type
fdisk -l
to identify your device (it should be/dev/sdb
if you have followed the instructions carefully until now) - In the following instructions I am going to mention /dev/sdb, replace this with your true device failing to do so will format a different disk
- type
gdisk /dev/sdb
to enter the partitioning tool - Create a new GPT partiton table (this will erase all partitions on the disk) by typing
o
- Create a new efi partition:
n
- Select the partition number (1): ENTER
- Select the first sector: ENTER
- Specify the sice of the disk (200MiB):
+200M
- Set its HEX code to EFI:
ef00
- Create a swap partition:
n
- Select the partition number (2):
<enter>
- Select the first sector: ENTER
- Specify the sice of the disk, I went for 0.5GiB (512MiB):
+512M
- Set its HEX code to EFI:
8200
- Create a partition for the os to live in:
n
- Select the partition number (1): ENTER
- Select the first sector: ENTER
- Specify the sice of the disk (200MiB): ENTER
- Set its HEX code to EFI: ENTER
- Write the changes to disk:
w
- and quit:
q
- Format the EFI partition:
mkfs.fat /dev/sdb1
- Format the OS partition:
mkfs.ext4 /dev/sdb3
- Utilize sdb2 as swap:
mkswap /dev/sdb2 && swapon /dev/sdb2
- Mount the OS partition:
mount /dev/sdb3 /mnt
- Mount the efi partition:
mkdir /mnt/boot && mount /dev/sdb1 /mnt
- Install the base system:
pacstrap /mnt base base-devel
- Generate an fstab file for booting:
genfstab -U /mnt >> /mnt/etc/fstab
- (Optional) Set the /tmp directory as a ramdisk:
echo 'tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=512M 0 0' >> /mnt/etc/fstab
It's finally time to enter our system! yay!
- Enter system:
arch-chroot /mnt
- Set the locale:
ln -s /usr/share/zoneinfo/<Region>/<City> /etc/localtime
Example:ln -s /usr/share/zoneinfo/Europe/Vienna /etc/localtime
- Generate /etc/adjtime:
hwclock --systohc
- Set your desired language, we are going to use the nano editor:
nano /etc/locale.gen
- Search for your language ond uncomment both the
UTF-8
and theISO
entries (uncomment = delete the leading#
) - Save: CTRL+O
- Exit: CTRL+X
- Add Language:
echo "LANG=<your uncommented lang utf8>" > /etc/locale.conf
- Set the Host Name (you computer's name):
hn='<yourname>' && echo "$hn" > /etc/hostname &&
echo "127.0.0.1 $hn.localdomain $hn" >> /etc/hosts &&
echo "::1 $hn.localdomain $hn" >> /etc/hosts
Type this command in one line without the backslashes. - Set the root password:
passwd
- Install systemd:
bootctl install
- Write the boot configuration:
outfile=/boot/loader/entries/arch.conf
echo 'title Arch Linux' > $outfile
echo 'linux /vmlinuz-linux' >> $outfile
echo 'initrd /initramfs-linux.img' >> $outfile
echo 'options root=UUID='
blkid | grep /dev/sdb3 | grep -o ' UUID="[^"]*"' |
sed -n 's/ UUID="\([^"]*\)"/\1/p' >> $outfile
echo ' rw' >> $outfile
- Exit the OS:
exit
- Unmount EFI partition:
umount /mnt/boot
- Unmount OS partition:
umount /mnt
- Shutdown the VirtualBox:
shutdown -h +0
- PROFIT! USB Key is ready for booting on EFI systems.