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.
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
Plop this file in /etc/makepkg.cond.d/00-makepkg.conf
, which does the following things:
- Disable debug packages. We don't need them.
- Disable checks. Yeah, you should probably run the test suite after compiling the package but it takes a looooooong time too often.
- Run
make
with a thread count equal to half your cores (plus SMT). - 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'
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 ]
}
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
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).
I have a 3060 Mobile, so I'm going to write this steps assuming that this is the case.
- Install the
nvidia-open
driver, unless you need the DKMS driver, the 100% propietarynvidia
ones, or you have an antediluvian card (a.k.a. anything from 5 years ago lol, where maybe usingnouveau
is your best bet). - Install the
lib32-nvidia-utils
for 32 bit support. Especially important for games. - 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
- 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)
- Regenerate with
sudo mkinitcpio -P
(this will make new initramfs's with your current presets).
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.
Luckily, installing the AMD drivers is much simpler.
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 (avoidamdvlk
, 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
.
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 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.
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
- Make sure you have the 32 bit versions of your drivers. This would have saved me a lot of troubleshooting.
- Install gamemode, which should add some optimizations to any game:
sudo pacman -Syu gamemode lib32-gamemode
sudo usermod -aG gamemode <user>
- 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
andmangohud
if going to use any of them. - Refer to ProtonDB for any specific tweaks.
Hibernation is not enabled by default. Check out the Arch Wiki article before, in case you have to do some additional setup.
- First, make sure you have a sufficiently large swap space for your system to dump the memory on disk (no, zram does not count).
- Next, add the
resume
hook to your/etc/mkinitcpio.conf
after theudev
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 ...)
- Regenerate your initramfs,
sudo mkinitcpio -P
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 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 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 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