Archlinux installation

WarningThese are notes summarizing how to install Archlinux. They are not a complete installation howto, which is well covered in the official Archlinux Installation guide.
TipConfiguration files are available for download.


  1. Prepare installation media and boot on it.

  2. Installation

    1. Partition with parted

      1. Start parted using parted /dev/[drive]. Identify [drive] to use for installation using lsblk.

      2. Create partitions. First partition is for EFI. Last partition is for Swap. Adapt the middle partition size to your drive (here ~200GB). The swap partition should be at least the size of your RAM.

        mklabel gpt
        mkpart primary 1MiB 500MiB
        mkpart primary 500MiB 200GB
        mkpart primary 200GB 100%
        set 1 boot on

        To align partitions with drive sectors, the partition Start should be 2048s or with B unit 1047576, or with MiB unit exactly 1.00.

    2. Format partitions

      mkfs.vfat -F 32 -n ESP /dev/sda1
      mkfs.ext4 -L archroot /dev/sda2
      tune2fs -m1 /dev/sda2             # 1% reserved space
      tune2fs -i 6m /dev/sda2           # Check interval (6 months)
      mkswap -L archswap /dev/sda3
    3. Mount partitions

      • Main partition (discard option only for SATA SSD; not for NVMe or HDD).
        mount -o discard /dev/sda2 /mnt
      • EFI system partition (ESP) (see below to install a bootloader).
      • Swap
        swapon /dev/sda3
    4. [Optional] Update Pacman mirror list using reflector with one of these options:

      • Fast option: Get top 10 mirrors scored by Archlinux
        reflector --save /etc/pacman.d/mirrorlist --country us --score 10
      • Accurate option: Get top 10 mirrors scored by download speed from your location
        reflector --save /etc/pacman.d/mirrorlist --country us --number 10 --sort rate

      List of countries can be obtained using reflector --list-countries to change the --country option.

    5. Connect to internet if it wasn’t done during boot

    6. Install packages

      pacstrap /mnt base base-devel linux linux-firmware nano dosfstools nftables openssh rsync tree man-db

Preliminary configuration

Within the new filesystem

  1. Chroot. Change root into the new system:

    arch-chroot /mnt
  2. Hostname

    echo "<hostname>" > /etc/hostname
  3. Microcode [optional but recommended]

    Load microcode for AMD or Intel CPU at boot.

    • Install package intel-ucode for Intel or amd-ucode for AMD

    • After rebooting, loaded microcode can be check using dmesg | grep microcode or reading /sys/devices/system/cpu/cpu0/microcode/version

  4. Bootloader: GRUB is recommended

    • GRUB

      GRUB is an advanced bootloader. Drivers for most filesystems are included: GRUB can read the kernel and initramfs directly on the system partition where they are installed by Pacman, and doesn’t require them to be copied on the ESP. While it provides an advanced system to generate a configuration file, it can be manually configured simply in the main configuration file /boot/grub/grub.cfg.

      • Mount ESP on /efi and create following directories.

        mkdir /efi
        mount /dev/sda1 /efi
      • Install grub package

      • Install grub

        grub-install --target=x86_64-efi --efi-directory=/efi --removable

        This will create /efi/EFI/BOOT/BOOTX64.EFI and all GRUB config files in /boot/grub.

      • Configure GRUB

      • CPU microcode: Since mkinitcpio v38, the CPU microcode is packed together with the main initramfs image. In consequence, no configuration of GRUB is needed.

      • Microsoft Windows: GRUB can chainload the Windows bootloader.

        • Add to /boot/grub/grub.cfg:
          menuentry "Windows" {
              insmod part_gpt
              insmod fat
              insmod chain
              search --no-floppy --set=root --label "ESP"
              chainloader ($root)/EFI/Microsoft/Boot/bootmgfw.efi
        • Turn-off Fast Startup
    • systemd-boot

      systemd-boot is integrated into systemd. While simple and robust, it can only read from the ESP, i.e. no ext4 driver is integrated. To have access to the kernel and initramfs, one can either (i) bind (with mount --bind) the ESP/arch folder to /boot. But with this solution /boot is a FAT partition with limited functionality. Or (ii) add a hook to Pacman to automatically copy the kernel and initramfs to the ESP each time it’s updated. The hook method is explained below.

      File Description
      loader.conf Main systemd-boot config
      arch.conf Archlinux loader
      check-esp.hook Pacman ESP hook
      copy-boot-esp.hook Pacman ESP hook
      • Mount ESP on /efi and copy kernel and initramfs to it.

        mkdir /efi
        mount /dev/sda1 /efi
        mkdir /efi/arch
        cp /boot/*img /boot/vm* /efi/arch
      • Install systemd-boot

        bootctl --path /efi --no-variables install
      • Configure systemd-boot

      • Configure pacman hooks

      • Configure microcode

        1. In /efi/loader/entries/arch.conf, before the initramfs initrd line, add the line:
          • Intel
            initrd         /arch/intel-ucode.img
          • AMD
            initrd         /arch/amd-ucode.img
        2. Copy microcode to EFI
          cp /boot/*img /efi/arch
      • If Microsoft Windows and Linux are sharing the same ESP, systemd-boot can be set as main bootloader:

        • Issue as admin in terminal:
          bcdedit /set {bootmgr} path \EFI\systemd\systemd-bootx64.efi
        • Turn-off Fast Startup
  5. Configuring Locals

    • Uncomment local in /etc/locale.gen (en_US.UTF-8 and/or fr_FR.UTF-8)

    • Run

      echo "LANG=\"en_US.UTF-8\"" > /etc/locale.conf
    • Time

      ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime
  6. For NVMe SSD, enable periodic trim by enabling fstrim.timer systemd timer.

  7. Set root password with passwd.

  8. Exit arch-chroot.

Final step & reboot

  1. Creating fstab

    genfstab -Lp /mnt > /mnt/etc/fstab
  2. Unmount install partitions:

    umount -R /mnt
  3. Reboot



  1. Nftables (firewall). Copy nftables.conf in /etc and start and enable nftables systemd service. (Check Nftables is loaded using nft list ruleset)

  2. SSH. Enable sshd systemd service.

  3. Network interface

    • Networkd (systemd) - One wired fixed

      1. Create /etc/systemd/network/ (replace interface name enp1s0 with yours. You can list interfaces using ip link):

      2. Enable systemd-networkd and systemd-resolved (to get DNS from DHCP) services.

      3. Before starting network or rebooting, remove if it exists /etc/resolv.conf

    • Netctl - Complex connections

    • NetworkManager - Laptop

      1. Install networkmanager packages
      2. Enable NetworkManager systemd service
      3. If systemd is starting service(s) that require an active connection, enable service NetworkManager-wait-online
  4. Time synchronization with timesyncd (systemd)

    timedatectl set-ntp true

Graphical desktop environment

  1. Install KDE & enable SDDM (Simple Desktop Display Manager)

    pacman -Sy plasma-meta
    systemctl enable sddm

    If necessary, set SDDM keyboard config (for a french keyboard): localectl set-x11-keymap fr

  2. Install either kde-applications-meta (full install), or a sub-package like kde-utilities-meta, or none for a minimal install.

  3. To enable Wayland-based Plasma session, install plasma-wayland-session.

  4. For video hardware decoding, with Intel CPU from Broadwell (2014), install intel-media-driver (see wiki for older GPU).

User config

  1. Add a normal user (adapt or remove user and group ID)

    groupadd -g 1000 charles
    useradd -m -u 1000 -g 1000 charles
    passwd charles
  2. Keyboard layout can be configured directly in KDE System Settings.

    • With an canadian Apple keyboard:
      • Keyboard model is “Generic 104-key PC”
      • The ~ and < are reversed. Copy Xmodmap in user’s home as ~/.Xmodmap.
      • Install package xorg-xmodmap if necessary.
  3. Fonts and anti-aliasing.

  4. Bluetooth. Enable bluetooth systemd service.

  5. Sound

    • Display sound cards with aplay -l (from alsa-utils package).

    • If there are two cards, their order will be random as detection by Udev is random. To maintain the main soundcard at the first position, add in /etc/modprobe.d/alsa.conf (replace snd-ice1712 with sound card driver):

      options snd-ice1712 index=0
    • PulseAudio defaults hardware to use 44.1 kHz or 48 kHz sample rate. In case of crack sounds and if the sound card can handle multiple sample rates (i.e. 44.1, 48 or 96Khz), set PulseAudio to not systematically resample sound. Add to ~/.config/pulse/daemon.conf:

      avoid-resampling = yes
  6. Printing

    • Install cups package
    • Enable cups.service systemd service
    • Configure printer(s) at http://localhost:631
  7. Recommended packages

    pacman -S ttf-croscore
    pacman -S chromium firefox
    pacman -S audacious mpv
    pacman -S libreoffice-fresh hunspell-en_US hunspell-fr hyphen-en hyphen-fr
    pacman -S jre11-openjdk icedtea-web
Last modification: May 7, 2024