--- creation date: 2022-01-08 tags: [note,archlinux] --- # Tweaks **TAKEN FROM:** https://gist.github.com/lbrame/1678c00213c2bd069c0a59f8733e0ee6 This is a collection of the tweaks and modification I've made to my Arch Linux installation over the months. These may be applicable to other distros, but please check first before doing anything. I also included Arch Wiki references for all the procedures I mentioned. My recommendation is not to blindly follow this gist but to always check with the Arch Linux wiki first. Things move fast and by the time you're reading this my gist may be out of date. Lastly, the golden rule: never execute a command you don't understand. ## Yay! I use `yay` as my AUR helper. You can install it from the AUR: ```shell git clone https://aur.archlinux.org/yay.git cd yay makepkg -csi ``` ## Fonts! ### Installing missing fonts DEs often don't include common fonts that some programs require. See [[KB/Linux/Desktop/Fonts]]. ### Enabling ClearType rendering Microsoft no longer holds their patents on the ClearType font rendering and it has been merged to upstream `freetype2`. Create the file `~/.config/fontconfig/conf.d/20-no-embedded.conf` and make it look like the following: ```xml false ``` Finally, log in again. This is an user setting and it will be reverted if you ever delete this file and it won't work on other users. ### Installing Windows fonts I finally added Microsoft fonts as they're handy to keep around and tend to be necessary to display web pages and Office documents correctly. To install them system wide, copy the `C:\Windows\Fonts` folder from a Windows installation to `/usr/share/fonts`: ```shell mkdir /usr/share/fonts/WindowsFonts cp /windows/Windows/Fonts/* /usr/share/fonts/WindowsFonts/ chmod 644 /usr/share/fonts/WindowsFonts/* ``` These commands assume your Windows partition is mounted at /windows as they've been copied verbatim from the Arch Wiki. If you don't dual boot or don't mount your Windows partition to /windows, just replace `/windows/Windows/Fonts/*` with wherever location you copied that folder to. ## Improving I/O performance ### Using the BFQ scheduler Arch Wiki reference: https://wiki.archlinux.org/index.php/Improving_performance#Changing_I/O_scheduler Linux notoriously gets very slow with I/O intensive operations such as moving a lot of files at once and swapping. **If** you have a **spinning hard drive or a not-so-fast SSD**, the BFQ scheduler can help improve system responsiveness during I/O intensive operations. I still use a SATA SSD for lack of a faster connector on my laptop and I have perceived significantly better overall performance by using the BFQ I/O scheduler. If your boot disk is a fast NVme SSD it's generally not the best idea to use the `bfq` scheduler for it, but since the I/O scheduler is set per-disk, it might be a good idea to use it for any spinning hard disk permanently connected to the computer (e.g. a secondary disk to store games and movies). To set the BFQ scheduler, you need to specify some `udev` rules to tell Linux what scheduler to use on what kind of disks. For example, you could use the `mq-deadline` scheduler on your NVme drives and the `bfq` scheduler on your SSDs. I decided to set my rules in such a way that no scheduler is used for NVme SSDs, but `bfq` is used for everything else. To do this, create the file `/etc/udev/rules.d/60-ioschedulers.rules` and fill it in as below: ```shell # set scheduler for NVMe ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="none" # set scheduler for SSD and eMMC ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq" # set scheduler for rotating disks ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq" ``` Reboot and you're done. ### Setting ext4 commit frequency to 60 Please see [[KB/Linux/Disk Speed]]. Arch Wiki reference: https://wiki.archlinux.org/index.php/Ext4#Improving_performance ### Improving laptop battery life with TLP and powertop Arch Wiki reference: https://wiki.archlinux.org/index.php/TLP https://wiki.archlinux.org/index.php/Powertop Linux distros tend to deplete laptops' batteries quite quickly, which can be detrimental to some. `tlp` is a set-and-forget, auto-tuning option for laptops that I have found to work very well (albeit it comes with drawbacks, such as a perceived decrease in performance). Setting it up on Arch Linux is pretty straightforward: ```shell pacman -S tlp systemctl enable tlp.service --now ``` `powertop` is a powerful commandline program to keep track of battery consumption. It also allows the user to quickly alter some system settings that have an impact on battery life. You can use it to make a quick tuning: ``` # powertop --auto-tune ``` However, don't enable `powertop`'s service if you already use TLP. ## Systemd configuration Also see [[KB/Linux/Desktop/systemd]]. Arch Wiki reference: https://wiki.archlinux.org/index.php/Systemd/ ### Taming the journal's size Systemd's system journal's size can go out of control. There are some things you can do to keep it in control: ``` # journalctl --vacuum-size=100M # journalctl --vacuum-time=2weeks ``` ### Forwarding the journal to /dev/tty12 This is very simple. Just create the file `/etc/systemd/journald.conf.d/fw-tty12.conf` and fill it like this: ``` [Journal] ForwardToConsole=yes TTYPath=/dev/tty12 MaxLevelConsole=info ``` Then, restart the service: ``` # systemctl restart systemd-journald.service ``` ## Microcode Arch Wiki reference: https://wiki.archlinux.org/index.php/Microcode https://en.wikipedia.org/wiki/Intel_Microcode ## Using the modesetting driver Arch Wiki reference: https://wiki.archlinux.org/index.php/Kernel_mode_setting#Early_KMS_start ## Enabling Early KMS Arch Wiki reference: https://wiki.archlinux.org/index.php/Kernel_mode_setting#Early_KMS_start https://wiki.archlinux.org/index.php/Mkinitcpio#Image_creation_and_activation I decided to start kernel modesetting during the initramfs stage. To do this, you can just add the `i915` or `amdgpu` module to `/etc/mkinitcpio.conf` like this: ```shell MODULES=(i915) # or MODULES=(amdgpu) ``` And then ```shell mkinitcpio -p linux ``` Finally, reboot. ### Setting up VA-API Arch Wiki reference: https://wiki.archlinux.org/index.php/Hardware_video_acceleration https://wiki.archlinux.org/index.php/Chromium#Hardware_video_acceleration ## Setting up touchpad gestures Arch Wiki reference: https://wiki.archlinux.org/index.php/Libinput