diff --git a/guides/01_INSTALLATION.md b/guides/01_INSTALLATION.md index af25c80..b05e861 100644 --- a/guides/01_INSTALLATION.md +++ b/guides/01_INSTALLATION.md @@ -9,6 +9,34 @@ be a useful resource for you too, if you want to achieve a similar setup. This guide includes steps for full disk encryption, and sets up the system with some basic tools and my zsh configuration. +## Internet + +If you're using ethernet, you can skip this part, it focuses on Wi-Fi. + +To connect to Wi-Fi from the installation ISO system, run `iwctl`. From there, run: + +```bash +device list +# Find the device you're interested in, usually something like wlan0 +# Also take notice of the adapter name that this device uses +# +# Before anything else, make sure to power on the device and the adapter +device [device] set-property Powered on +adapter [adapter] set-property Powered on +# Now put the device into a scan mode and get the results +# You can skip this part if you know the SSID +station [device] scan +station [device] get-networks +# Find the SSID of the network you're interested +station [device] connect "[SSID]" +# You'll be prompted for a password, enter it, then you should get connected +# To leave iwd, press Ctrl+D +``` + +Finally, let's to sure it worked, run: `ping 1.1.1.1`. + +To get DNS working too, you'll also want to run `dhcpcd`, then you can with `ping google.com` + ## Partitioning First thing we will need to do is set up partitions. To do so, I recommend using @@ -16,18 +44,22 @@ First thing we will need to do is set up partitions. To do so, I recommend using partitions: - EFI (1 GB) -- Swap (same size as your RAM, or more) -- Data (rest) +- Root, Data & Swap (rest) -The swap partition is optional, however I do recommend creating it (instead of -using a swap file), as it will allow you to hibernate your machine. +Some people like to use a swap partition, however, doing so on an otherwise encrypted +system introduces you to unnecessary risk factors, as your swap likely won't be encrypted. +This is especially problematic for hibernation, as hibernating into an unencrypted swap +partition will allow passwordless restore. + +Instead, I prefer using a swapfile within BTRFS. This still allows hibernation with +systemd initrd, but only after unlocking the partition. > [!NOTE] > Don't forget to also set the type for these partitions (`t` command in `fdisk`). > > - EFI partition type: EFI System (1) -> - Swap partition type: Linux swap (19) -> - Data partition type: Linux filesystem (20) +> - Root partition type: Linux root x86-64 (23) +> - (Extra) Data partition type: Linux filesystem (20) ### File-Systems @@ -37,8 +69,6 @@ Now we'll to create file systems on these partitions, and give them disk labels: mkfs.fat -F 32 /dev/sdX1 fatlabel /dev/sdX1 EFI -mkswap -L SWAP /dev/diskX2 - cryptsetup luksFormat /dev/sdX3 --label CRYPTFS cryptsetup open /dev/disk/by-label/CRYPTFS crypfs mkfs.btrfs -L FS /dev/mapper/cryptfs @@ -62,12 +92,15 @@ Now we will split our btrfs partition into the following subvolumes: and backed up. - snapshots: A subvolume that will be used to store snapshots (backups) of the other subvolumes +- swap: A subvolume containing the swap file ```bash mount /dev/mapper/cryptfs /mnt btrfs subvolume create /mnt/root btrfs subvolume create /mnt/data btrfs subvolume create /mnt/snapshots +btrfs subvolume create /mnt/swap +btrfs filesystem mkswapfile --size 16g --uuid clear /mnt/swap/swapfile umount /mnt ``` @@ -76,30 +109,29 @@ umount /mnt > [!NOTE] -> Even though we're specifying the `compress` flag in the mount options of each -> btrfs subvolume, somewhat misleadingly, you can't actually use different -> compression levels for different subvolumes. Btrfs will share the same -> compression level across the whole partition, so it's pointless to attempt to -> set different values here. +> The `compress` mount flag will only affect the newly created files, if you're adding +> this option later on, older files will still remain uncompressed/differently compressed +> on the disk. > [!NOTE] > You may have seen others use btrfs options such as `ssd`, `discard=async` and -> `space_cache=v2`. These are all default (with the `ssd` being auto-detected), -> so specifying them is pointless now. +> `space_cache=v2`. These are all default on modern kernels (with the `ssd` being +> auto-detected), so specifying them is pointless now. ```bash -mount -o subvol=root,compress=zstd:3,noatime /dev/mapper/cryptfs /mnt -mount --mkdir -o subvol=home,compress=zstd:3,noatime /dev/mapper/cryptfs /mnt/data -mount --mkdir -o subvol=snapshots,compress=zstd:3,noatime /dev/mapper/cryptfs /mnt/snapshots -mount --mkdir -o compress=zstd:3,noatime /dev/mapper/cryptfs /mnt/.btrfs +mount -o subvol=root,noatime,lazytime,commit=120,compress=zstd:1 /dev/mapper/cryptfs /mnt +mount --mkdir -o subvol=snapshots,noatime,lazytime,commit=120,compress=zstd:1 /dev/mapper/cryptfs /mnt/snapshots +mount --mkdir -o subvol=home,noatime,lazytime,commit=120,compress=zstd:5 /dev/mapper/cryptfs /mnt/data +mount --mkdir -o noatime,lazytime,commit=120,compress=zstd:1 /dev/mapper/cryptfs /mnt/.btrfs +mount --mkdir -o subvol=swap /dev/mapper/cryptfs /mnt/swap mount --mkdir /dev/disk/by-label/EFI /mnt/efi mkdir /mnt/efi/arch mount --mkdir --bind /mnt/efi/arch /mnt/boot -swapon /dev/disk/by-label/SWAP +swapon /mnt/swap/swapfile ``` ## Base installation @@ -193,23 +225,24 @@ they're way too permissive. This is how I like to structure my fstab: # /dev/nvme1n1p1 LABEL=EFI UUID=A34B-A020 /dev/disk/by-label/EFI /efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2 -# /dev/nvme1n1p2 LABEL=SWAP UUID=d262a2e5-a1a3-42b1-ac83-18639f5e8f3d -/dev/disk/by-label/SWAP none swap defaults 0 0 - # endregion # region: BTRFS Subvolumes # /dev/mapper/cryptfs LABEL=FS UUID=bffc7a62-0c7e-4aa9-b10e-fd68bac477e0 -/dev/mapper/cryptfs / btrfs rw,noatime,compress=zstd:1,subvol=/root 0 1 -/dev/mapper/cryptfs /data btrfs rw,noatime,compress=zstd:1,subvol=/data 0 2 -/dev/mapper/cryptfs /snapshots btrfs rw,noatime,compress=zstd:1,subvol=/snapshots 0 2 -/dev/mapper/cryptfs /.btrfs btrfs rw,noatime,compress=zstd:1 0 2 +/dev/mapper/cryptfs / btrfs rw,noatime,lazytime,compress=zstd:1,ssd,space_cache=v2,commit=120,discard=async,subvol=/root 0 1 +/dev/mapper/cryptfs /data btrfs rw,noatime,lazytime,compress=zstd:5,ssd,space_cache=v2,commit=120,discard=async,subvol=/data 0 2 +/dev/mapper/cryptfs /snapshots btrfs rw,noatime,lazytime,compress=zstd:1,ssd,space_cache=v2,commit=120,discard=async,subvol=/snapshots 0 2 +/dev/mapper/cryptfs /swap btrfs rw,subvol=/swap 0 0 +/dev/mapper/cryptfs /.btrfs btrfs rw,noatime,lazytime,compress=zstd:1,ssd,space_cache=v2,commit=120,discard=async 0 2 # endregion # region: Bind mounts # Write kernel images to /efi/arch, not directly to efi system partition (esp), to avoid conflicts when dual booting -/efi/arch /boot none rw,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro,bind 0 0 +/efi/arch /boot none rw,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro,bind 0 0 + +# Swap into a file on the btrfs partition +/swap/swapfile none swap defaults 0 0 # endregion ``` @@ -302,7 +335,7 @@ options rw loglevel=3 And finally configure loader - `/efi/loader/loader.conf` (overwrite the contents): ```bash -default arch-hyprland.conf +default arch.conf timeout 4 console-mode auto editor yes diff --git a/home/.config/black b/home/.config/black deleted file mode 100644 index d1eb50d..0000000 --- a/home/.config/black +++ /dev/null @@ -1,2 +0,0 @@ -[tool.black] -line-length=119 diff --git a/home/.config/shell/environment b/home/.config/shell/environment index 5a90cef..44a0027 100755 --- a/home/.config/shell/environment +++ b/home/.config/shell/environment @@ -53,11 +53,13 @@ export XDG_PICTURES_DIR="$HOME/Media/Pictures" export XDG_VIDEOS_DIR="$HOME/Media/Videos" export XDG_SCREENSHOTS_DIR="$HOME/Media/Pictures/Screenshots" -# Per-Application XDG settings +# ZSH dirs export ZDOTDIR="$XDG_CONFIG_HOME/zsh" export ZSH_CACHE="$HOME/.cache/zsh" export HISTFILE="$ZSH_CACHE/history" -export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION" +export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-${ZSH_VERSION:-}" + +# Per-Application XDG settings export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc" #export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs. export LESSHISTFILE="-" diff --git a/root/.rsync-filter b/root/.rsync-filter index a19ad20..1a93ab4 100644 --- a/root/.rsync-filter +++ b/root/.rsync-filter @@ -20,3 +20,6 @@ - /swapfile - /swap/* - /home/*/.cache/* +- /.btrfs/* +- /snapshots/* +- /data/*