From 8fd013450bedfeba583b8b8b6e14567add4c0c41 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Tue, 23 Jul 2024 02:43:33 +0700 Subject: [PATCH] feat: latest archlinux --- docs/2022-12-25-archlinux.html | 200 ++++++++++++++++----------------- posts/2022-12-25-archlinux.md | 115 ++++++++----------- 2 files changed, 147 insertions(+), 168 deletions(-) diff --git a/docs/2022-12-25-archlinux.html b/docs/2022-12-25-archlinux.html index b73f950..2d48dbd 100644 --- a/docs/2022-12-25-archlinux.html +++ b/docs/2022-12-25-archlinux.html @@ -109,7 +109,9 @@

Check UEFI mode:

-
ls /sys/firmware/efi/efivars
+
cat /sys/firmware/efi/fw_platform_size
+# 64 or 32 is UEFI
+# File not found is BIOS

Connect to the internet

@@ -143,13 +145,22 @@
cgdisk /dev/sdx
-

- Partition scheme -

+

UEFI/GPT layout:

@@ -158,6 +169,7 @@ + @@ -166,18 +178,21 @@ + - + + +
Partition Partition type Suggested sizegdisk code
/dev/efi_system_partition EFI System Partition 512 MiBEF00
/mnt/boot /dev/extended_boot_loader_partitionExtended Boot Loader PartitionExtended Boot Loader Partition (XBOOTLDR) 1 GiBEA00
/mnt /dev/root_partition Root Partition 8300
@@ -196,6 +211,7 @@ Partition Partition type Suggested size + gdisk code @@ -204,16 +220,18 @@ BIOS boot partition 1 MiB + EF02 /mnt /dev/root_partition Root Partition + 8300 -

LVM:

+

LVM (optional):

# Create physical volumes
 pvcreate /dev/sdaX
@@ -235,10 +253,10 @@ mkfs.fat -F32 /dev/extended_boot_loader_partition
 # root
 mkfs.ext4 -L ROOT /dev/root_partition
 
-# root with btrfs
+# root with btrfs (optional)
 mkfs.btrfs -L ROOT /dev/root_partition
 
-# root on lvm
+# root on lvm (optional)
 mkfs.ext4 /dev/RootGroup/rootvol

Mount:

@@ -246,10 +264,10 @@ mkfs.ext4 /dev/RootGroup/rootvol
# root
 mount /dev/root_partition /mnt
 
-# root with btrfs
+# root with btrfs (optional)
 mount -o compress=zstd /dev/root_partition /mnt
 
-# root on lvm
+# root on lvm (optional)
 mount /dev/RootGroup/rootvol /mnt
 
 # efi
@@ -268,19 +286,26 @@ mount --mkdir /dev/extended_boot_loader_partition /mnt/boot
>
+

+ Please check + Mirrors + if you have slow Internet. +

pacstrap -K /mnt base linux linux-firmware
 
-# AMD
+# AMD (optional)
 pacstrap -K /mnt amd-ucode
 
-# Intel
+# Intel (optional)
 pacstrap -K /mnt intel-ucode
 
-# Btrfs
+# Btrfs (optional)
 pacstrap -K /mnt btrfs-progs
 
-# LVM
+# LVM (optional)
 pacstrap -K /mnt lvm2
 
 # Text editor
@@ -337,11 +362,10 @@ pacstrap -K /mnt neovim
>
-
+      
# Change Region/City to your location
 ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
 
-hwclock --systohc
+hwclock --systohc

Localization:

@@ -353,10 +377,11 @@ hwclock --systohc
-

Edit /etc/locale.gen:

-
-
# Uncomment en_US.UTF-8 UTF-8
-
+

+ Edit /etc/locale.gen then uncomment + # en_US.UTF-8 UTF-8 by removing # at the + beginning. +

Generate locales:

locale-gen

Edit /etc/locale.conf:

@@ -387,12 +412,12 @@ hwclock --systohc

Edit /etc/mkinitcpio.conf:

-
# LVM
+      
# LVM (optional)
 # https://wiki.archlinux.org/title/Install_Arch_Linux_on_LVM#Adding_mkinitcpio_hooks
-HOOKS=(base udev ... block lvm2 filesystems)
-
 # https://wiki.archlinux.org/title/mkinitcpio#Common_hooks
-# Replace udev with systemd
+# Replace udev with systemd +# Add lvm2 between block and filesystems +HOOKS=(base systemd ... block lvm2 filesystems)
mkinitcpio -P
@@ -407,26 +432,16 @@ HOOKS=(base udev ... block lvm2 filesystems)
passwd
-

Addition

- -
-
-
+

NetworkManager (WIP)NetworkManager -

+
@@ -434,37 +449,18 @@ HOOKS=(base udev ... block lvm2 filesystems)
pacman -Syu networkmanager dhcpcd iwd
 systemctl enable NetworkManager.service
 systemctl enable systemd-resolved.service
- -

Edit /etc/NetworkManager/conf.d/dns.conf:

-
-
[main]
-dns=systemd-resolved
-
-

Edit /etc/NetworkManager/conf.d/dhcp-client.conf:

-
-
[main]
-dhcp=dhcpcd

Edit /etc/NetworkManager/conf.d/wifi_backend.conf:

[device]
 wifi.backend=iwd
-

- See - dhcpcd -

-

Append /etc/dhcpcd.conf

-
-
-noarp
-nohook resolv.conf
-
-
Bluetooth
+

+ Bluetooth +

enable bluetooth.service
-
Clock
+

Clock

enable bluetooth.service >
+

+ Use + systemd-timesyncd +

-
timedatectl set-ntp true
+
timedatectl set-ntp true
+
+timedatectl status

Boot loader

@@ -500,22 +506,12 @@ systemctl enable bluetooth.service >
-
-
- systemd-boot -
- -
+

+ Use + systemd-boot +

Install using XBOOTLDR:

bootctl --esp-path=/efi --boot-path=/boot install
@@ -543,15 +539,15 @@ console-mode max
title Arch Linux linux /vmlinuz-linux -# Intel +# Intel (optional) initrd /intel-ucode.img -# AMD +# AMD (optional) initrd /amd-ucode.img initrd /initramfs-linux.img -# Kernel parameters +# Kernel parameters (optional) # # Acer Nitro AN515-45 # https://wiki.archlinux.org/title/backlight#Kernel_command-line_options @@ -600,12 +596,12 @@ options root="LABEL=ROOT" rw
pacman -Syu sudo
 
 EDITOR=nvim visudo
-# Uncomment group wheel
+# Uncomment group wheel by removing % at the beginning of %wheel ...
 
 # Add user if don't want to use systemd-homed
 useradd -m -G wheel -c "The Joker" joker
 
-# Or using zsh
+# Or using zsh (optional)
 useradd -m -G wheel -s /usr/bin/zsh -c "The Joker" joker
 
 # Set password
@@ -615,7 +611,7 @@ passwd joker
systemd-homed (WIP)systemd-homed (optional if no useradd before):

@@ -623,7 +619,7 @@ passwd joker homectl create joker --real-name="The Joker" --member-of=wheel -# Using zsh +# Using zsh (optional) homectl update joker --shell=/usr/bin/zsh

@@ -722,14 +718,14 @@ ParallelDownloads

Pipewire (WIP)Pipewire

@@ -754,14 +750,14 @@ pacman -Syu pipewire wireplumber \

Flatpak (WIP)Flatpak

diff --git a/posts/2022-12-25-archlinux.md b/posts/2022-12-25-archlinux.md index 20e0041..f3a9832 100644 --- a/posts/2022-12-25-archlinux.md +++ b/posts/2022-12-25-archlinux.md @@ -23,7 +23,9 @@ lsblk Check UEFI mode: ```sh -ls /sys/firmware/efi/efivars +cat /sys/firmware/efi/fw_platform_size +# 64 or 32 is UEFI +# File not found is BIOS ``` #### Connect to the internet @@ -38,27 +40,28 @@ For wifi, use [iwd](https://wiki.archlinux.org/index.php/Iwd). cgdisk /dev/sdx ``` -[Partition scheme](https://wiki.archlinux.org/index.php/Partitioning#Partition_scheme) +- [Partition scheme](https://wiki.archlinux.org/index.php/Partitioning#Partition_scheme) +- [EFI system partition](https://wiki.archlinux.org/title/EFI_system_partition) UEFI/GPT layout: -| Mount point | Partition | Partition type | Suggested size | -| ----------- | ------------------------------------- | ------------------------------ | -------------- | -| `/mnt/efi` | `/dev/efi_system_partition` | EFI System Partition | 512 MiB | -| `/mnt/boot` | `/dev/extended_boot_loader_partition` | Extended Boot Loader Partition | 1 GiB | -| `/mnt` | `/dev/root_partition` | Root Partition | | +| Mount point | Partition | Partition type | Suggested size | gdisk code | +| ----------- | ------------------------------------- | ----------------------------------------- | -------------- | ---------- | +| `/mnt/efi` | `/dev/efi_system_partition` | EFI System Partition | 512 MiB | EF00 | +| `/mnt/boot` | `/dev/extended_boot_loader_partition` | Extended Boot Loader Partition (XBOOTLDR) | 1 GiB | EA00 | +| `/mnt` | `/dev/root_partition` | Root Partition | | 8300 | Why not `/boot/efi`? See [Lennart Poettering comment](https://github.com/systemd/systemd/pull/3757#issuecomment-234290236). BIOS/GPT layout: -| Mount point | Partition | Partition type | Suggested size | -| ----------- | --------------------- | ------------------- | -------------- | -| | | BIOS boot partition | 1 MiB | -| `/mnt` | `/dev/root_partition` | Root Partition | | +| Mount point | Partition | Partition type | Suggested size | gdisk code | +| ----------- | --------------------- | ------------------- | -------------- | ---------- | +| | | BIOS boot partition | 1 MiB | EF02 | +| `/mnt` | `/dev/root_partition` | Root Partition | | 8300 | -LVM: +LVM (optional): ```sh # Create physical volumes @@ -83,10 +86,10 @@ mkfs.fat -F32 /dev/extended_boot_loader_partition # root mkfs.ext4 -L ROOT /dev/root_partition -# root with btrfs +# root with btrfs (optional) mkfs.btrfs -L ROOT /dev/root_partition -# root on lvm +# root on lvm (optional) mkfs.ext4 /dev/RootGroup/rootvol ``` @@ -96,10 +99,10 @@ Mount: # root mount /dev/root_partition /mnt -# root with btrfs +# root with btrfs (optional) mount -o compress=zstd /dev/root_partition /mnt -# root on lvm +# root on lvm (optional) mount /dev/RootGroup/rootvol /mnt # efi @@ -111,19 +114,22 @@ mount --mkdir /dev/extended_boot_loader_partition /mnt/boot ### Installation +Please check [Mirrors](https://wiki.archlinux.org/title/Mirrors) if you have +slow Internet. + ```sh pacstrap -K /mnt base linux linux-firmware -# AMD +# AMD (optional) pacstrap -K /mnt amd-ucode -# Intel +# Intel (optional) pacstrap -K /mnt intel-ucode -# Btrfs +# Btrfs (optional) pacstrap -K /mnt btrfs-progs -# LVM +# LVM (optional) pacstrap -K /mnt lvm2 # Text editor @@ -147,6 +153,7 @@ arch-chroot /mnt #### Time zone ```sh +# Change Region/City to your location ln -sf /usr/share/zoneinfo/Region/City /etc/localtime hwclock --systohc @@ -154,11 +161,8 @@ hwclock --systohc #### Localization: -Edit `/etc/locale.gen`: - -```txt -# Uncomment en_US.UTF-8 UTF-8 -``` +Edit `/etc/locale.gen` then uncomment `# en_US.UTF-8 UTF-8` by removing `#` at +the beginning. Generate locales: @@ -185,12 +189,12 @@ myhostname Edit `/etc/mkinitcpio.conf`: ```txt -# LVM +# LVM (optional) # https://wiki.archlinux.org/title/Install_Arch_Linux_on_LVM#Adding_mkinitcpio_hooks -HOOKS=(base udev ... block lvm2 filesystems) - # https://wiki.archlinux.org/title/mkinitcpio#Common_hooks # Replace udev with systemd +# Add lvm2 between block and filesystems +HOOKS=(base systemd ... block lvm2 filesystems) ``` ```sh @@ -203,9 +207,7 @@ mkinitcpio -P passwd ``` -#### Addition - -##### [NetworkManager (WIP)](https://wiki.archlinux.org/title/NetworkManager) +#### [NetworkManager](https://wiki.archlinux.org/title/NetworkManager) ```sh pacman -Syu networkmanager dhcpcd iwd @@ -213,20 +215,6 @@ systemctl enable NetworkManager.service systemctl enable systemd-resolved.service ``` -Edit `/etc/NetworkManager/conf.d/dns.conf`: - -```txt -[main] -dns=systemd-resolved -``` - -Edit `/etc/NetworkManager/conf.d/dhcp-client.conf`: - -```txt -[main] -dhcp=dhcpcd -``` - Edit `/etc/NetworkManager/conf.d/wifi_backend.conf`: ```txt @@ -234,31 +222,26 @@ Edit `/etc/NetworkManager/conf.d/wifi_backend.conf`: wifi.backend=iwd ``` -See [dhcpcd](https://wiki.archlinux.org/title/Dhcpcd) - -Append `/etc/dhcpcd.conf` - -```txt -noarp -nohook resolv.conf -``` - -##### Bluetooth +#### [Bluetooth](https://wiki.archlinux.org/title/Bluetooth) ```sh pacman -Syu bluez systemctl enable bluetooth.service ``` -##### Clock +#### Clock + +Use [systemd-timesyncd](https://wiki.archlinux.org/title/Systemd-timesyncd) ```sh timedatectl set-ntp true + +timedatectl status ``` #### Boot loader -##### [systemd-boot](https://wiki.archlinux.org/index.php/Systemd-boot) +Use [systemd-boot](https://wiki.archlinux.org/index.php/Systemd-boot) Install using XBOOTLDR: @@ -285,15 +268,15 @@ Edit `/boot/loader/entries/archlinux.conf`: title Arch Linux linux /vmlinuz-linux -# Intel +# Intel (optional) initrd /intel-ucode.img -# AMD +# AMD (optional) initrd /amd-ucode.img initrd /initramfs-linux.img -# Kernel parameters +# Kernel parameters (optional) # # Acer Nitro AN515-45 # https://wiki.archlinux.org/title/backlight#Kernel_command-line_options @@ -317,26 +300,26 @@ Always remember to check **dependencies** when install packages. pacman -Syu sudo EDITOR=nvim visudo -# Uncomment group wheel +# Uncomment group wheel by removing % at the beginning of %wheel ... # Add user if don't want to use systemd-homed useradd -m -G wheel -c "The Joker" joker -# Or using zsh +# Or using zsh (optional) useradd -m -G wheel -s /usr/bin/zsh -c "The Joker" joker # Set password passwd joker ``` -[systemd-homed (WIP)](https://wiki.archlinux.org/index.php/Systemd-homed): +[systemd-homed (optional if no useradd before)](https://wiki.archlinux.org/index.php/Systemd-homed): ```sh systemctl enable systemd-homed.service homectl create joker --real-name="The Joker" --member-of=wheel -# Using zsh +# Using zsh (optional) homectl update joker --shell=/usr/bin/zsh ``` @@ -382,7 +365,7 @@ Color ParallelDownloads ``` -### [Pipewire (WIP)](https://wiki.archlinux.org/title/PipeWire) +### [Pipewire](https://wiki.archlinux.org/title/PipeWire) ```sh pacman -Syu pipewire wireplumber \ @@ -397,7 +380,7 @@ See pacman -Syu sof-firmware ``` -### [Flatpak (WIP)](https://wiki.archlinux.org/title/Flatpak) +### [Flatpak](https://wiki.archlinux.org/title/Flatpak) ```sh pacman -Syu flatpak