Categories
Posts

Creating a persistent Arch Linux installation on a USB stick

Although Arch Linux might not be a Linux distribution known for creating persistent live systems, there’s really no reason against using it to this purpose. What follows is a list of steps for installing 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 another similar tool on your USB device (e.g. /dev/sdc)
  2. Set up an ext4 file system on the newly created partition:
# mkfs.ext4 /dev/sdc1
  1. Mount the resulting file system:
# mount /dev/sdc1 /mnt/usbarch
  1. Use pacstrap from the arch-install-scripts package to install the base package group:
# pacstrap /mnt/usbarch base
  1. Auto-generate an fstab file:
# genfstab -U /mnt/usbarch >> /mnt/usbarch/etc/fstab
  1. Take a look at the generated /etc/fstab file and, if necesarry, adapt it
  2. Change root into the new system:
# arch-chroot /mnt/usbarch
  1. Configure the time zone:
# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
# hwclock --systohc
  1. Uncomment en_US.UTF-8 UTF-8 and/or other required locales in /etc/locale.gen, and generate them with the following command:
# locale-gen
  1. Set the LANG variable in /etc/locale.conf, e.g. LANG=en_US.UTF-8
  2. Set a default keymap in /etc/vconsole.conf, e.g. KEYMAP=de-latin1
  3. Define a hostname such as usbarch in /etc/hostname
  4. Set a super secure root password:
# passwd
  1. Install a boot loader such as GRUB on your USB device:
# pacman -Sy grub
# grub-install --target=i386-pc /dev/sdc
  1. 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.