# Arch Linux Installation Guide (2023.10.20) First of all, welcome to be an Archer :) Then, let's start. ## Installation Medium Download the .iso file from the following link: https://archlinux.org/download/ ## Prepare an Installation Medium The installation image can be supplied to the target machine via a USB flash drive, an optical disc or a network with PXE. You can use "**Rufus**" to make a live environment into your removeable USB drive. I suggest you to use **[Ventoy](https://www.ventoy.net/en/index.html)** to create bootable USB drive. Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files. With ventoy, you don't need to format the disk over and over, you just need to copy the ISO/WIM/IMG/VHD(x)/EFI files to the USB drive and boot them directly. Then, enter the UEFI BIOS, **disable Secure Boot**, and then boot the installation medium. ## Connect to the Internet Ensure your network interface is listed and enabled ```bash= ip link ``` For ethernet, just plug in the cable. For Wi-Fi, authenticate to the wireless network using `iwctl` For USB tethering, connect your phone to computer via USB cable, and turn on USB tethering. ### iwctl The iwd package is pre-installed in the installation medium, feel free to use it. To get an interactive prompt, type the following command into your zsh shell. ```bash= iwctl ``` #### Connect to a network First, if you do not know your wireless device name, list all Wi-Fi devices: ``` [iwd]# device list ``` Then, to scan for networks: ``` [iwd]# station <device> scan ``` You can then list all available networks: ``` [iwd]# station <device> get-networks ``` Finally, to connect to a network: ``` [iwd]# station <device> connect <SSID> ``` To exit the interactive prompt, send EOF by pressing Ctrl+d or enter "exit". The connection may be verified with ping: ```bash= ping 8.8.8.8 ``` ## Update the System Clock Use `timedatectl` to ensure the system clock is accurate: ```bash= timedatectl set-ntp true ``` To check the service status, use: ```bash= timedatectl status ``` ## Partition the Disks (With Swap Space) **You can also create [swapfile](#Swapfile:-Another-Swap-Solution) shown below.** When recognized by the live system, disks are assigned to a block device such as /dev/sda, /dev/nvme0n1 or /dev/mmcblk0. To identify these devices, use lsblk or fdisk. ```bash= fdisk -l ``` Once you've checked the block device. Use `cfdisk` to modify partition table | Mount point | Partition | Partition type | Suggested size | | --------------------- | --------------------------- | --------------------- | ----------------------- | | /mnt/boot/efi | /dev/*efi_system_partition* | EFI system partition | At least 300MiB | | [SWAP] | /dev/*swap_partition* | Linux swap | More than 512 MiB | | /mnt | /dev/*root_partition* | Linux x86-64 root (/) | Remainder of the device | ## Format the partitions ```bash= mkfs.fat -F32 /dev/<efi_system_partition> mkswap /dev/<swap_partition> mkfs.ext4 /dev/<root_partition> ``` ## Mount the file systems Mount the root volume to /mnt. For example, if the root volume is /dev/root_partition: ```bash= mount /dev/root_partition /mnt ``` If you created a swap **volume**, enable it with swapon: ```bash= swapon /dev/swap_partition ``` ## Install essential packages ### (Optional) Parallel Downloading If you feel the download speed is too slow, you can modify `/etc/pacman.conf`, uncommand the following commands. Note that now you are *modifying the configuration in boot image*. This is just a **temporary modification**. ```bash= Color ParallelDownloads = 5 ``` ### Install Use the pacstrap script to install the base package, Linux kernel and firmware for common hardware: ```bash= pacstrap /mnt base base-devel linux linux-headers linux-firmware ``` and some important apps: ```bash= pacstrap /mnt vim git sudo grub efibootmgr os-prober networkmanager ntfs-3g ``` We recommand you to install the following tools. ```bash= pacstrap /mnt ncdu htop p7zip zip unzip bat wget go ntp python-pip zsh tig openssh net-tools tcpdump axel ``` ### Troubleshooting If pacstrap return like this > error: \<package\>: signature from "\<maintainer\>" is unknown trust This means your keyring on the ISO is obsolete, you need to upgrade your installation medium. Or you can run this command in arch live environment ```bash= pacman -Sy archlinux-keyring ``` Then you can install by pacstrap normally. <font color=#FF0000>The iwctl is pre-installed in installation medium, but not in the device, you can install it by pacstrap or by pacman -S after chroot to /mnt. Thus, you must install NetworkManager during installation step in installation medium</font> *pacman is the package manager of Arch Linux* ## Swapfile: Another Swap Solution You can use swapfile to create swap. In this case, you can easily configure the swap space at anytime. 1. `fallocate` directly manipulates the allocated disk space for the file. ```bash= fallocate -l 64G /mnt/swapfile ``` 2. Change mode to let swapfile can be only r/w by root. ```bash= chmod 600 /mnt/swapfile ``` 3. Make swap and turn on swap. ```bash= mkswap /mnt/swapfile swapon /mnt/swapfile ``` [Link](#Partition-the-Disks-(With-Swap-Space)): Back to Partition the Disks (With Swap Space) ## Mount EFI partition Mount the EFI partition to `/boot/efi` ```bash= mkdir -p /mnt/boot/efi mount /dev/<efi_system_partition> /mnt/boot/efi ``` ## Generate fstab Generate an fstab file (use -U or -L to define by UUID or labels, respectively): ```bash= genfstab -U /mnt >> /mnt/etc/fstab ``` Check the resulting `/mnt/etc/fstab` file, and edit it in case of errors. ## <font color=#FF0000>chroot</font> Change root into the new system: ```bash= arch-chroot /mnt ``` <font color=#FF0000>In chroot mode, systemctl can only enable or disable apps, it can't start or stop during chroot mode.</font> ## Time zone Set the time zone: ```bash= ln -sf /usr/share/zoneinfo/<Region/City> /etc/localtime ``` Let's say you are in Taiwan, enter the following command: ```bash= ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime ``` ## Time Adjustment If you're struggling with showing different times when **Windows and Linux dual booting**, you can adjust the Linux timezone RTC to local timezone, which is same as Windows does. Then, update your time from NTP server. ```bash= timedatectl set-local-rtc 1 --adjust-system-clock ntpdate -u 0.arch.pool.ntp.org ``` Run `hwclock` to generate ``/etc/adjtime`: ```bash= hwclock --systohc ``` This command assumes the hardware clock is set to **UTC**. See **System time#Time standard** for details. ## Localization Uncommit `en_US.UTF-8 UTF-8` and others language you need in `/etc/locale.gen`. Generate the locales by executing: ```bash= locale-gen ``` Create the locale.conf file, and set the LANG variable accordingly: ```bash= vim /etc/locale.conf LANG=en_US.UTF-8 ``` ## Network Configuration Create the hostname file: ```bash= vim /etc/hostname <myhostname> ``` Add matching entries to hosts: ```bash= vim /etc/hosts 127.0.0.1 localhost ::1 localhost 127.0.1.1 myhostname.localdomain myhostname ``` If the system has a permanent IP address, it should be used instead of 127.0.1.1. ## Initramfs Creating a new initramfs is usually not required, because mkinitcpio was run on installation of the kernel package with pacstrap. ```bash= mkinitcpio -P ``` ## Password for Root User Set the root password: ```bash= passwd ``` ## Add New User Add new user by the following command: ```bash= useradd <USERNAME> -G wheel # give this user sudo permission ``` Edit `visudo`, add/uncommend the following script: ```bash= visudo %wheel ALL=(ALL) ALL ``` Set password for the user ```bash= passwd <USERNAME> ``` **Make a directory for the user** ```bash= mkdir /home/<USERNAME> chown <USERNAME>:<USERNAME> /home/<USERNAME> -R ``` Add the user into group ```bash= usermod -a -G <GROUPNAME> <USERNAME> ``` ## Bootloader Choose and install a Linux-capable boot loader. If you have an Intel or AMD CPU, enable microcode updates in addition. **Depending on the processor, install the following package:** `amd-ucode` for AMD processors, `intel-ucode` for Intel processors. Here we demonstrate GRUB for you. ### <font color=#FF0000>Mount all the EFI volume</font> In our case, we split the disk into EFI, swap, and main file system. If you have another OS in your computer, just mount them into everywhere you wish. Let's say `/mnt/Ubuntu.EFI`, `/mnt/Windows` <font color=#FF0000>The EFI of Windows is located in `C:\Windows\Boot\EFI`.</font> ### os-prober To have `grub-mkconfig` search for other installed systems and automatically add them to the menu, install the `os-prober` package and mount the partitions from which the other systems boot. ### GRUB (GRand Unified Bootloader) GRUB (GRand Unified Bootloader) is a multi-boot loader. It is derived from PUPA which was a research project to develop the replacement of what is now known as GRUB Legacy. The latter had become too difficult to maintain and GRUB was rewritten from scratch with the aim to provide modularity and portability. Follow the below steps to install GRUB: 1. **Mount the EFI system partition** and in the remainder of this section, substitute *esp* with its mount point. 2. Choose a bootloader identifier, here named `GRUB`. A directory of that name will be created in *esp/EFI/* to store the EFI binary and this is the name that will appear in the UEFI boot menu to identify the GRUB boot entry. 3. Execute the following command to install the GRUB EFI application `grubx64.efi` to `esp/EFI/GRUB/` and install its modules to `/boot/grub/x86_64-efi/`. ```bash= grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB ``` In our case, type the following command: ```bash= grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Arch Linux GRUB" ``` After the above install completed the main GRUB directory is located at `/boot/grub/`. Note that `grub-install` also tries to **create an entry in the firmware boot manager**, named `ArchLinux` in the above example. ### GRUB Configuration On an installed system, GRUB loads the `/boot/grub/grub.cfg` configuration file each boot. Use the grub-mkconfig tool to generate `/boot/grub/grub.cfg`: ```bash= grub-mkconfig -o /boot/grub/grub.cfg ``` If you get the following output: `Warning: os-prober will not be executed to detect other bootable partitions` then edit `/etc/default/grub` and add/uncomment: ``` GRUB_DISABLE_OS_PROBER=false ``` Then re-run `grub-mkconfig` ```bash= os-prober grub-mkconfig -o /boot/grub/grub.cfg ``` ### grub-customizer If you have problem with the resolution of GRUB theme, you can install this GUI tool to help you changing the resolution with theme. ## Install KDE (Optional) You can configure [pacman.conf](#Modify-pacman.conf) first to accelerate download speed. I recommend KDE desktop environment because it has fewer bugs than gnome and easy to use. ```bash= pacman -S plasma kde-applications ``` Once installed, enable the Display Manager and Network Manager services: ```bash= systemctl enable sddm.service systemctl enable NetworkManager.service ``` *The Simple Desktop Display Manager (SDDM) is a display manager. It is the recommended display manager for the KDE Plasma and LXQt desktop environments.* <font color=#FF0000>You can't start or stop any apps in chroot mode.</font> ## Reboot your system Exit the chroot environment by typing `exit` or pressing `Ctrl+d`. Optionally manually unmount all the partitions with `umount -R /mnt`: this allows noticing any "busy" partitions, and finding the cause with fuser. Finally, restart the machine by typing `reboot`: any partitions still mounted will be automatically unmounted by systemd. Remember to remove the installation medium and then login into the new system with the root account. ## Start Display Manager After reboot, type the following command: ```bash= systemctl start sddm.service ``` If you want to access the network first, type `nmtui` to configure network access. Then you can use KDE. Enjoy to be an Archer :) # Let your Arch-Linux be better to use ## Install yay Yet Another Yogurt - An AUR Helper Written in Go ```bash= sudo pacman -S base-devel cd /opt sudo git clone https://aur.archlinux.org/yay.git sudo chown -R pablinux:users ./yay cd yay makepkg -si ``` ## Some Important Program We also recommand you to install the following program ```bash= sudo pacman -S audacity obs-studio discord ``` We also recommand you to install the following AUR program ```bash= yay -S google-chrome anydesk-bin visual-studio-code-bin typora spotify timeshift ``` If you are using ThinkPad X1 Carbon Gen 9, you have to install the following program to use audio card and fingerprint. ```bash= sudo pacamn -S sof-firmware fprintd ``` ## Install Google Chrome According to https://wiki.archlinux.org/title/chromium, we no longer edit `/usr/share/applications/google-chrome-stable.desktop`. Instead, we add `chrome-flags.conf` in the directory `~/.config/`. ```bash= ~/.config/chrome-flags.conf # This line will be ignored. --force-dark-mode --enable-features=WebUIDarkMode --password-store=basic ``` We pass `--password-store=basic` to Chrome to disable KDE wallet. ## Manual Page ```bash= sudo pacman -S man-db man-pages ``` ## Install ibus (Optional) ```bash= sudo pacman -S ibus ibus-chewing ``` Add the configuration into `/etc/environment` ``` GTK_IM_MODULE=ibus QT_IM_MODULE=ibus XMODIFIERS=@im=ibus ``` In ibus preference, select the chewing perference, disable 前方加詞, 單純注音模式, 後方選詞 Add the configuration into `$HOME/.xprofile` ``` export GTK_IM_MODULE=ibus export XMODIFIERS=@im=ibus export QT_IM_MODULE=ibus ibus-daemon -drx ``` ## Install fcitx5 (Optional) ```bash= sudo pacman -S fcitx5 fcitx5-im fcitx5-chewing fcitx5-mozc ``` The group `fcitx5-im` is very important. It contains - `fcitx5` - `fcitx5-configtool` - `fcitx5-gtk` - `fcitx5-qt` For example, you need `fcitx5-gtk` to use fcitx5 in Google Chrome. Add the configuration into `/etc/environment` ``` GTK_IM_MODULE=fcitx5 QT_IM_MODULE=fcitx5 XMODIFIERS=@im=fcitx5 ``` Add the configuration into `$HOME/.xprofile` ``` export GTK_IM_MODULE=fcitx5 export XMODIFIERS=@im=fcitx5 export QT_IM_MODULE=fcitx5 ``` If you notice that `shift` does not work properly, just press `ctrl+space`. XDD ## Fonts You may use Google Noto Fonts. ```bash= yay -S noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra noto-fonts-tc noto-fonts-sc ``` ## Locale Locales are used by `glibc` and other locale-aware programs or libraries for rendering text, correctly displaying regional monetary values, time and date formats, alphabetic idiosyncrasies, and other locale-specific standards. Reference: https://wiki.archlinux.org/title/locale ## Take too long time to shutdown If you have trouble for waiting long time to shutdown or reboot, modify `/etc/systemd/system.conf` and uncomment the following commands: ``` DefaultTimeoutStartSec=5s DefaultTimeoutStopSec=5s DefaultTimeoutAbortSec=5s ``` ## Modify pacman.conf Edit the file `/etc/pacman.conf`, uncommand the following commands. ```bash= Color ParallelDownloads = 5 ``` ## AUR Multi-Process Setting Edit the file ```bash= sudo vim /etc/makepkg.conf ``` Add/Uncomment the following command: ```bash= MAKEFLAGS="-j#" # is the number of your CPU threads ``` ## Arch Linux Pacman Mirror List https://archlinux.org/mirrorlist/all/ ## Nvidia Graphic Card Drivers Install the following drivers. ```bash= sudo pacman -S nvidia nvidia-utils nvidia-settings nvidia-lts ``` And then reboot your system. ## GreenWithEnvy installation on Arch Linux and derivatives Now for the case of those who are users of Arch Linux, Manjaro Linux, Antergos or any other distro based on Arch Linux. They will be able to install this tool in a simpler way. This is thanks to GreenWithEnvy it is added within the AUR repositories and all the dirty work of compilation will avoid it. They just need to have the AUR repository enabled on their system and have an AUR wizard installed. If you don't have one installed you can check the next post where we recommend one. To install TuxClocker on Arch Linux, We just have to open a terminal and in it we are going to type the following command: ```bash= yay -S gwe ``` To enable **overclocking** on the PowerMizer page in nvidia-settings, type the following command: ```bash= nvidia-xconfig --cool-bits=8 ``` More information: https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Overclocking_and_cooling ## Steam First, you need to enable multilib. To enable multilib repository, uncomment the [multilib] section in /etc/pacman.conf: ```bash= sudo vim /etc/pacman.conf [multilib] Include = /etc/pacman.d/mirrorlist ``` Then upgrade the system and install the desired multilib packages. ```bash= yay -Syu ``` The following requirements must be fulfilled in order to run Steam on Arch Linux: - Installed 32-bit version OpenGL graphics driver. - Generated [en_US.UTF-8](https://wiki.archlinux.org/title/Locale#Generating_locales) locale, preventing invalid pointer error. - The GUI heavily uses the Arial font. See [Microsoft fonts](https://wiki.archlinux.org/title/Microsoft_fonts). An alternative is to use [ttf-liberation](https://archlinux.org/packages/?name=ttf-liberation) or [fonts provided by Steam](https://wiki.archlinux.org/title/Steam/Troubleshooting#Text_is_corrupt_or_missing) instead. - Install [wqy-zenhei](https://archlinux.org/packages/?name=wqy-zenhei) to add support for Asian languages. - If using [systemd-networkd](https://wiki.archlinux.org/title/Systemd-networkd) for network management, install [lib32-systemd](https://archlinux.org/packages/?name=lib32-systemd) in order for Steam to be able to connect to its servers. ### Graphic driver installation The Linux kernel includes open-source video drivers and support for hardware accelerated framebuffers. However, userland support is required for OpenGL and 2D acceleration in X11. First, identify the graphics card (the *Subsystem* output shows the specific model): ``` $ lspci -v | grep -A1 -e VGA -e 3D ``` Then, install an appropriate driver. You can search the package database for a complete list of open-source video drivers: ``` $ pacman -Ss xf86-video ``` Xorg searches for installed drivers automatically: - If it cannot find the specific driver installed for the hardware (listed below), it first searches for *fbdev* ([xf86-video-fbdev](https://archlinux.org/packages/?name=xf86-video-fbdev)). - If that is not found, it searches for *vesa* ([xf86-video-vesa](https://archlinux.org/packages/?name=xf86-video-vesa)), the generic driver, which handles a large number of chipsets but does not include any 2D or 3D acceleration. - If *vesa* is not found, Xorg will fall back to [kernel mode setting](https://wiki.archlinux.org/title/Kernel_mode_setting), which includes GLAMOR acceleration (see [modesetting(4)](https://man.archlinux.org/man/modesetting.4)). In order for video acceleration to work, and often to expose all the modes that the GPU can set, a proper video driver is required: | Brand | Type | Driver | OpenGL | OpenGL ([multilib](https://wiki.archlinux.org/title/Multilib)) | Documentation | | :-----------: | :---------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | | **AMD / ATI** | Open source | [xf86-video-amdgpu](https://archlinux.org/packages/?name=xf86-video-amdgpu) | [mesa](https://archlinux.org/packages/?name=mesa) | [lib32-mesa](https://archlinux.org/packages/?name=lib32-mesa) | [AMDGPU](https://wiki.archlinux.org/title/AMDGPU) | | **AMD / ATI** | Open source | [xf86-video-ati](https://archlinux.org/packages/?name=xf86-video-ati) | [mesa](https://archlinux.org/packages/?name=mesa) | [lib32-mesa](https://archlinux.org/packages/?name=lib32-mesa) | [ATI](https://wiki.archlinux.org/title/ATI) | | **AMD / ATI** | Proprietary | [xf86-video-amdgpu](https://archlinux.org/packages/?name=xf86-video-amdgpu) | [amdgpu-pro-libgl](https://aur.archlinux.org/packages/amdgpu-pro-libgl/) (AUR) | [lib32-amdgpu-pro-libgl](https://aur.archlinux.org/packages/lib32-amdgpu-pro-libgl/) (AUR) | [AMDGPU PRO](https://wiki.archlinux.org/title/AMDGPU_PRO) | | **Intel** | Open source | [xf86-video-intel](https://archlinux.org/packages/?name=xf86-video-intel) | [mesa](https://archlinux.org/packages/?name=mesa) | [lib32-mesa](https://archlinux.org/packages/?name=lib32-mesa) | [Intel graphics](https://wiki.archlinux.org/title/Intel_graphics) | | **NVIDIA** | Open source | [xf86-video-nouveau](https://archlinux.org/packages/?name=xf86-video-nouveau) | [mesa](https://archlinux.org/packages/?name=mesa) | [lib32-mesa](https://archlinux.org/packages/?name=lib32-mesa) | [Nouveau](https://wiki.archlinux.org/title/Nouveau) | | **NVIDIA** | Proprietary | [nvidia](https://archlinux.org/packages/?name=nvidia) | [nvidia-utils](https://archlinux.org/packages/?name=nvidia-utils) | [lib32-nvidia-utils](https://archlinux.org/packages/?name=lib32-nvidia-utils) | [NVIDIA](https://wiki.archlinux.org/title/NVIDIA) | | **NVIDIA** | Proprietary | [nvidia-470xx-dkms](https://aur.archlinux.org/packages/nvidia-470xx-dkms/) (AUR) | [nvidia-470xx-utils](https://aur.archlinux.org/packages/nvidia-470xx-utils/) (AUR) | [lib32-nvidia-470xx-utils](https://aur.archlinux.org/packages/lib32-nvidia-470xx-utils/) (AUR) | [NVIDIA](https://wiki.archlinux.org/title/NVIDIA) | | **NVIDIA** | Proprietary | [nvidia-390xx](https://aur.archlinux.org/packages/nvidia-390xx/) (AUR) | [nvidia-390xx-utils](https://aur.archlinux.org/packages/nvidia-390xx-utils/) (AUR) | [lib32-nvidia-390xx-utils](https://aur.archlinux.org/packages/lib32-nvidia-390xx-utils/) (AUR) | [NVIDIA](https://wiki.archlinux.org/title/NVIDIA) | 1. For Intel graphics on 4th generation and above, see [Intel graphics#Installation](https://wiki.archlinux.org/title/Intel_graphics#Installation) for available drivers. 2. For NVIDIA Optimus enabled laptop which uses an integrated video card combined with a dedicated GPU, see [NVIDIA Optimus](https://wiki.archlinux.org/title/NVIDIA_Optimus). Other video drivers can be found in the [xorg-drivers](https://archlinux.org/groups/x86_64/xorg-drivers/) group. Xorg should run smoothly without closed source drivers, which are typically needed only for advanced features such as fast 3D-accelerated rendering for games. The exceptions to this rule are recent GPUs (especially NVIDIA GPUs) not supported by open source drivers. When you finish installing steam, goto Steam -> Settings -> Steam Play Enable Steam Play for all other titles and choose Proton Experimental. ## Openboard or Lorien ```bash= yay openboard ``` ## Bluetooth To enable bluetooth service, type the following command: ```bash= sudo pacman -S blueman bluez pulseaudio-bluetooth sudo systemctl enable --now bluetooth.service ``` ## Libreoffice ```bash= sudo pacman -S libcdr libreoffice-fresh ``` ## Flameshot (Screenshot application) ```bash= sudo pacman -S flameshot ``` Go to Setting -> 捷徑 -> Shortcuts, press Add Application, choose Flameshot. Set Take screenshot to your favorite shortcut. ## sddm configuration ### Theme Install the following app and font: ```bash= yay qt5-graphicaleffects ttf-roboto ``` Copy your theme into `/usr/share/sddm/themes/` Edit `/usr/lib/sddm/sddm.conf.d/default.conf` In `[Theme]`, Set `Current=<your theme name>` Save it and reboot your system. ### NumLock Edit `/usr/lib/sddm/sddm.conf.d/default.conf` In `[General]`, Set `Numlock=on` Save it and reboot your system. ## Wake On Lan You have to make the configuration of the network card to always enabled wake on lan after every reboot. ```bash= sudo vim /etc/systemd/system/wol.service ``` > [Unit] > Description=Configure Wake On LAN > After=multi-user.target > > [Service] > Type=oneshot > ExecStart=/usr/bin/ethtool -s \<INTERFACE\> wol g > ExecStartPre=/bin/sleep 1 > Restart=on-failure > RestartSec=1s > > [Install] > WantedBy=multi-user.target You can find the \<INTERFACE\> by `ip a` Then type the following command: ```bash= sudo systemctl daemon-reload sudo systemctl enable --now wol.service ``` If you have any problem, type ```bash= systemctl status wol.service ``` If there are multiple devices need to setup, try this: https://stackoverflow.com/questions/48195340/systemd-with-multiple-execstart You can check if the magic package is delivered properly to the target machine by typing the following command: ```bash= tcpdump -i <INTERFACE> '(udp and port 9) or (udp and port 7)' -vv -X ``` ## Hibernate to swap partition In order to use hibernation, you need to create a swap partition or file. You will need to point the kernel to your swap using the `resume=` **kernel parameter**, which is configured via the **boot loader**. You will also need to configure the initramfs. This tells the kernel to attempt resuming from the specified swap in early userspace. These three steps are described in detail below. Edit `/etc/default/grub` ```bash= GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=<The UUID of the swap partition>" ``` You can find the UUID by `blkid` ```bash= blkid | grep /dev/*efi_system_partition* ``` Then reconfig grub. ```bash= grub-mkconfig -o /boot/grub/grub.cfg ``` Edit `/etc/mkinitcpio.conf`, add **resume** into HOOKS. Whether by label or by UUID, the swap partition is referred to with a udev device node, so the **resume hook must go after the udev hook**. ```bash= HOOKS=(base udev autodetect keyboard modconf block filesystems resume fsck) ``` Regenerate the initramfs for these changes to take effect. ```bash= mkinitcpio -P ``` ## Hibernate to swapfile Using a swap file requires also setting the `resume=UUID=swap_device_uuid` and additionally a `resume_offset=swap_file_offset` kernel parameters. See the kernel documentation. `swap_device` is the volume where the swap file resides and it follows the same format as for the root parameter. You can find the UUID of swapfile by ```bash= findmnt -no UUID -T /swapfile ``` On file systems other than Btrfs, the value of `swap_file_offset` can be obtained by running ```bash= filefrag -v /swapfile ``` The output is in a table format and the required value is in the first row of the physical_offset column. ``` Filesystem type is: ef53 File size of /swapfile is 163208757248 (39845888 blocks of 4096 bytes) ext: logical_offset: physical_offset: length: expected: flags: 0: 0.. 0: 92270592.. 92270592: 1: 1: 1.. 4095: 92270593.. 92274687: 4095: unwritten 2: 4096.. 28671: 92241920.. 92266495: 24576: 92274688: unwritten 3: 28672.. 38911: 20011008.. 20021247: 10240: 92266496: unwritten 4: 38912.. 71679: 19791872.. 19824639: 32768: 20021248: unwritten ...... 829: 39667712..39845887: 174620672.. 174798847: 178176: 174618656: last,unwritten,eof /swapfile: 829 extents found ``` In the example the value of `swap_file_offset` is the first 92270592 with the two periods and the kernel parameter would be `resume_offset=92270592`. Finally, **regenerate grub configure and mkinitcpio** as shown above. ## PATH If you want to append your path globally, you can add your path to `/etc/profile` ```bash= append_path '/usr/local/cuda/bin' ``` Type `source /etc/profile` to reload it. ## Timeshift If your timeshift cannot backup your system automatically, type the following command: ```bash= systemctl enable --now cronie ``` ## Laptop Power Saver: TLP https://wiki.archlinux.org/title/TLP ## Bugs of KDE Compositor If you have trouble of screenshot or OBS failure, try setting "Never" to "Keep window thumbnails" And then type the following command: ```bash= kwin_x11 --replace & disown && exit ``` Or you can just turn it off. ## Bugs of KDE icon cache https://forum.manjaro.org/t/blank-icons-in-app-menu/37652/2 If you get blank icon or the icon is broken of the pinned apps in the system tray, you can type the following command: ```bash= rm -f ~/.cache/*.kcache` ``` This will force Plasma to rebuild its icon caches. ## Reload KDE Menu ```bash= kbuildsycoca5 ``` ## Pipewire https://wiki.archlinux.org/title/PipeWire ### Installation Install the `pipewire` package from the official repositories. There is also `lib32-pipewire` for multilib support. Pipewire uses systemd/User for management of the server and automatic socket activation. Optionally, install `pipewire-docs` to review the documentation. #### GUI Helvum — GTK-based patchbay for PipeWire, inspired by the JACK tool catia. Does not save wire sets. https://gitlab.freedesktop.org/pipewire/helvum ### Usage for PulseAudio clients Install `pipewire-pulse`. It will replace `pulseaudio` and `pulseaudio-bluetooth`. Reboot, re-login or start the `pipewire-pulse.service` user unit to see the effect. Normally, no further action is needed, as the user service `pipewire-pulse.socket` should be enabled automatically by the package. To check if the replacement is working, run the following command and see the output: ```bash= pactl info ``` ``` ... Server Name: PulseAudio (on PipeWire 0.3.32) ... ``` ### Audio post-processing \- EasyEffects EasyEffects (former PulseEffects) is a GTK utility which provides a large array of audio effects and filters to individual application output streams and microphone input streams. Notable effects include an input/output equalizer, output loudness equalization and bass enhancement, input de-esser and noise reduction plug-in. See the GitHub page for a full list of effects. In order to use EasyEffects, install `easyeffects`. See Community Presets for a collection of preset configurations. See AutoEq for collection of AI generated EQ presets for headphones. Finally, install `lsp-plugins`, `calf`. ## TexLive Type the following command: ```bash= sudo pacman -S texlive texlive-lang ``` ## Temporarily Reboot to Windows [Ref: StackExchange](https://unix.stackexchange.com/questions/43196/how-can-i-tell-grub-i-want-to-reboot-into-windows-before-i-reboot/112284#112284) Edit your rc file, e.g. `.bashrc` or `.zshrc`. Add the following function into it. ```bash= # Reboot directly to Windows # Inspired by http://askubuntu.com/questions/18170/how-to-reboot-into-windows-from-ubuntu reboot_to_windows () { windows_title=$(sudo grep -i windows /boot/grub/grub.cfg | cut -d "'" -f 2) sudo grub-reboot "$windows_title" && sudo reboot } alias reboot-to-windows='reboot_to_windows' ``` After that, reload your run script. ```bash= exec zsh ``` Similarly, you can reboot to Ubuntu or Arch Linux directly. ```bash= reboot_to_ubuntu () { ubuntu_title=$(sudo grep -i "Ubuntu 22.04" /boot/grub/grub.cfg | grep -v "Advanced options" | cut -d "'" -f 2) sudo grub-reboot "$ubuntu_title" && sudo reboot } alias reboot-to-ubuntu="reboot_to_ubuntu" ``` ```bash= reboot_to_arch () { arch_title=$(sudo grep -i "Arch Linux " /boot/grub/grub.cfg | grep -v "Advanced options" | grep "rolling" | cut -d "'" -f 2) sudo grub-reboot "$arch_title" && sudo reboot } alias reboot-to-arch="reboot_to_arch" ``` After that, reload your run script. ```bash= exec zsh ```