Skip to content

Commit f514433

Browse files
committed
feat(arch): update Arch Linux system installation guide
- Fix typographical errors - Use Btrfs as root and home filesystem - Remove swap partition - Use zram - Configure Pacman earlier in the guide - Install graphics drivers - Setup `initramfs` Signed-off-by: chris1320 <chris1320is@protonmail.com>
1 parent 4c7573f commit f514433

File tree

4 files changed

+152
-79
lines changed

4 files changed

+152
-79
lines changed

Operating Systems/Arch Linux/Arch Linux.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ tags:
3232

3333
This repository contains most of my dotfiles and notes that are used in my Arch Linux installation. You can use the [[Automatic Customization|auto-install script]] to automatically install Arch Linux and the dotfiles in your system. However, I don't guarantee that the installer covers all your needs. In such cases (or you probably do not want to start from scratch), this guide assumes that...
3434

35-
- You've successfully installed Arch Linux by following their [installation guide](https://wiki.archlinux.org/title/Installation_guide) which can be found in their [wiki](https://wiki.archlinux.org/). Otherwise, follow the [[System Installation|system installation guide]]] before proceeding.
36-
- You have made a [[System Installation#Add A Non-Root User Account|non-root user]]] in your system and is currently active.
35+
- You've successfully installed Arch Linux by following their [installation guide](https://wiki.archlinux.org/title/Installation_guide) which can be found in their [wiki](https://wiki.archlinux.org/). Otherwise, follow the [[System Installation|system installation guide]] before proceeding.
36+
- You have made a [[System Installation#Add A Non-Root User Account|non-root user]] in your system and is currently active.
3737
- You are currently connected to the internet.
3838

3939
Some, if not all of the dotfiles, can also be used in other operating systems/distributions, but it's up to you on how you will do it since I haven't tested it on other systems yet.
4040

41-
> [!NOTE]
41+
> [!WARNING]
4242
>
4343
> This guide is currently under active development. Documentation might be outdated because the dotfiles/scripts are updated frequently.
4444

Operating Systems/Arch Linux/Contents/Environment.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,23 @@ I am using Arch Linux on my laptop because it gives me a functional system while
88

99
### Disk Partitions
1010

11-
During the installation I've configured my machine to have the following
12-
disk partitions:
11+
During the installation I've configured my machine to have the following disk partitions:
1312

14-
| Device | Size | Mountpoint | Filesystem | Label | Description |
15-
| ----------- | ----------------------- | ----------- | ---------- | ----- | ----------------- |
16-
| `/dev/sda1` | 300M | `/mnt/boot` | FAT32 | EFI | EFI Partition |
17-
| `/dev/sda2` | 8G | SWAP | SWAP | SWAP | Swap Partition |
18-
| `/dev/sda3` | 60G | `/mnt` | BTRFS | ROOT | `/` Partition |
19-
| `/dev/sda4` | Remaining of the Device | `/mnt/home` | EXT4 | HOME | `/home` Partition |
13+
| Device | Size | Mountpoint | Filesystem | Label | Description |
14+
| ----------- | ----------------------- | --------------- | ---------- | ----- | -------------------------- |
15+
| `/dev/sda1` | 600M | `/mnt/boot/efi` | FAT32 | EFI | The EFI partition |
16+
| `/dev/sda2` | 1G | `/mnt/boot` | EXT4 | BOOT | The boot partition |
17+
| `/dev/sda3` | Remaining of the Device | `/mnt` | Btrfs | ARCH | The root and home parition |
18+
19+
`/dev/sda3` will be a [Btrfs filesystem](https://wiki.archlinux.org/title/Btrfs) with the following subvolumes:
20+
21+
| Subvolume | Description |
22+
| ----------------- | ------------------------------------------- |
23+
| `/mnt/@root` | The root partition |
24+
| `/mnt/@home` | The home partition |
25+
| `/mnt/@snapshots` | The partition where snapshots will be saved |
26+
27+
I used to have a dedicated swap partition, but I am now using [zram](https://wiki.archlinux.org/title/Zram) instead.
2028

2129
### Programs Used
2230

Operating Systems/Arch Linux/Contents/Manual Customization.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ Now that you have a new Arch Linux system, we will now start performing customiz
77
[Install Paru](https://github.com/Morganamilo/paru). This is the AUR helper that we will use.
88

99
```bash
10-
sudo pacman -S --needed base-devel # If it is not yet installed
10+
sudo pacman -S --needed base-devel rustup # If it is not yet installed
11+
12+
# Install the latest stable version of Rust
13+
rustup toolchain install stable
1114

1215
# Clone the repo in a temp directory.
1316
export PARU_TMP_DIR=$(mktemp -d)
@@ -44,6 +47,8 @@ paru -Syu otf-font-awesome ttf-jetbrains-mono-nerd ttf-noto-nerd \
4447
papirus-icon-theme papirus-folders-catppuccin-git
4548
```
4649

50+
> [!CAUTION] If `papirus-folders-catppuccin-git` fails to install, just re-login or reboot the system after installing `papirus-icon-theme`.
51+
4752
## Useful Packages
4853

4954
It is recommended to install and enable the following packages.

Operating Systems/Arch Linux/Contents/System Installation.md

Lines changed: 127 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# System Installation
22

3-
If you haven't installed Arch Linux yet, continue reading. Otherwise, you might want to skip to the [[Manual Customization|manual]]] or [[Automatic Customization|automatic]] customization steps.
3+
If you haven't installed Arch Linux yet, continue reading. Otherwise, you might want to skip to the [[Manual Customization|manual]] or [[Automatic Customization|automatic]] customization steps.
44

55
I recommend that you read the [Arch Linux Wiki](https://wiki.archlinux.org/)'s [installation guide](https://wiki.archlinux.org/title/Installation_guide) instead since it is more updated and accurate than a guide that is maintained by one hobbyist like me. I also recommend reading [arch.d3sox.me](https://arch.d3sox.me/) if you have trouble understanding the wiki.
66

@@ -36,7 +36,7 @@ station wlan0 connect <SSID>
3636
exit
3737
```
3838

39-
> If you are having problems turning on your wireless NIC, make sure that it is not being soft-blocked by `rfkill`.
39+
> [!TIP] If you are having problems turning on your wireless NIC, make sure that it is not being soft-blocked by `rfkill`.
4040
4141
To make sure that you have an internet connection, ping the Arch Linux website.
4242

@@ -76,19 +76,30 @@ In my case, my main storage device is located at `/dev/sda`. So we run the follo
7676
fdisk /dev/sda
7777
```
7878

79-
Partition the device following the structure shown in [[Environment#Disk Partitions|Environment > Disk Partitions]]]. If you have different needs, you can see more examples in the [Arch Linux Wiki](https://wiki.archlinux.org/title/Partitioning#Example_layouts) and [d3sox](https://arch.d3sox.me/installation/partitioning-formatting#size-recommendations)'s guide. After saving the changes made by `fdisk`, create the filesystems.
79+
Partition the device following the structure shown in [[Environment#Disk Partitions|Environment > Disk Partitions]]. If you have different needs, you can see more examples in the [Arch Linux Wiki](https://wiki.archlinux.org/title/Partitioning#Example_layouts) and [d3sox](https://arch.d3sox.me/installation/partitioning-formatting#size-recommendations)'s guide. After saving the changes made by `fdisk`, create the filesystems.
8080

8181
```bash
82-
mkfs.fat -F32 -n EFI /dev/sda1 # Create a FAT32 filesystem in `/dev/sda1` with label "EFI"
83-
mkswap -L SWAP /dev/sda2 # Create a SWAP filesystem in `/dev/sda2` with label "SWAP"
84-
mkfs.btrfs -L ROOT /dev/sda3 # Create a BTRFS filesystem in `/dev/sda3` with label "ROOT"
85-
mkfs.ext4 -L HOME /dev.sda4 # Create an EXT4 filesystem in `/dev/sda4` with label "HOME"
82+
mkfs.fat -F32 -n EFI /dev/sda1 # Create a FAT32 filesystem in `/dev/sda1` labeled "EFI"
83+
mkfs.ext4 -L BOOT /dev/sda2 # Create an EXT4 filesystem in `/dev/sda2` labeled "BOOT"
84+
mkfs.btrfs -L ARCH /dev/sda3 # Create a BTRFS filesystem in `/dev/sda3` labeled "ARCH"
85+
86+
# Mount /mnt to create Btrfs subvolumes.
87+
mount --mkdir /dev/sda3 /mnt
88+
89+
# Create Btrfs subvolumes
90+
btrfs subvolume create /mnt/@
91+
btrfs subvolume create /mnt/@home
92+
btrfs subvolume create /mnt/@snapshots
93+
94+
# Unmount /mnt
95+
umount /mnt
8696

8797
# Mount the partitions in their respective mountpoints.
88-
mount /dev/sda3 /mnt
89-
mount --mkdir /dev/sda1 /mnt/boot
90-
mount --mkdir /dev/sda4 /mnt/home
91-
swapon /dev/sda2
98+
mount --mkdir -o noatime,compress=zstd:1,subvol=@ /dev/sda3 /mnt
99+
mount --mkdir -o noatime,compress=zstd:1,subvol=@home /dev/sda3 /mnt/home
100+
mount --mkdir -o noatime,compress=zstd:1,subvol=@snapshots /dev/sda3 /mnt/snapshots
101+
mount --mkdir /dev/sda2 /mnt/boot
102+
mount --mkdir /dev/sda1 /mnt/boot/efi
92103
```
93104

94105
## Installing Arch Linux
@@ -123,10 +134,11 @@ Use the `pacstrap` command to install Arch Linux into your system.
123134
pacstrap -K /mnt \
124135
base base-devel linux linux-firmware linux-headers \
125136
networkmanager wpa_supplicant \
126-
sysfsutils usbutils btrfs-progs e2fsprogs \
137+
sysfsutils usbutils btrfs-progs e2fsprogs dosfstools lvm2 \
127138
inetutils dhcping traceroute \
128-
nano less which tree sudo \
129-
man-db man-pages
139+
nano less which tree sudo reflector \
140+
man-db man-pages \
141+
git git-lfs xdg-utils xdg-user-dirs
130142
```
131143

132144
Append more package names as you wish. This command may take a while to complete.
@@ -140,34 +152,119 @@ genfstab -L /mnt >> /mnt/etc/fstab # Define by labels
140152
genfstab -U /mnt >> /mnt/etc/fstab # Define by UUIDs
141153
```
142154

143-
> **NOTE**: Check the `/mnt/etc/fstab` file for any errors.
155+
> [!NOTE] Check the `/mnt/etc/fstab` file for any errors.
144156
145157
### Chroot into Your New Arch Linux System
146158

147159
```bash
148160
arch-chroot /mnt
149161
```
150162

151-
### Install Bootloader
163+
### Configure Pacman
152164

153-
In this step, I assume that you are installing on a UEFI system. Otherwise, check [d3sox](https://arch.d3sox.me/installation/install-bootloader) for more information.
165+
```bash
166+
nano /etc/pacman.conf
167+
```
168+
169+
#### Enable `multilib` Repository
170+
171+
Uncomment the following lines to make 32-bit libraries available to download.
172+
173+
```text
174+
[multilib]
175+
Include = /etc/pacman.d/mirrorlist
176+
```
177+
178+
#### Enable Parallel Downloads
179+
180+
Uncomment the following line to enable parallel downloading of files. You can change the value to whatever you like.
181+
182+
```text
183+
ParallelDownloads = 5
184+
```
185+
186+
#### Other Stuff
187+
188+
Uncomment/Add the following lines under `Misc options`:
189+
190+
1. `Color`
191+
2. `ILoveCandy`
192+
3. `VerbosePkgLists`
193+
194+
#### Post-Configuration
195+
196+
After editing the configuration file, you may now save and close it. Run `pacman -Syu` to update the repositories.
197+
198+
### Add `zram`
199+
200+
Instead of having a swap partition, we are going to use zram instead.
154201

155202
```bash
156-
pacman -S grub efibootmgr os-prober
157-
mkdir -p /boot/EFI/GRUB
158-
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
159-
grub-mkconfig -o /boot/grub/grub.cfg
203+
pacman -S zram-generator
204+
```
205+
206+
After installation, create/edit `/etc/systemd/zram-generator.conf` and replace its contents with the following:
207+
208+
```
209+
[zram0]
210+
zram-size = min(ram, 8192)
211+
compression-algorithm = zstd
212+
```
213+
214+
We can also optimize our `zram` configuration by creating `/etc/sysctl.d/99-vm-zram-parameters.conf` and adding the following in the file:
215+
216+
```
217+
vm.swappiness = 180
218+
vm.watermark_boost_factor = 0
219+
vm.watermark_scale_factor = 125
220+
vm.page-cluster = 0
221+
```
222+
223+
### Installing The Graphics Driver
224+
225+
Depending on your graphics card, run the appropriate command to install the graphics drivers needed:
226+
227+
| Manufacturer | Command |
228+
| -------------------- | ------------------------------------------------------------------------------------------------------------ |
229+
| AMD | `pacman -S mesa lib32-mesa xf86-video-amdgpu vulkan-radeon lib32-vulkan-radeon libva-mesa-driver mesa-vdpau` |
230+
| Intel | `pacman -S mesa lib32-mesa xf86-video-intel vulkan-intel` |
231+
| Nvidia (Proprietary) | `pacman -S nvidia-dkms nvidia-settings nvidia-utils lib32-nvidia-utils` |
232+
| Nvidia (Nouveau) | `pacman -S mesa xf86-video-nouveau` |
233+
234+
### `initramfs` Setup
235+
236+
Now, we need to edit our initial ram disk by running `nano /etc/mkinitcpio.conf`. Inside the parenthesis of `MODULES=()`, add the following (separated by a space):
237+
238+
- `btrfs` and `ext4`, since we are using Btrfs and EXT4 as our filesystems.
239+
- `amdgpu` if you are running AMD GPU, `i915` if Intel, `nvidia nvidia_modeset nvidia_uvm nvidia_drm` if you use proprietary Nvidia drivers, or `nouveau` if you are using open-source Nvidia drivers.
240+
241+
As an example, my machine has a built-in Intel GPU so I have the following:
242+
243+
```bash
244+
MODULES=(btrfs ext4 i915)
160245
```
161246

162-
> [!TIP]
247+
After editing, we run `mkinitcpio -P` to process all preset files.
248+
249+
### Install Bootloader
250+
251+
In this step, I assume that you are installing on a UEFI system. Otherwise, check [d3sox](https://arch.d3sox.me/installation/install-bootloader) for more information.
252+
253+
> [!TIP]+
163254
>
164255
> If you want to automatically detect other operating systems, run `nano /etc/default/grub` and add/uncomment the following line:
165256
>
166257
> ```bash
167258
> GRUB_DISABLE_OS_PROBER=false
168259
> ```
169260
170-
> [!NOTE]
261+
```bash
262+
pacman -S grub efibootmgr os-prober grub-btrfs
263+
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
264+
grub-mkconfig -o /boot/grub/grub.cfg
265+
```
266+
267+
> [!NOTE]+
171268
>
172269
> If you forgot to perform `grub-mkconfig` and shut down/reboot the system instead (which I _totally_ did not do while installing Arch), just boot into your live USB again, mount the partitions, and `chroot` into your system.
173270
@@ -209,41 +306,6 @@ ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
209306
hwclock --systohc
210307
```
211308

212-
### Configure Pacman
213-
214-
```bash
215-
nano /etc/pacman.conf
216-
```
217-
218-
#### Enable `multilib` Repository
219-
220-
Uncomment the following lines to make 32-bit libraries available to download.
221-
222-
```text
223-
[multilib]
224-
Include = /etc/pacman.d/mirrorlist
225-
```
226-
227-
#### Enable Parallel Downloads
228-
229-
Uncomment the following line to enable parallel downloading of files. You can change the value to whatever you like.
230-
231-
```text
232-
ParallelDownloads = 5
233-
```
234-
235-
#### Other Stuff
236-
237-
Uncomment/Add the following lines under `Misc options`:
238-
239-
1. `Color`
240-
2. `ILoveCandy`
241-
3. `VerbosePkgLists`
242-
243-
#### Post-Configuration
244-
245-
After editing the configuration file, you may now save and close it. Run `pacman -Syu` to update the repositories.
246-
247309
### Setting Up Users
248310

249311
> [!TIP] It is recommended to use strong passwords for your user accounts.
@@ -256,12 +318,9 @@ passwd
256318

257319
#### Add A Non-Root User Account
258320

259-
A common security practice is that you should **not** use the root account
260-
unless needed and you know that it is safe to run. To create a non-root
261-
user, run the commands below and change the parameters to the values you desire.
321+
A common security practice is that you should **not** use the root account unless needed and you know that it is safe to run. To create a non-root user, run the commands below and change the parameters to the values you desire.
262322

263-
> For more information, visit the
264-
> [Arch wiki](https://wiki.archlinux.org/title/Users_and_groups).
323+
> [!QUESTION] For more information, visit the [Arch wiki](https://wiki.archlinux.org/title/Users_and_groups).
265324
266325
```bash
267326
# Change <USERNAME> with your desired username.
@@ -278,17 +337,18 @@ EDITOR=nano visudo
278337
And uncomment the following line to allow members of the group `wheel` to execute any command:
279338

280339
```text
281-
%wheel ALL=(ALL) ALL
340+
%wheel ALL=(ALL:ALL) ALL
282341
```
283342

284-
## Enable `NetworkManager` Service
343+
### Enable `NetworkManager` Service
285344

286345
```bash
287346
systemctl enable NetworkManager.service
288-
systemctl start NetworkManager.service
289347
```
290348

291-
### Enable Wireless Network Interface
349+
#### Enable Wireless Network Interface
350+
351+
> [!ERROR] This section will be removed in the future as this is not necessary, and will **result in an error** instead.
292352
293353
You can enable the WLAN interface by using the `nmcli` command.
294354

0 commit comments

Comments
 (0)