Context and goal

See the About page for context of this post.

I’ve previously used BTRFS, but because of issues (which later turned out to be present even also with other file systems so they were not because of BTRFS) with the latest mainline kernel (4.9-rc), recent perceptions (see “The Linux filesystem situation is in a bit of a bad place these days” from regarding the state of BTRFS, waiting for bcachefs to go mainline and get NFS exports support, I decided to use ext4 with LVM so that it might be possible to migrate to bcachefs without wiping the whole machine and even if that’s not possible just to have a safe to update system as a daily driver.

Before starting, get the latest archiso and create a bootable USB.

Boot archiso with secure boot enabled

  • Boot the USB with secure boot enabled
  • Use HashTool to enroll loader.efi and archiso/vmlinuz.efi to be able to boot

Installation working environment setup

  • Load Finnish keyboard layout:
    loadkeys fi

    Note: Keymaps can be found with: find /usr/share/kbd/keymaps/ -type | grep -i fi where fi is the the keymap we are looking for.

  • Use the following command to connect to wireless network:
  • Set the timezone and update the system clock:
    timedatectl set-timezone Europe/Helsinki
    timedatectl set-ntp true

    Note: You can list available timezone by running: timedatectl list-timezones

Partitioning and mounting the disk

We are not going to use the whole disk for LVM without partitioning it first. This is because UEFI needs the EFI System partition and with systemd-boot it can’t be inside LVM. We’re also creating 3 partitions for LVM so that it’s possible in the future to remove one from the LVM if needed for another installation for example.

Note: If you’re using a disk that has been used before it might be required to clear out the partition table from the disk completely before creating new partitions to the disk. You can do this with gdisk:

gdisk /dev/sda
x # Enable expert commands
z # Wipe out wholte GPT partition table from the drive
w # Write changes to disk

Important: Make sure you do this on the right drive, because it erases all data on that drive! Usually at least on a laptop the main disk of the machine is /dev/sda.

First create the partition for EFI, it should be 512M of size and type ef00 for EFI System. Next, create two 128G partitions of type 8e00 for Linux LVM and a third one with the rest of the space. Do this with gdisk:

gdisk /dev/sda
  • Create the LVM physical volume:
    pvcreate /dev/sda2
    pvcreate /dev/sda3
    pvcreate /dev/sda4
    pvdisplay # Verify the new physical volume.

    Note: Do this on every each partition you plan to use with LVM. In my case I’m using all of the 3 created for LVM, but obviously not the one for UEFI.

  • Create the volume group:
    vgcreate local /dev/sda2 /dev/sda3 /dev/sda4 # local being the name of the volume group and /dev/sdaX being the name of the physical volumes created earlier.
    vgdisplay # Verify the new volume group.
  • Create logical volumes:
    lvcreate -L 128G local -n root
    lvcreate -l 100%FREE local -n home
    lvdisplay # Verify created logical volumes.

    Note: Logical volumes are like partitions in a traditional setup so these are the ones you mount and format. We will separate the home to it’s own logical volume from root. We keep root relatively large because Docker volumes are located there. We don’t create logical volumes for swap or boot because we use the UEFI partition for boot and a swap file with systemd-swap. Setup of systemd-swap is not covered here, see

  • Format the UEFI partition with FAT32 file system for EFI:
    mkfs.vfat -F32 /dev/sda1
  • Format the root and home logical volumes with ext4:
    mkfs.ext4 /dev/local/root
    mkfs.ext4 /dev/local/home
  • Mount the logical volumes for installation:
    mount /dev/local/root /mnt
    mkdir /mnt/boot
    mkdir /mnt/home
    mount /dev/local/home /mnt/home
    mount /dev/local/boot /mnt/boot

Install Arch Linux

  • Install the Arch base and base-devel:
    pacstrap -i /mnt base base-devel
  • Create fstab for the newly installed Arch from the current mounts of /mnt:
    genfstab -U -p /mnt >> /mnt/etc/fstab
  • Chroot into the newly installed Arch and setup basics:
    arch-chroot /mnt
    echo whitewolf > /etc/hostname
    ln -s /usr/share/zoneinfo/Europe/Helsinki /etc/localtime
  • Update pacman repositories:
    pacman -Syy
  • Install vim:
    pacman -S vim
  • Setup locale by uncommenting the wanted line fi_FI.UTF-8 and en_US.UTF-8 from the /etc/locale.gen file running locale-gen:
    vim /etc/locale.gen
    echo LANG=en_US.UTF-8 >> /etc/locale.conf
    echo LC_NUMERIC=fi_FI.UTF-8 >> /etc/locale.conf
    echo LC_TIME=fi_FI.UTF-8 >> /etc/locale.conf
    echo LC_MONETARY=fi_FI.UTF-8 >> /etc/locale.conf
    echo LC_PAPER=fi_FI.UTF-8 >> /etc/locale.conf
    echo LC_MEASUREMENT=fi_FI.UTF-8 >> /etc/locale.conf
    echo KEYMAP=fi > /etc/vconsole.conf

    Note: Tried with: localectl set-keymap fi but it failed with error: Failed to create bus connection: No such file or directory.

  • Set the root password:
  • Install systemd-boot (direct EFISTUB boot not possible with Acer V13 laptop):
    bootctl install
  • Configure Arch boot config:
    vim /boot/loader/entries/arch.conf

    and add the following:

    title     Arch Linux
    linux     /vmlinuz-linux
    initrd     /initramfs-linux.img
    options     root=/dev/local/root rw
  • Configure boot options:
    vim /boot/loader/loader.conf

    add the following:

    timeout 1
    default arch
    editor 0
  • Add LVM support to boot image:
    vim /etc/mkinitcpio.conf

    add the following:

    HOOKS="base... lvm2 ...filesystems"
  • Recreate boot image with VLM support:
    mkinitcpio -p linux
  • Create a user:
    useradd -m -G wheel aleksi
    passwd aleksi
    echo "%wheel ALL=(ALL) ALL" > /etc/sudoers.d/01_wheel
  • Install Gnome and other GUI tools:
    pacman -S gnome-shell gnome-keyring gnome-terminal gnome-control-center dialog gdm networkmanager

    Note: Select to use mesa-libgl, libx264 and xf86-input-libinput instead of the offered alternatives.

Note: Alternatively if Gnome is not used (maybe some vbox for testing?), one should enable dhcpcd to enable basic networking with sudo systemctl enable dhcpcd.

  • Install additional packages to make bluetooth headset work:
    pacman -S bluez-utils bluez-firmware pulseaudio-bluetooth
  • Enable basic system services:
    systemctl enable gdm
    systemctl enable NetworkManager
    systemctl enable bluetooth
  • Exit the chroot:

Secure boot

  • Prepare by getting the signed HashTool.efi and PreLoader.efi from James Bottomley’s random Pages:
  • Move the signed HashTool.efi and PreLoader.efi into place:
    mv HashTool.efi /mnt/boot/EFI/systemd/
    mv PreLoader.efi /mnt/boot/EFI/systemd/
  • Rename the default systemd-bootx64.efi to loader.efi to work with the PreLoader.efi:
    mv /mnt/boot/EFI/systemd/systemd-bootx64.efi /mnt/boot/EFI/systemd/loader.efi
  • Add PreLoader.efi to the EFI boot list:
    efibootmgr --disk /dev/sda --part 1 --create --label "PreLoader" --loader /EFI/systemd/PreLoader.efi

    Note: You may need to use the Hash tool to enrol the /EFI/loader.efi and the /vmlinuz-linux files on first boot. Some machines also require you to manually allow EFI files to boot and add them to the EFI boot list in BIOS. In these cases adding the PreLoader.efi with efibootmgr doesn’t work and is not needed.


Reboot to the new system: