Creating a persistent Arch Linux installation on a USB stick

I’ve been using Arch Linux for the better part of a decade now. As a result, I am so used to it that I’ll choose it for nearly any task at hand. Although Arch might not be a traditional distribution for persistent live systems, there’s really no reason to not use it to this purpose.

What follows is a list of steps to install and set up a minimal Arch Linux live USB system. In the spirit of KISS, we will go with a single-partition layout:

  1. Create a single Linux type partition with fdisk or the tool of your choice on your USB device (e.g. /dev/sdc)
  2. Create an ext4 file system on the created partition: # mkfs.ext4 /dev/sdc1
  3. Mount the resulting file system: # mount /dev/sdc1 /mnt/usbarch
  4. Use pacstrap from the arch-install-scripts package to install the base package group: # pacstrap /mnt/usbarch base
  5. Auto-generate an fstab file: # genfstab -U /mnt/usbarch >> /mnt/usbarch/etc/fstab
  6. Take a look at the generated /etc/fstab file and adapt if necessary
  7. Change root into the new system: # arch-chroot /mnt/usbarch
  8. Configure the time zone: # ln -sf /usr/share/zoneinfo/Region/City /etc/localtime and # hwclock --systohc
  9. Uncomment en_US.UTF-8 UTF-8 and other required locales in /etc/locale.gen, and generate them with: # locale-gen
  10. Set the LANG variable in /etc/locale.conf, for example: LANG=en_US.UTF-8
  11. Set a default keymap in /etc/vconsole.conf, for instance: KEYMAP=de-latin1
  12. Define a hostname in /etc/hostname, for example: usbarch
  13. Set a super-secure root password: # passwd
  14. Install GRUB on your USB device: pacman -Sy grub && grub-install --target=i386-pc /dev/sdc
  15. Finally, use the grub-mkconfig tool to auto-generate a grub.cfg file: grub-mkconfig -o /boot/grub/grub.cfg

The system should now be bootable and can be further adapted to your liking.