Notes on my Arch Linux installation

The following are notes I took while setting up Arch Linux on my Thinkpad X230.
The steps are specific to my setup and should not be seen as generic installation instructions. Use at your own risk.
The general goal is to get a lightweight Arch Linux with i3 Window Manager
– No Display Manager
– Neo-Layout
– systemd-boot

This is a work in progress!

In your bios make sure the boot-mode for UEFI/Legacy is: Both; UEFI first.
The USB drive must be named ARCH_YYYYMM (e.g.: ARCH_201705)! If created with Lily under Windows this won’t be the case. Just rename it then. If the name mismatches the system will not boot!

Boot the USB drive and prepare

-> Load german QWERTZ. Neo-Layout seems to not be included in the installation medium.
# loadkeys de-latin1-nodeadkeys

Confirm existence of efi directory to make sure it booted in efi mode.
# ls /sys/firmware/efi/efivars

Stop dhcpcd on ethernet interface, connect to wifi and verify connection.
# systemctl stop dhcpcd@
# wifi-menu
# ping -c3 hasi.it

Set time and date. Verify ntp sync and correct local time.
# timedatectl set-ntp true
# timedatectl set-timezone Europe/Berlin
# timedatectl status

Partition and format

-> Verify wich device to install to. Then format.
# lsblk
# cgdisk /dev/sda
[New] -> Default first sector -> size: 256M -> type: ef00 -> name: boot
[New] after boot -> default -> default -> 8300 -> dmcrypt
-> yes

Create filesystems.
# mkfs.fat -F32 /dev/sda1
# cryptsetup -y -v luksFormat /dev/sda2
-> Follow instructions
# cryptsetup open /dev/sda2 cryptroot
# mkfs.ext4 /dev/mapper/cryptroot
# mount /dev/mapper/cryptroot /mnt
# mkdir /mnt/boot
# mount /dev/sda1 /mnt/boot

Install and configure base system

# pacstrap /mnt base base-devel
# genfstab -U /mnt >> /mnt/etc/fstab
# arch-chroot /mnt
# ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
# hwclock --systohc
# nano /etc/locale.gen
-> Remove # in front of en_US.UTF-8
-> Save and Exit.
# locale-gen
# echo "LANG=en_US.UTF-8" > /etc/locale.conf
# echo "KEYMAP=de-latin1-nodeadkeys" > /etc/vconsole.conf
# echo "computername" > /etc/hostname
# pacman -S iw wpa_supplicant dialog
-> So we can use wifi-menu after reboot :)

Configure initramfs

# nano /etc/mkinitcpio.conf
-> Edit HOOKS="[...]". Add keyboard keymap in front of block. Add encrypt after block. Remove keyboard after block.
Mine looks like:
HOOKS="base udev autodetect modconf keyboard keymap block encrypt filesystem fsck"
-> Save and Exit.
# mkinitcpio -p linux

Set root password.
# passwd
-> Follow instructions.

Install and configure bootloader

# bootctl --path=/boot install
# pacman -S intel-ucode
-> For microcode-updates.
# blkid | grep sda2 > /boot/loader/entries/arch-encryped.conf
-> Just to have the UUID there :D
# nano /boot/loader/entries/arch-encrypted.conf
-> Make it look like

title Arch Encrypted
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=<UUID>:cryptroot root=/dev/mapper/cryptroot quiet rw

# nano /boot/loader/loader.conf
-> Make it look like

default Arch Encrypted
timeout 1

-> Save and Exit.

Exit chroot and reboot

# exit
# umount /mnt/boot
# umount /mnt
# reboot
-> Cross fingers.

Add user

# pacman -S sudo
# useradd -m -G wheel -s /bin/bash USERNAME
# passwd USERNAME
# nano /etc/sudoers
-> Uncomment line starting with %wheel ALL=
# exit
-> Login with new user.
$ sudo wifi-menu
-> To have internet again :D

Finally neo!

$ sudo pacman -S wget
$ wget https://svn.neo-layout.org/linux/console/neo.map
$ sudo mv neo.map /usr/share/kbd/keymaps/i386/neo.map
$ sudo localectl --no-convert set-keymap neo
$ sudo localectl --no-convert set-x11-keymap de thinkpad neo

Installing i3

$ sudo pacman -S xorg xorg-xinit i3 gnome-terminal dmenu
$ cp /etc/X11/xinit/xinitrc ~/.xinitrc
$ nano .xinitrc
-> Delete everything at the bottom starting with exec twm
-> Add exec i3
$ startx
-> Hopefully your i3 will start and the config wizard will appear.
-> gnome-terminal should spawn on Mod+Enter

Making everything a little easier

$ sudo pacman -S ttf-dejavu ttf-liberation noto-fonts-emoji firefox zsh zsh-completions
-> Font rendering should be better after re-login.
-> You can use firefox to copy/paste stuff :D
$ zsh
-> Chose 0
$ chsh -s /bin/zsh

Make i3 start after login

$ nano .zprofile
-> Add following:

if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
 exec startx
fi

Configure polkit:

$ sudo pacman -S polkit polkit-gnome
-> add exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & to the end of ~/.config/i3/config

Make i3lock lock the screen when suspending

-> Create /etc/systemd/system/suspend@.service and make it look like

[Unit]
Description=User suspend actions
Before=sleep.target

[Service]
User=YOUR_USERNAME
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lock -i PATH_TO_PNG

[Install]
WantedBy=sleep.target

$ sudo systemctl enable suspend@user

Configure keyring and network manager

$ pacman -S networkmanager network-manager-applet networkmanager-openvpn gnome-keyring libsecret
$ sudo systemctl enable NetworkManager
-> add exec nm-applet to the end of ~/.config/i3/config
-> create for example ~/.scripts/start_keyring.sh
-> make it look like:

#!/bin/sh
eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
export SSH_AUTH_SOCK

$ chmod +x ~/.scripts/start_keyring.sh
-> add exec ~/.scripts/start_keyring.sh to end of i3 config.

Getting pacaur

$ mkdir /tmp/pacaur && cd /tmp/pacaur
$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/pacaur.tar.gz
$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/cower.tar.gz
$ tar -xvf pacaur.tar.gz
$ tar -xvf cower.tar.gz
$ cd cower && makepkg -si
$ cd ../pacaur && makepkg -si
-> If you're getting errors about missing gpg keys use gpg --receives-keys KEY_ID and retry :)

Oh-my-zsh

$ pacaur -S oh-my-zsh-git ruby
$ cp /usr/share/oh-my-zsh/zshrc .zshrc

Getting polybar

$ pacaur -S polybar i3ipc-glib-git
$ install -Dm644 /usr/share/doc/polybar/config $HOME/.config/polybar/config
-> edit ~/.config/polybar/start.sh:

#!/usr/bin/env sh

killall -q polybar

# Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done

# Launch bar
polybar example &

-> make executable, add exec_always --no-startup-id ~/.config/polybar/start.sh to end of i3 config.

OwnCloud

$ sudo pacman -S owncloud-client libgnome-keyring
-> add exec --no-startup-id owncloud to i3 config.

Sound

$ sudo pacaur -S pulseaudio pulseaudio-bluetooth pulseaudio-gconf pulseaudio-zeroconf paprefs pavucontrol pulseaudio-ctl
-> add to i3 config:

bindsym XF86AudioMute exec pulseaudio-ctl mute
bindsym XF86AudioRaiseVolume exec pulseaudio-ctl up
bindsym XF86AudioLowerVolume exec pulseaudio-ctl down
bindsym XF86AudioMicMute exec pulseaudio-ctl mute-input

Backlight

$ pacaur -S light-git
-> add to i3 config:

bindsym XF86MonBrightnessDown exec light -U 10
bindsym XF86MonBrightnessUp exec light -A 10

PowerTop

$ sudo pacman -S powertop
$ sudo powertop --calibrate
-> Create /etc/systemd/system/powertop.service with content:

[Unit]
Description=Powertop tunings

[Service]
Type=oneshot
ExecStart=/usr/bin/powertop --auto-tune

[Install]
WantedBy=multi-user.target

$ sudo systemctl enable powertop.service

TLP

$ sudo pacman -S tlp acpi_call lsb-release smartmontools tp_smapi x86_energy_perf_policy ethtool rfkill
$ sudo systemctl enable tlp.service
$ sudo systemctl enable tlp-sleep.service
$ sudo systemctl mask systemd-rfkill.service
-> Is the following useful?
$ sudo systemctl enable rfkill-block@bluetooth.service

Graphics

-> This still needs testing!
$ sudo pacman -S mesi xf86-video-intel libva-intel-driver vulkan-intel

Wine

-> Enable multilib
$ pacaur -S wine-staging wine_gecko wine-mono winetricks lib32-alsa-lib lib32-alsa-plugins lib32-libpulse lib32-openal lib32-mesa
$ winetricks corefonts

File Manager, Wallpaper

$ sudo pacman -S nautilus ntfs-3g gvfs-mtp feh eog
$ feh --bg-fill PATH
-> exec ~/.fehbg in i3 config

[To be continued…]