William Vaughn

Arch Linux on my Lenovo t470s

Install

Arch Linux is a rolling update distribution of Linux with great documentation, and a minimalist approach. I personally gravitate toward tools which encourage me to start small and gradually grow my understanding and skills. Arch is maybe even a little extreme for me in that regard, after installing Arch you have a system that is so bare bones it isn’t even useful. You then have all the choices in the world for how to set it up. This blog and my next one, Arch Linux First Steps, is documentation of the choices I made for my system.

This was written during my second install of Arch Linux on this laptop. I allowed my previous install to get stale for about 8 months, and Arch Linux being a rolling update distribution was very mad at me when I tried to update it after so long.

My first install was based on this helpful gist of instructions. For this second round I am following along with this youtube video as well.

WARNING This is also an install where I completely wiped my computer including the prior Windows OS. If you want a dual boot system some of these steps might still work but you’ll probably want to find another example of a dual boot Arch install.

Download ISO

I curled down the PGP key here: https://www.archlinux.org/download/ And the ISO image here: https://mirrors.ocf.berkeley.edu/archlinux/iso/2019.11.01/

gpg --keyserver-options auto-key-retrieve --verify archlinux-2019.11.01-x86_64.iso.sig

Load ISO onto USB flash drive.

diskutil unmountDisk /dev/disk2
dd if=path/to/arch.iso of=/dev/rdisk2 bs=1m

Load on Lenovo Thinkpad t470s

When the Lenovo logo shows up hit F12 to enter the “BOOT Menu”. Select the USB Drive.

Setup the wifi connection.

wifi-menu

Create Partitions

Check the disk out a bit.

lsblk

The nvme0n1 device for me has 238.5G, where nvme0n1p1 is 1G for boot and nvme0n1p2 is 237.5G. Remember, I’m documenting this during a re-install and it will likely look different for you.

Using cgdisk /dev/nvme0n1 I was shown:

1 1024.0 MiB EFI System boot
2 237.5 GiB Linux filesystem root

I want to clear these and recreate these partions in order to re-install Arch from scratch. So I navigated in cgdisk /dev/nvme0n1 to both and deleted them. I then created new partitions with the following details.

2048 -> 512M guid: ef00 name: boot EFI
all the rest guid: 8e00 (for LVM) name: Arch LVM

Create the EFI partition filesystem

mkfs.vfat -F32 -n EFI /dev/nvme0n1p1

Setup the encryption

cryptsetup -y -v luksFormat /dev/nvme0n1p2
cryptsetup open --typ luks /dev/nvme0n1p2 archlv
# check it's there
ls /dev/mapper/archlv

# create physical volume
pvcreate /dev/mapper/archlv
# create virtual group
vgcreate archvg /dev/mapper/archlv

# Under the vg, you create logical volumes.
lvcreate -L16G archvg -n swap
lvcreate -L30G archvg -n root
lvcreate -l 100%FREE archvg -n home

# Then list the block to see what you've done.
lsblk

Should have an archlv and the vgs listed under the /dev/nvme0n1p2 drive.

File systems

mkfs.ext4 /dev/mapper/archvg-root
mkfs.ext4 /dev/mapper/archvg-home
mkswap /dev/mapper/archvg-swap
swapon /dev/mapper/archvg-swap

Check that with free -m to see the swap and free memory.

Mount

These steps actually mount everything we’ve been doing in the ISO install disk onto the computers filesystem.

mount /dev/mapper/archvg-root /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
mkdir /mnt/home
mount /dev/mapper/archvg-home /mnt/home

Install base system

Install reflector and set the mirrorlist

This tool is awesome, was happy to learn of it. My first time installing Arch I didn’t know anything about the mirrorlist and I had very slow download speeds.

pacman -S reflector
reflector -c 'United States' -f 12 -l 12 --verbose --save /etc/pacman.d/mirrorlist

Use reflector --help to somewhat understand what’s happening here.

Install base arch to /mnt

Installs some basics into our minimal install.

pacstrap /mnt base base-devel linux linux-firmware intel-ucode sudo emacs vim tmux git networkmanager

Check it out with ls /mnt

Generate a filesystem table.

Note I learned later that I maybe should have used UUIDs in my filesystem table with the -U flag.

genfstab -p /mnt >> /mnt/etc/fstab

Check that out with cat /mnt/etc/fstab

Enter and setup the new system

Signs us out of the ISO and into our Arch install. Woot!

arch-chroot /mnt

Setup the clock.

ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
hwclock --systohc --utc

Set root password with passwd.

Edit vim /etc/locale.gen to uncomment the en_US.UTF-8 UTF-8 and en_US ISO-8859-1 lines. Then run locale-gen and locale > /etc/locale.conf.

Set the hostname: echo "nackjicholson" > /etc/hostname Edit the hosts file with vim.

/etc/hosts

# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.0.1 nackjicholson.localdomain nackjicholson
::1 nackjicholson.localdomain nackjicholson

Configure mkinitcpio.

Edit the “HOOKS” line in vim /etc/mkinitcpio.conf

HOOKS=(base udev autodetect modconf block keyboard encrypt lvm2 filesystems fsck)

And run the following to generate the ramdisks.

mkinitcpio -p linux

NOTE For some reason this didn’t work for me, failing with “ERROR: Hook ‘lvm2’ cannot be found. I had to do pacman -S lvm2 and then try again.

bootctl --path=/boot/ install

Now edit vim /boot/loader/loader.conf

default arch
timeout 5
editor 0

Apparently that editor 0 disables a tricky hack I don’t really understand about entering the kernel. Okie doke!

Now edit vim /boot/loader/entries/arch.conf

title Arch Linux (ENCRYPTED)
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options cryptdevice=UUID=XXXX:archlv root=/dev/mapper/archvg-root quiet rw

To get the value of the UUID in there, you use :read ! blkid /dev/nvme0n1p2 from within vim.

Reboot!

exit # exit arch-chroot
umount -R /mnt
reboot

Login as root user with the password you set.

Conclusion

This is a minimal install of a Arch Linux on an SSD nvme disk. I hope it all worked for you too! Feel free to email me with any corrections or issues you faced. Check out my next entry on my own personal first steps on Arch Linux, things like installing the GNOME desktop environment and setting up the WiFi and such. Thanks for reading!