I have been using Arch Linux for over a year now, and while I mostly enjoy it, installing it is rather cumbersome. Following Installation Guide on ArchWiki seems simple (kind of) but you will always forget to do something. More so if you want to diverge from their steps. Things like using a bootloader, encryption, or dualbooting are not exactly easy to follow for first time users.
To avoid problems in future installations I have put together a thorough guide. It is tailored to my needs. I am using Lenovo Thinkpad T480s with NVME SSD, integrated GPU and UEFI. I want to have Linux partition encrypted with LVM on LUKS method without the swap partition. I will be dualbooting with Windows 10.
You might need to adjust the following commands to your hardware (different network interface or disk names). Good luck.
Windows 10 Installation
It is recommended to first install the Windows system first and then Linux.
Plug in Windows installation media (USB stick or CD).
Delete all partitions. From the empty space create new partition for Windows. Size does not matter right now. Windows will create few required system partitions for you.
Keep the first partition named Recovery (around 500 MB large) and delete all other partitions. Reason for this is that Windows creates too small EFI partition (~ 100 MB). It might be enough for Windows but you would get out of space pretty quickly when you add more systems. For dualbooting, more space is needed.
Shift+F10and type the following commands:
select disk 0
create partition efi size=500
Now close the command line and click Refresh in partitions list. You should see two partitions: Recovery and System (EFI).
From the remaining empty space on the disk create a new partition for Windows again. Don't use full disk capacity for Windows partition and leave empty disk space for Arch installation (e.g. 150 GB for Windows and rest empty). Installation media should add only the remaining partitions that we have deleted previously and have not created them manually in CMD.
Continue with installation. Unplug the ethernet cable to use local account instead of online login (tell me something about dark patterns).
After installation finishes, disable Fast Boot in system power management settings.
Set time to use NTP so your time in Windows is correct. Open CMD with Administrator privileges and run following command.
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_QWORD /f
And you are done. You can set whatever else you require (like encryption or installing apps). This is outside the scope of this tutorial.
Arch Linux ISO
After you have installed Windows, unplug Windows installation media and plug your Arch installation media. Boot into Arch ISO.
List available network interfaces with
ip link. Enable ethernet with
systemctl start dhcpcd@interface_nameor wifi by
Test connection by
ping 126.96.36.199(Google DNS servers). If ping returns an error, wait a few seconds. Starting the network interface might take some time.
Update the repository index using
Update system clock with
timedatectl set-ntp true.
List all partitions by
fdisk /dev/nvme...to open correct disk.
nto create new partition. Accept everything to create partition from all remaining space.
- Now type
t, choose partition number (
5in my case) and then type
- Save changes with
Encrypt partition using dm-crypt with LVM on LUKS. You will have one large encrypted partition which will contain virtual partitions for root and home.
cryptsetup luksFormat /dev/partition_name
cryptsetup open /dev/partition_name cryptlvm
vgcreate vg /dev/mapper/cryptlvm(name
vgcan be changed)
lvcreate -L 32G vg -n rootwill create smaller partition for root (
lvcreate -l 100%FREE vg -n homewill use the rest empty space to create another partition for
mount /dev/vg/root /mnt
mount /dev/vg/home /mnt/home
mount /dev/efi_partition /mnt/bootmounts EFI partition created by Windows. It is usually second partition.
Next, install required packages.
pacstrap /mnt base linux linux-lts linux-firmware base-devel lvm2 intel-ucode man-db man-pages vim
genfstab -U /mnt >> /mnt/etc/fstab
Chroot into Arch
ln -sf /usr/share/zoneinfo/Europe/Prague /etc/localtime
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
echo "arch" >> /etc/hostname
127.0.0.1 localhost ::1 localhost 127.0.1.1 arch.localdomain arch
HOOKS=(base udev autodetect keyboard keymap modconf block encrypt lvm2 filesystems fsck)
Recreate initramfs by
useradd -m -g users -G wheel your_user_name
Install DE (Plasma for me) and other useful things like ZSH, terminal emulator and GPU drivers.
- Install packages first.
pacman -S plasma-meta kde-applications-meta xorg xf86-video-intel mesa sddm kitty git htop zsh zsh-autosuggestions zsh-completions zsh-syntax-highlighting
systemctl enable sddm.serviceto enable desktop manager.
Install bootloader (systemd-boot). I will include both Linux Stable and LTS version. It might be very useful in the future.
bootctl --path=/boot install
/boot/loader/entries/arch.conf. You can find partition UUID in VIM by command
:r !blkid. Copy UUID for main partition (not virtual group or volume).
title Arch Linux Stable linux /vmlinuz-linux initrd /intel-ucode.img initrd /initramfs-linux.img options cryptdevice=UUID=YOUR-DEVICE-UUID:cryptlvm root=/dev/mapper/vg-root rw quiet
For backup Linux LTS kernel, add second boot entry to
/boot/loader/entries/arch-lts.conf. This comes handy when stable kernel goes wild.
title Arch Linux LTS linux /vmlinuz-linux-lts initrd /intel-ucode.img initrd /initramfs-linux-lts.img options cryptdevice=UUID=YOUR-DEVICE-UUID:cryptlvm root=/dev/mapper/vg-root rw quiet
/boot/loader/loader.conf. You can choose either
arch-ltsas default boot option.
default arch timeout 4
Create swap file using systemd-swap. I use this instead of dedicated swap partition.
pacman -S systemd-swap
Set swappiness in file
Customize value inside file
sysctl -p /etc/sysctl.d/99-sysctl.conf.
/etc/systemd/swap.confedit following lines. They will not be together and you have to find them.
zram_enabled=0 zswap_enabled=1 swapfc_enabled=1
I had to set
/etc/systemd/swap.conf. Otherwise I had errors. This might not apply to you. See Swap on ArchWiki.
systemctl enable systemd-swap.service
umount -R /mnt
After rebooting you should be greeted with black screen asking for your encryption key. This will be shown on every cold-boot. Use password that you used for encryption, not your user account (they might not be the same depending on your setup).
If you do not see prompt for unlocking your partition, something went wrong. Welcome to the Arch world. In my case, most problems were usually with bootloader or fstab. Make sure you pass the correct partition UUID.
This part is entirely optional. You will probably want to enable
Change default shell
chsh -s /bin/zsh.
Add user to sudoers. Install
vipackage. Then run
wheel. You can disable timeout.
Enable multicore to makepkg in
COMPRESSXZ=(xz -c -z - --threads=0)(0 for all cores or pick number)
To enable proper tray icons, install
libappindicator-gtk3(this will make tray icon sharp and pretty).
If there is no WiFi icon:
sudo systemctl enable NetworkManager.service
In case you suffer from long DNS resolution (approx. 5 seconds), add this line to your
To enable emojis, install
You will probably want to use AUR packages. Install yay for easier usage.
git clone https://aur.archlinux.org/yay.git
cd .. && rm -rf yayto delete now useless folder.
Enable SSD TRIM:
sudo systemctl enable --now fstrim.timer
Important. Create alias for
sudocommand to make your Linux usage more civilized. Open file
~/.bashrcdepending on your shell. Then add this line.
After this you can use commands like
please rebootinstead of rude