Modern Arch linux installation guide with BTRFS LUKS encrypted root partition and Limine bootloader setup and Omarchy hyprland setup
Still writing.....
The goal of this guide is to help new users set up a modern and minimal installation of Arch Linux with BTRFS root file system along with LUKS Encrypted root and Omarchy Hyprland setup on an UEFI system. This guide is thought to be read alongside the wiki, so that it if something ever changes you can fix it but it's not necessary unless my guide becomes outdated. Also I will mention external references to justify some choices that I've made so that curious users can delve into the details.
-
I won't prepare the system for secure boot because the procedure of custom key enrollment in the BIOS is dangerous and can lead to a bricked system. If you are wondering why not using the default OEM keys in the BIOS, it's because they will make secure boot useless by being most likely not enough secure.
-
I'll use a WIFI connection, so no wire configuration steps will be shown. If you want to use Ethernet, you can visit the wiki or the link -
Ethernet.
Visit Downlaod page and choice your closet country and click on any official that country's mirror downlaod links. ### Note : Downaload is actually depends on your internet spead
Warning : The selected bootable drive's data will be gone forever so, make sure you have a backup and also you selected teh correct drive.
1. Download Rufus
6. Click on the 'Ready' button and wait until it finsh. Warning: Do not try to unplug your usb drive else your usb drive can be bricked forever!
4. Select the USB stick device (you may need to enable the option View>Show All Devices) and select Erase from the tool bar (or right-click menu).
5. Set the format to MS-DOS (FAT) and the scheme to GUID Partition Map and you can give any name you want
7. Install 'Balena Etcher' (Note : By default, recent versions of macOS block the running of applications from unidentified developers. To side-step this issue, enable ‘App Store and identified developers’ in the ‘Security & Privacy’ pane of System Preferences. If you are still warned against running the application, click ‘Open Anyway’ in the same pane.) and open 'Etcher' and select the device and select the Arch Linux official iso and click 'Flash'
8. If you want to use your USB stick with an Apple Mac, you will need to restart or power-on the Mac with the USB stick inserted while the Option/alt (⌥) key is pressed. This will launch Apple’s ‘Startup Manager’ which shows bootable devices connected to the machine. Your USB stick should appear as gold/yellow and labelled ‘EFI Boot’. Selecting this will lead you to the standard Arch Linux boot menu.
Choice option "Arch Linux install medium (x86 64, UEFI).
After that, wait for some time, and when it's asking for command, follow these steps:
It's important to care your eyes, so make font size little larger with this command
setfont -d# List all the available keyboard maps and filter them through grep, in this case i am looking for an italian keyboard, which usually starts with "it", for english filter with "en"
ls /usr/share/kbd/keymaps/**/*.map.gz | grep it
# If you prefer you can scroll the whole list like this
ls /usr/share/kbd/keymaps/**/*.map.gz | less
# Or like this
localectl list-keymaps
# Now get the name without the path and the extension ( localectl returns just the name ) and load the layout. In my case it is simply "it"
loadkeys it
or
loadkeys us # most of the laptop keybboards and desktop keyboads default keysmap is set to US (make sure you know your keybaord layout short name)# If this command prints 64 or 32 then you are in UEFI
cat /sys/firmware/efi/fw_platform_sizeNote : Make sure it returns '64' ( the system is booted in UEFI mode and has a 64-bit x64 UEFI. ). For more deatils go to this link.
1.Run this command to unblock any soft block or hard block on your wifi adapter (if nothing works, your wifi adapter is not Linux friendly, buy a good one)
rfkill unblock alliwctl[iwd]# device list[iwd]# station <device name : Example : wlan0> Powered on[iwd]# station <device name : EXample : wlan0> get-networksMake sure you saw your wifi network, now it's time to connect to your wifi
[iwd]# station <device name : Example : wlan0> connect <Network Name> (Ex: MYWIFI)If your wifi name contains special characters and little bit od try wrapping it with single quotes, like :
[iwd]# station wlan0 connect 'print("Hogwarts Internet")ping -c 5 archlinux.org
ping -c 4 1.1.1.1Make sure you are reciving something else try to reconnect your wifi
# Check if ntp is active and if the time is right
timedatectl
# In case it's not active you can do
timedatectl set-ntp true
# Or this
systemctl enable systemd-timesyncd.service## Create required partitions ### Run this command to check any partition ```Zsh lsblk ``` if it returns something nvme0n1 or sda (please look carefully and size also, make sure mountpoint is 'disk' and also forget about your pendrive and loops hsowd there) then you need to create some partitions, #### if you created partitions alraedy follow the [#Format the created partitions] and then [#Root Encryption] steps.
cfdisk /dev/<diskname,like: nvme0n1, sda, sdb, sdx, etc.)Now, if your disk is brand new it will ask you to select disk label type, choose "gpt".
After that, you will be redirected to a tui software , now you will see free space , select that one and select new and you need to give a space (IN GB). If you're planing to install Omarchy, I have some storage problems on my EFI partitin , so I sugest you to type '2GB', I know this is too much but I prefer this much or use something like 1.6. Type partiton size and click enter.
Now you should see a loaction like 'nvme0n1p1 or 7' or '/dev/sda1 or any number'.
scroll up or down to selct that partition and go to 'type' via using right arrow keys and from there find 'EFI System Partition' and select that and press 'Enter'.
SElect the freespace and select 'New' and simply it will ask you hoe much space press enter to give all free space or give a partition size in GB after that choose it's type to be 'Linux filesystem' and select write and write 'yes' to confoirm all changes and now quit (via pressing the quit button).
## Sample partitions for this guide
---------------------------
| location | size |
----------------------------
| /dev/nvme0n1p1 | 2 GB |
-----------------------------
| /dev/nvme0n1p2 | 52 GB |
------------------------------For the root partition (which will be encrypted later) , I choosed 'btrfs'. For more info read this and this
mkfs.fat -F32 /dev/nvme0n1p1Congrats ! EFI Partition formated
To format the root encryption, follow this:
mkfs.btrfs -f /dev/nvme0n1p2Congrats ! Root Partition formated
To make your root partition encrypted run these commands:
cryptsetup luksFormat /dev/nvme0n1p2After running this command you will be asked to type 'yes' in captital letters
After that, it will ask for a passphrase / password. It's diffrent from your root password. Make sure you set a strong secure password. WIthout these anyone included you can't open your pc / disk. Make sure you remember this password.
cryptdevice open /dev/nvme0n1p2 <name_of_your_encrypted_root_partition , Eg : cryptroot.It will ask you to enter your password. Enter your password.
Run this command to see al partitions
lsblkYou should see your encrypted root partition something like that:
nvme0n1p2
cryptroot or root_device_nameRun this command to make you rencrypted root partition 'btrfs'
Note : If you want to install Omarchy, make encrypted root partition type 'btrfs'. Omarchy installation required to use 'btrfs' root partition.
mkfs.btrfs /dev/mapper/<encrypted_root_partiton_name>Congrats, our encrypted root partition is ready! Now we need mount them properly to install Arch Linux
Run this command to mount the encrypted root partition
mount /dev/mapper/<encrypted_root_partition> /mntWrite this command to see you mounted the encrypted partition or not
lsblkYou should see the encrypted root partition as mountpoint mnt
Type thsi command to create a special boot directy in the /mnt
mkdir /mnt/bootmount /dev/nvme0n1p1 /mnt/bootlsblkOptional : If you want a home partition also. Read this link to know more about home partition
mkdir /mnt/homemount /dev/nvme0n1p3 /mnt/homelsblkIf your network is very fast or fast you can edit how mnay pcakges arch should at once
Type this command to edit the file
nano /etc/pacman.confNext , press 'Ctrl + F' and type "ParallelDownloads" and you should got into that variable now use arrow keys to nvaigate and now change it's value to 5 (littel bit fast) or 6 (fast) or 7 (very fast) or 8 (very fast). This value depends o your network.
After writing your prefered value , press 'Ctrl + O' to write and 'Ctrl + X' to exit.
Done.
Now, finally, I recommand you to run this command separately to get a very better experience
1. Type this command to install better magical things. Read more on this link
pacstrap -i /mnt baseIt will ask you to choice provider press 'Enter' key and Type Y (when asked). If this fails run again and check your internet.
pacstrap /mnt base base-devel nano iwd vim lvm2 cryptsetup limine efibootmgr linux linux-firmware gitMake sure all things installed succesfully, Finally we installed Arch before arch-chroot we need to genareate some fstab files.
NOte : Maybe you are wondering why we are not installing 'networkmanager'. It's a reason we will know about that later
genfstab -U /mntMake sure all things are correct!
genfstab -U /mnt > /mnt/etc/fstabcat /mnt/etc/fstabFinally, all done now it's time to chroot into your system
arch-chroot /mntls /usr/share/zoneinfoThis command will list all aviable regions
ls /usr/share/zoneinfo/<Region : America>ln -sf /usr/share/zoneinfo/<Region: America>/<City : New_York> /etc/localtimeDone!
hwclock --systohcDone
datenano /etc/locale.genNow, you need to find your locale like : en_US.UTF-8 UTF-8
Now remove the pound symbol "#" and press "Ctrl + O" "Enter" then "Ctrl + X"
locale-genYou should see your locale genrated succesfully
nano /etc/locale.confLANG=<short_name_of_the_country:like us>.<loacle - UTF.8>nano /etc/hostname"Peter"
passwdNow write your password
EDITOR=nano visudo##Uncomment to allow members of group wheel to execute any command
#%wheel ALL=(ALL:ALL) ALL%wheel ALL=(ALL:ALL) ALLuseradd -m -G wheel -s /bin/bash <username>passwd <super_user_username>Write password and done!
nano /etc/mkinitcpio.confYou need to find the hooks section in this file (uncommented)
HOOKS=(base udev....... block filesystems...)Now between the block and filesystems section
"encrypt" "lvm2"
Press "Ctrl + O"
Press "Ctrl + X"
mkinitcpio -P
Done!
mkdir -p /boot/EFI/liminecp /usr/share/limine/BOOTX64.EFI /boot/EFI/limine/# efibootmgr --create --disk /dev/nvme0n1 --part 1 --label "Arch Linux Limine Bootloader" --loader '\EFI\limine\BOOTX64.EFI' --unicodeNote : in the disk entry, type disk (example : sda,sdb,nvme0n1,sdx,etc.) and in the part entry type boot partition like (example : 1)
nano /boot/EFI/limine/limine.conftimeout: 3
/Arch Linux
protocol: linux
path: boot():/vmlinuz-linux
cmdline: quiet cryptdevice=UUID=<our_encrypted_root_partitions_parent_partition_UUID>:<encrypted_root_name> root=/dev/mapper/<encrypted_root_name> rw rootfstype=btrfs #WRITE THIS IN ONE LINE .....
module_path: boot():/initramfs-linux.img
Now you are maybe wondering , how can we get "<our_encrypted_root_partitions_parent_partition_UUID>"
Note : This UUID is not your's encrypred root partition, it's that partition's parent partition (like : nvme0n1p2 [in this guide])
blkid -o value -s UUID /dev/nvme0n1p2 >> /boot/EFI/limine/limine.confnano /boot/EFI/limine/limine.confIt's a alphanumeric long digit string
Go to that line and press "Ctrl + K"
Go to '<our_encrypted_root_partitions_parent_partition_UUID>' setion and paste the line.
timeout: 3
/Arch Linux
protocol: linux
path: boot():/vmlinuz-linux
cmdline: quiet cryptdevice=UUID=77AyyiY8Y-VGF8GVIVIBI-VGhCCU:cryptroot root=/dev/mapper/cryptroot rw rootfstype=btrfs
module_path: boot():/initramfs-linux.img
Now, all done!
Now exit our chroot
exitNow type
reboot
and open your boot options (like F2, ESC) and choose "Arch Linux Limine Bootloader" and after that, it should show a entry "Arch Linux" press "Enter".
When it boot it should ask you for the encrypted root password.
After that, you should enter your username and password.
All done, Arch Linux installed succesfully!
Simply connect to your wifi and if "iwd" is disabled or any probelm occured
sudo systemctl enable --now iwd.service and now you can connect, before instlling Omarchy (YOU CAN INSTALL ANYTHING YOU WANT) we need do this crucial steps:
nano /etc/iwd/main.conf[General]
EnableNetworkConfiguration=true
[Network]
NameResolvingService=nonesudo nano /etc/resolv.confnameserver 1.1.1.1
nameserver 8.8.8.8sudo chattr +i /etc/resolv.confNow use "ping" command to check internet.
ping -c 2 google.comIf this recives something then great! else ask for help.
sudo curl -fsSL https://omarchy.org/install | bashIt can ask you to enter password (one time or two times)
I belive this "Simplicity is better than complex, so thsi guide is designed for beginner to advancned. I knwo this guide can contain spelling and grammer mistakes
THANK YOU VERY MUCH! FOR READING OR CONTRIBUTING TO THIS GUIDE
VIDEO TUTORIAL COMMING SOON AS POSSIBLE......
IF YOU NEED ANY HELP CONTACT ME OR ASK ARCH COMMUNITY OR OMARCHY COMMUNITY AND GOOGLE IT!
LICENSE : MIT
Ahum