System Configuration

  1. Generate fstab:

    mkdir -p /mnt/etc/
    genfstab -t PARTUUID /mnt | grep -v swap > /mnt/etc/fstab
    sed -i "s|vfat.*rw|vfat rw,x-systemd.idle-timeout=1min,x-systemd.automount,noauto,nofail|" /mnt/etc/fstab
    
  2. Install packages:

    pacstrap /mnt base mg mandoc grub efibootmgr mkinitcpio
    
    CompatibleVer=$(pacman -Si zfs-linux \
    | grep 'Depends On' \
    | sed "s|.*linux=||" \
    | awk '{ print $1 }')
    
    pacstrap -U /mnt https://archive.archlinux.org/packages/l/linux/linux-${CompatibleVer}-x86_64.pkg.tar.zst
    
    pacstrap /mnt zfs-linux zfs-utils
    
    pacstrap /mnt linux-firmware intel-ucode amd-ucode
    
  3. Configure mkinitcpio:

    mv /mnt/etc/mkinitcpio.conf /mnt/etc/mkinitcpio.conf.original
    tee /mnt/etc/mkinitcpio.conf <<EOF
    HOOKS=(base udev autodetect modconf block keyboard zfs filesystems)
    EOF
    
  4. Enable internet time synchronisation:

    hwclock --systohc
    systemctl enable systemd-timesyncd --root=/mnt
    
  5. Generate host id:

    zgenhostid -f -o /mnt/etc/hostid
    
  6. Add archzfs repo:

    curl -L https://archzfs.com/archzfs.gpg |  pacman-key -a - --gpgdir /mnt/etc/pacman.d/gnupg
    pacman-key --lsign-key --gpgdir /mnt/etc/pacman.d/gnupg $(curl -L https://git.io/JsfVS)
    curl -L https://git.io/Jsfw2 > /mnt/etc/pacman.d/mirrorlist-archzfs
    
    tee -a /mnt/etc/pacman.conf <<- 'EOF'
    
    #[archzfs-testing]
    #Include = /etc/pacman.d/mirrorlist-archzfs
    
    [archzfs]
    Include = /etc/pacman.d/mirrorlist-archzfs
    EOF
    
  7. Chroot:

    history -w /mnt/home/sys-install-pre-chroot.txt
    arch-chroot /mnt /usr/bin/env DISK="$DISK" bash
    
  8. Generate locales:

    echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
    locale-gen
    
  9. Generate initrd:

    mkinitcpio -P
    
  10. Import from by-id:

    echo GRUB_CMDLINE_LINUX=\"zfs_import_dir=/dev/disk/by-id/\" >> /etc/default/grub
    
  11. Set locale, keymap, timezone, hostname and root password:

    rm -f /etc/localtime
    systemd-firstboot --prompt --force