Skip to content

Instantly share code, notes, and snippets.

@GryzleeVEVO
Last active May 31, 2025 20:35
Show Gist options
  • Save GryzleeVEVO/570af659b7bfa6c30703672705a92ab4 to your computer and use it in GitHub Desktop.
Save GryzleeVEVO/570af659b7bfa6c30703672705a92ab4 to your computer and use it in GitHub Desktop.
Arch Linux tips and tricks

Arch Linux post install tips and tricks

This is a bit of a publicly shared mental note for some things I do (or I should do) anytime I reinstall Arch, although many of this thing are not distro-specific.

/etc shenanigans

Disable PC speaker

The Arch installer used to greet you with the Mario coin sound when booting the installer. It was loud as hell. Nowadays it doesn't. But it sure does beep like there's an air raid siren going off.

Just add this file lifted from the Arch Wiki (of course I stole from there, most of this Gist will be rehashed Arch Wiki posts that will probably be outdated by the end of the month), in /etc/modprobe/nobeep.conf:

# https://wiki.archlinux.org/title/PC_speaker#Globally
# Blacklists the PC speaker module

blacklist pcspkr
blacklist snd_pcsp

Tweak your makepkg

Plop this file in /etc/makepkg.cond.d/00-makepkg.conf, which does the following things:

  1. Disable debug packages. We don't need them.
  2. Disable checks. Yeah, you should probably run the test suite after compiling the package but it takes a looooooong time too often.
  3. Run make with a thread count equal to half your cores (plus SMT).
  4. Don't compress packages. No point in compressing.
# https://wiki.archlinux.org/title/makepkg
# Custom configuration for makepkg (ABS package building)

# Do not add *-debug packages
OPTIONS=(!debug)

# Skip checks (can take too long)
BUILDENV=(!check)

# Make using half the available threads
MAKEFLAGS="--jobs=$(($(nproc) / 2))"

# Don't compress packages
PKGEXT='.pkg.tar'

Disable HSP/HPF

This is the "hands-free" mode for Bluetooth devices. It sucks. Don't use it. However, there's a drawback: the mic (which probably also sucks) will stop working.

This is for Wireplumber, although there is a similar config file for Pulseaudio. Add the following in /etc/wireplumber/wireplumber.conf.d/10-disable-hsp-hpf:

# https://wiki.archlinux.org/title/bluetooth_headset#Disable_PipeWire_HSP/HFP_profile
# Disable HSP/HFP (hands-free mode) profiles and automatic switching of
# profiles, since they have lower quality audio. Only caveat: it disables the
# headset microphone.

wireplumber.settings = {
  bluetooth.autoswitch-to-headset-profile = false
}

monitor.bluez.properties = {
  bluez5.roles = [ a2dp_sink a2dp_source ]
}

Pack your Pacman

Add this to /etc/pacman.conf:

...
# Misc options
# Colours are fun
Color
# Hammer the repo servers
ParallelDownloads = 150
# Not as dull as the default
ILoveCandy
...

# Don't forget to uncomment and enable multilib
[multilib]
Include = /etc/pacman.d/mirrorlist

You should probably install yay while you're at it.

sudo pacman -Syu base-devel
cd /tmp
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si

NVIDIA sucks

Mandatory fuck NVIDIA. But I bought a laptop with an Nvidia GPU (even worse: an Optimus laptop...), so I have to deal with it.

Also, anything both Xorg and Wayland is a roll of the dice. I've had some success with i3+envycontrol until it broke. Plasma 6 seems to hold up for now, I just want to be able to use external monitors (i need the dGPU for that).

Install the drivers the proper way.

I have a 3060 Mobile, so I'm going to write this steps assuming that this is the case.

  1. Install the nvidia-open driver, unless you need the DKMS driver, the 100% propietary nvidia ones, or you have an antediluvian card (a.k.a. anything from 5 years ago lol, where maybe using nouveau is your best bet).
  2. Install the lib32-nvidia-utils for 32 bit support. Especially important for games.
  3. You'll probably want to make sure nouveau is uninstalled or blacklisted. nvidia-utils should blacklist it for you, but if not, you can make sure by creating /etc/modprobe.d/nouveau_blacklist.conf:
blacklist nouveau
  1. While you're at it, enable early driver loading. Add this to the MODULES section (I'm assuming that mkinitcpio is used, otherwise refer to your initramfs generator). This step is mandatory for Wayland support:
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
  1. Regenerate with sudo mkinitcpio -P (this will make new initramfs's with your current presets).

Add VA-API support

Some apps like firefox use VA-API for video hardware acceleration. Nvidia does not have an implementation for that.

Install libva-nvidia-driver, which is a translation layer that uses NVDEC for decoding VA-API calls. It does not encode.

sudo pacman -Syu libva-nvidia-driver

However, Firefox only picks the first GPU on the list, so can't use it on an Optimus setuo.

AMD also kinda sucks (but for different reasons)

Luckily, installing the AMD drivers is much simpler.

Install the drivers the proper way

You'll want to install the following packages:

  • mesa, for OpenGL support.
  • lib32-mesa for 32 bit support, if you plan to game on it.
  • vulkan-radeon, for Vulkan support (avoid amdvlk, it is unmaintained and doesn't work for older cards).
  • lib32-vulkan-radeon, ditto.
  • No need to install xf86-video-amdgpu. The modesetting driver should work fine.

As with the Nvidia driver, we can enable early KMS start . Add this to the MODULES section:

MODULES=(amdgpu)

And regenerate the initramfs with sudo mkinitcpio -P.

Optimus PRIME (pun intended)

Setting up MUXed GPUs is still a bit of a nightmare on Linux (certainly Nvidia is not making the situation better).

If using Xorg, check out envycontrol, which sets up the required config for you. although I used to run an i3wm setup and that eventually broke.

In Wayland, at least on Plasma, it has worked sort of automagically, with some caveats:

  • After waking up, the dGPU is not put back to sleep (D3 state).
  • Some apps won't select the right GPU regardless.
  • The list will be updated when I start encountering real problems.

OpenGL

OpenGL by default uses the iGPU, but by using prime-run from the nvidia-prime package (which just sets some envvars), you can force it to use the dGPU.

You can check if the right GPU is used by running the following:

prime-run glxgears

And using something like nvtop to check which device is being used.

Vulkan

With Vulkan, it works the other way around: it uses the dGPU by default, unless the iGPU's ICD file is selected:

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json vkcube

Yay videogames!

  1. Make sure you have the 32 bit versions of your drivers. This would have saved me a lot of troubleshooting.
  2. Install gamemode, which should add some optimizations to any game:
sudo pacman -Syu gamemode lib32-gamemode
sudo usermod -aG gamemode <user>
  1. install mangohud the proper way: by installing the 32 bit libs too:
sudo pacman -Syu mangohub lib32-mangohub

For Steam games:

  • Use prime-run %command% for any game using OpenGL even if using Proton.
  • Append gamemoderun and mangohud if going to use any of them.
  • Refer to ProtonDB for any specific tweaks.

Sleep deep and hibernate

Preparing for hibernation

Hibernation is not enabled by default. Check out the Arch Wiki article before, in case you have to do some additional setup.

  1. First, make sure you have a sufficiently large swap space for your system to dump the memory on disk (no, zram does not count).
  2. Next, add the resume hook to your /etc/mkinitcpio.conf after the udev hook. This will allow your system to grab the swap space (or spaces) and tell the bootloader to look for it after waking up.
HOOKS=(... udev resume ...)
  1. Regenerate your initramfs, sudo mkinitcpio -P

Services you should probably enable

Reflector

reflector has a systemd timer which checks the Arch Linux repositories and returns the fastest ones on a weelky basis.

sudo pacman -Syu reflector
sudo systemctl enable --now reflector.timer

TRIM

TRIM is a technology that allows to re-shuffle data in SSDs in order to make sure the flash cells are worn out at the same rate and accesses are uniform.

sudo systemctl enable --now fstrim.timer

Check if your file system allows for TRIMming first

TLP

TLP is an utility for optimizing power usage. The defaults should be enough, but if you want to tweak it some more or fix issues you should refer to [the manual(https://linrunner.de/tlp/installation/arch.html) or the wiki page.

sudo pacman -Syu tlp
sudo systemctl enable --now tlp.service
# Recommended, TLP will handle switching Wi-Fi and Bluetooth on and off anyways
sudo systemctl mask systemd-rfkill.service systemd-rfkill.socket

UFW

UFW is a firewall that is relatively simple to set up and use, it even has integration with Plasma. Pretty important since you don't want anybody starting a remote connection without explicitly allowing it. It shouldn't affect outbound traffic and inbound responses.

sudo pacman -Syu ufw
sudo systemctl enable --now ufw.service
sudo ufw enable

# Deny everything by default
sudo ufw default deny

# Whitelist your local network
sudo ufw allow from 192.168.0.0/24

# Open the SSH port while rate-limiting it (6 or more attempts within 30 seconds)
sudo ufw limit ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment