System Configuration

Quick Reference

# Essential configuration files
/etc/hostname           # System hostname
/etc/hosts              # Host name resolution
/etc/locale.conf        # System locale
/etc/locale.gen         # Available locales
/etc/vconsole.conf      # Console font and keymap
/etc/fstab              # Filesystem mount table
/etc/sudoers            # Sudo configuration
/etc/pacman.conf        # Package manager config

Hostname

Set Hostname

# Using hostnamectl (recommended)
sudo hostnamectl set-hostname archbox

# Or directly edit file
echo "archbox" | sudo tee /etc/hostname

# Verify
hostnamectl
hostname

Configure /etc/hosts

# /etc/hosts
cat > /etc/hosts << 'EOF'
127.0.0.1   localhost
::1         localhost
127.0.1.1   archbox.localdomain archbox
EOF

Hostname Types

# Static hostname (stored in /etc/hostname)
hostnamectl set-hostname archbox

# Pretty hostname (human-readable)
hostnamectl set-hostname "Evan's Arch Workstation" --pretty

# Transient hostname (temporary, lost on reboot)
hostnamectl set-hostname tempname --transient

# View all
hostnamectl

Locale Configuration

Enable Locales

# Edit /etc/locale.gen
sudo vim /etc/locale.gen

# Uncomment needed locales
en_US.UTF-8 UTF-8
en_GB.UTF-8 UTF-8

# Generate locales
sudo locale-gen

Set System Locale

# Set default locale
sudo localectl set-locale LANG=en_US.UTF-8

# Or edit directly
echo "LANG=en_US.UTF-8" | sudo tee /etc/locale.conf

# Additional locale variables
cat > /etc/locale.conf << 'EOF'
LANG=en_US.UTF-8
LC_COLLATE=C
LC_TIME=en_GB.UTF-8
EOF

Locale Variables

Variable Description

LANG

Default for all LC_* not explicitly set

LC_COLLATE

String sorting order

LC_CTYPE

Character classification

LC_MESSAGES

System messages

LC_MONETARY

Currency format

LC_NUMERIC

Numeric format

LC_TIME

Date/time format

LC_ALL

Overrides all (avoid using)

Check Current Locale

# View all locale settings
locale

# View available locales
locale -a

# Using localectl
localectl status

Console Configuration

Keyboard Layout

# Set console keymap
echo "KEYMAP=us" | sudo tee /etc/vconsole.conf

# Common keymaps
us          # US English
uk          # UK English
de-latin1   # German
fr          # French
es          # Spanish

# List available keymaps
localectl list-keymaps | grep us

Console Font

# Set larger font (for HiDPI)
cat > /etc/vconsole.conf << 'EOF'
KEYMAP=us
FONT=ter-132b
EOF

# Available fonts
ls /usr/share/kbd/consolefonts/

# Install terminus font
sudo pacman -S terminus-font

Apply Changes

# Reload vconsole configuration
sudo systemctl restart systemd-vconsole-setup

# Or set temporarily
setfont ter-132b
loadkeys us

Time and Date

Set Timezone

# Using timedatectl (recommended)
sudo timedatectl set-timezone America/New_York

# Or symlink manually
sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

# List timezones
timedatectl list-timezones
timedatectl list-timezones | grep America

Hardware Clock

# Sync hardware clock to system time
sudo hwclock --systohc

# Check hardware clock
sudo hwclock --show

# Use UTC (recommended for Linux-only)
sudo timedatectl set-local-rtc 0

# Use local time (for Windows dual boot)
sudo timedatectl set-local-rtc 1

NTP Synchronization

# Enable NTP
sudo timedatectl set-ntp true

# Check status
timedatectl status

# Using systemd-timesyncd
systemctl status systemd-timesyncd
cat /etc/systemd/timesyncd.conf

Custom NTP Servers

# Edit /etc/systemd/timesyncd.conf
[Time]
NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org

# Restart service
sudo systemctl restart systemd-timesyncd

View Time Status

timedatectl
#                Local time: Fri 2025-01-15 10:30:00 EST
#            Universal time: Fri 2025-01-15 15:30:00 UTC
#                  RTC time: Fri 2025-01-15 15:30:00
#                 Time zone: America/New_York (EST, -0500)
# System clock synchronized: yes
#               NTP service: active
#           RTC in local TZ: no

User Management

Create User

# Create user with home directory
sudo useradd -m -G wheel -s /bin/bash username

# Set password
sudo passwd username

# Create with specific UID
sudo useradd -m -u 1001 -G wheel username

# Create system user (no login)
sudo useradd -r -s /usr/bin/nologin serviceuser

User Options

Option Description

-m

Create home directory

-G

Add to supplementary groups

-s

Set login shell

-u

Specify UID

-c

Comment/full name

-d

Home directory path

-r

System account

-e

Account expiry date

Modify User

# Change shell
sudo usermod -s /bin/zsh username

# Add to group
sudo usermod -aG docker username

# Change home directory
sudo usermod -d /home/newdir -m username

# Lock account
sudo usermod -L username

# Unlock account
sudo usermod -U username

# Set expiry
sudo usermod -e 2025-12-31 username

Delete User

# Delete user (keep home)
sudo userdel username

# Delete user and home directory
sudo userdel -r username

Group Management

# Create group
sudo groupadd developers

# Delete group
sudo groupdel developers

# Add user to group
sudo gpasswd -a username developers

# Remove user from group
sudo gpasswd -d username developers

# List user's groups
groups username
id username

Common Groups

Group Purpose

wheel

Sudo access

audio

Sound device access

video

Video device access

optical

CD/DVD access

storage

Removable storage access

network

NetworkManager control

docker

Docker daemon access

libvirt

Libvirt/QEMU access

Sudo Configuration

Enable Sudo for wheel

# Use visudo (validates syntax)
EDITOR=nvim sudo visudo

# Uncomment this line:
%wheel ALL=(ALL:ALL) ALL

# For passwordless sudo (less secure)
%wheel ALL=(ALL:ALL) NOPASSWD: ALL

User-Specific Sudo Rules

# Add custom rules in /etc/sudoers.d/
echo "username ALL=(ALL) NOPASSWD: /usr/bin/pacman" | sudo tee /etc/sudoers.d/username
sudo chmod 440 /etc/sudoers.d/username

Sudo Timeout

# In visudo, add defaults
Defaults timestamp_timeout=30    # Minutes
Defaults passwd_timeout=5        # Password prompt timeout
Defaults insults                 # Fun error messages

fstab Configuration

Understand fstab

# /etc/fstab format
# <device>  <mount point>  <type>  <options>  <dump>  <pass>

Common Entries

# Root partition (ext4)
UUID=abc123... /      ext4  rw,relatime                      0 1

# Boot partition (EFI)
UUID=def456... /boot  vfat  rw,relatime,fmask=0022,dmask=0022 0 2

# Home partition
UUID=ghi789... /home  ext4  rw,relatime                      0 2

# Swap partition
UUID=jkl012... none   swap  defaults                         0 0

# Swap file
/swapfile      none   swap  defaults                         0 0

Btrfs fstab

# Root subvolume
UUID=abc123... /           btrfs rw,noatime,compress=zstd,subvol=@           0 0

# Home subvolume
UUID=abc123... /home       btrfs rw,noatime,compress=zstd,subvol=@home       0 0

# Var subvolume
UUID=abc123... /var        btrfs rw,noatime,compress=zstd,subvol=@var        0 0

# Snapshots
UUID=abc123... /.snapshots btrfs rw,noatime,compress=zstd,subvol=@snapshots  0 0

Common Mount Options

Option Description

defaults

rw, suid, dev, exec, auto, nouser, async

noatime

Don’t update access time (performance)

relatime

Update atime only if older than mtime

compress=zstd

Btrfs compression

discard

TRIM for SSDs (or use fstrim.timer)

nofail

Don’t fail boot if mount fails

x-systemd.automount

Mount on first access

uid=1000,gid=1000

Ownership for non-Linux filesystems

tmpfs Entries

# RAM-based temporary filesystem
tmpfs /tmp     tmpfs defaults,noatime,mode=1777           0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777           0 0

# For build systems (increase size)
tmpfs /tmp     tmpfs defaults,noatime,mode=1777,size=8G   0 0

Reload fstab

# Remount all
sudo mount -a

# Check for errors
sudo findmnt --verify

# View current mounts
findmnt

pacman.conf

Key Settings

# /etc/pacman.conf

[options]
# Misc options
Color
VerbosePkgLists
ParallelDownloads = 5
ILoveCandy

# Security
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional

# Ignore packages from upgrades
IgnorePkg = linux linux-headers
IgnoreGroup = gnome

[core]
Include = /etc/pacman.d/mirrorlist

[extra]
Include = /etc/pacman.d/mirrorlist

# Enable 32-bit packages
[multilib]
Include = /etc/pacman.d/mirrorlist

Enable Multilib

# Uncomment multilib section in /etc/pacman.conf
[multilib]
Include = /etc/pacman.d/mirrorlist

# Sync databases
sudo pacman -Syu

Custom Repository

# Add custom repo
[myrepo]
SigLevel = Optional TrustAll
Server = file:///home/user/myrepo
Server = https://myserver.com/repo/$arch

Environment Variables

System-Wide

# /etc/environment (simple KEY=value)
EDITOR=nvim
VISUAL=nvim

# /etc/profile.d/custom.sh (shell scripts)
export EDITOR=nvim
export PATH="$PATH:/opt/custom/bin"

User-Specific

# ~/.bash_profile or ~/.zshenv
export EDITOR=nvim
export VISUAL=nvim
export BROWSER=firefox
export TERMINAL=kitty

# XDG directories
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_STATE_HOME="$HOME/.local/state"

Session Variables

# Wayland-specific (in shell profile or compositor config)
export MOZ_ENABLE_WAYLAND=1
export QT_QPA_PLATFORM=wayland
export GDK_BACKEND=wayland
export XDG_SESSION_TYPE=wayland

Default Applications

Using xdg-mime

# Query default application
xdg-mime query default text/html
xdg-mime query default application/pdf

# Set default application
xdg-mime default firefox.desktop text/html
xdg-mime default org.pwmt.zathura.desktop application/pdf

# Query file type
xdg-mime query filetype file.pdf

mimeapps.list

# ~/.config/mimeapps.list
[Default Applications]
text/html=firefox.desktop
text/plain=nvim.desktop
application/pdf=org.pwmt.zathura.desktop
image/png=imv.desktop
image/jpeg=imv.desktop
video/mp4=mpv.desktop
inode/directory=thunar.desktop

[Added Associations]
text/plain=nvim.desktop;code.desktop

Quick Reference

# Hostname
hostnamectl set-hostname NAME

# Locale
localectl set-locale LANG=en_US.UTF-8
locale-gen

# Keyboard
localectl set-keymap us

# Timezone
timedatectl set-timezone America/New_York

# NTP
timedatectl set-ntp true

# Users
useradd -m -G wheel username
passwd username

# Groups
usermod -aG groupname username

# fstab
mount -a
findmnt --verify

# Sudo
EDITOR=nvim visudo