ARCH LINUX
System
Administration
Services · initcpio Hooks · Display · Users & Permissions
A comprehensive guide to advanced Arch Linux configuration
01   Service Management
02   initcpio Hooks
03   X11 vs Wayland
04   Display Managers
05   Desktop Environments
06   Users & Permissions
01
Service Management
systemd – the heart of Arch Linux
SECTION 1 · Service Management
systemctl – basic commands
systemctl start <service>
Start a service
systemctl stop <service>
Stop a service
systemctl restart <service>
Restart a service
systemctl reload <service>
Reload configuration
systemctl enable <service>
Enable autostart
systemctl disable <service>
Disable autostart
systemctl status <service>
Check service status
systemctl list-units
List active units
SECTION 1 · Service Management
systemd units and targets
Unit types
.service  – services and programs
.socket   – socket-based activation
.timer    – scheduled tasks (cron replacement)
.mount    – mount points
.target   – groups of units
.path     – file/directory monitoring
Important targets
multi-user.target  – text mode
graphical.target   – graphical mode
rescue.target      – rescue mode
emergency.target   – minimal init
default.target     – default target
# Change the default target:
systemctl set-default graphical.target

# Switch target in real time:
systemctl isolate multi-user.target

# Create a custom service – /etc/systemd/system/myapp.service:
[Unit]  Description=My App  After=network.target
[Service]  ExecStart=/usr/bin/myapp  Restart=always
[Install]  WantedBy=multi-user.target
02
initcpio Hooks
Custom early-boot scripts
SECTION 2 · initcpio Hooks
initcpio hook structure
install/ file (build time)
build()   – what to add to initramfs
 • add_runscript – include the hook
 • add_binary   – add binaries
 • add_file     – copy files
help()    – hook description
hooks/ file (run time)
run_hook()       – before root mount
run_latehook()   – after root mount
run_cleanuphook() – before pivot_root

Hooks run inside initramfs during boot
# Enable hook in /etc/mkinitcpio.conf:
HOOKS=(base udev autodetect modconf block myhook filesystems keyboard fsck)

# Rebuild initramfs after adding the hook:
mkinitcpio -P                   # all presets
mkinitcpio -p linux             # 'linux' preset only
SECTION 2 · initcpio Hooks
Example: terminal color palette hook
/etc/initcpio/hooks/mytheme
/etc/initcpio/install/mytheme
#!/bin/sh
run_latehook() {
  # Solarized Dark inspired palette
  local palette=\
  "002b36 dc322f 859900 b58900 \
268bd2 d33682 2aa198 eee8d5 \
073642 cb4b16 586e75 657b83 \
839496 6c71c4 93a1a1 fdf6e3"
  local i=0 seqs=''
  for col in $palette; do
    seqs="${seqs}\033]P$(printf '%X' $i)${col}"
    i=$((i+1))
  done
  for tty in /dev/tty[0-6]; do
    [ -w "$tty" ] || continue
    printf "$seqs" > "$tty"
    printf "\033[H\033[J" > "$tty"
    [ -f /font.psf.gz ] &&
      setfont -C "$tty" /font.psf.gz
  done
}
#!/bin/bash
build() {
  add_runscript
  add_binary setfont
  add_binary printf
  # Find font
  local fp=$(find \
    /usr/share/kbd/consolefonts/ \
    -name 'ter-v28b*' | head -1)
  if [ -n "$fp" ]; then
    add_file "$fp" /font.psf.gz
  else
    echo 'WARNING: font missing!'
  fi
}
help() {
  cat <<EOF
Sets Solarized Dark palette
and loads Terminus 28px font
on all VTs during boot.
EOF
}
SECTION 2 · initcpio Hooks
Solarized Dark palette – 16 colors
#002b36
0 – background
#dc322f
1 – red
#859900
2 – green
#b58900
3 – yellow
#268bd2
4 – blue
#d33682
5 – magenta
#2aa198
6 – cyan
#eee8d5
7 – white
#073642
8 – dark bg
#cb4b16
9 – orange
#586e75
10 – lt.grey
#657b83
11 – grey
#839496
12 – bright
#6c71c4
13 – violet
#93a1a1
14 – lt.cyan
#fdf6e3
15 – bright
The palette defines 16 terminal colors (index 0-15) mapped to ANSI sequences 30-37 and 90-97.
03
X11 vs Wayland
Display protocols and window manager management
SECTION 3 · X11 vs Wayland
Architecture comparison

X11 / Xorg

  • • Client-server architecture (X Server)
  • • Exists since 1984
  • • Flexible: any WM works with Xorg
  • • Network transparent (DISPLAY=host:0)
  • • Launch: startx or xinit
  • • Live WM swap via --replace
  • • Config: ~/.xinitrc, /etc/X11/
  • • Separate composite manager (picom)
  • • Mature driver support

Wayland

  • • Protocol (not a server) – Compositor = WM
  • • Project since 2008, stable from ~2018
  • • Better process isolation, security
  • • No network transparency
  • • Launch: WM/DE startup script
  • • No live WM swap (session restart needed)
  • • Config specific to each compositor
  • • Compositor handles rendering (wlroots)
  • • Native HiDPI, touch, stylus support
  • • Requires XWayland for legacy X11 apps
SECTION 3 · X11 vs Wayland
Launching X11 and live WM switching
# Start plain X11:
startx               # reads ~/.xinitrc
xinit /usr/bin/openbox -- :0

# ~/.xinitrc example:
exec openbox-session
# Start a Wayland session (sway):
sway                 # from a plain TTY
dbus-launch --exit-with-session sway

# Wayland environment variables:
export XDG_SESSION_TYPE=wayland
Live Window Manager switching (X11 only)
# Replace the running WM with another one (X11):
openbox --replace &      # replace current WM with Openbox
i3 --replace &           # replace with i3
bspwm &                  # bspwm lacks --replace; force it:
pkill -x openbox && bspwm

# Check the current WM:
wmctrl -m               # requires: pacman -S wmctrl
04
Display Managers
Managing graphical sessions
SECTION 4 · Display Managers
Popular Display Managers on Arch

SDDM

pacman -S sddm

Native DM for KDE/Qt. Supports X11 and Wayland. Easy theme configuration.

GDM

pacman -S gdm

GNOME Display Manager. Deep integration with GNOME and systemd-logind.

LightDM

pacman -S lightdm

Lightweight, DE-agnostic. Multiple greeters (GTK, Qt, WebKit).

ly

pacman -S ly

TUI – minimalist terminal DM. No graphics, minimal dependencies.

greetd

pacman -S greetd

Modern, IPC protocol. Configurable greeter (tuigreet, agreety).

LXDM

pacman -S lxdm

Part of LXDE. Lightweight GTK3, simple interface.

SECTION 4 · Display Managers
Enabling and configuring a Display Manager
# Install and enable SDDM:
pacman -S sddm
systemctl enable sddm.service
systemctl start sddm.service

# Switch DM (disable old one, enable new one):
systemctl disable lightdm.service
systemctl enable sddm.service
# Session files – where DM looks for sessions:
ls /usr/share/xsessions/        # X11 sessions
ls /usr/share/wayland-sessions/ # Wayland sessions

# Custom session ~/.dmrc (for some DMs):
[Desktop]
Session=i3
05
Desktop Environments
GNOME, KDE, XFCE and more
SECTION 5 · Desktop Environments
Popular desktop environments

GNOME

gtk4, Wayland-first
pacman -S gnome
systemctl enable gdm

KDE Plasma

Qt6, X11+Wayland
pacman -S plasma
systemctl enable sddm

XFCE

GTK3, lightweight, X11
pacman -S xfce4 xfce4-goodies
systemctl enable lightdm

Cinnamon

GTK3, GNOME 2 fork
pacman -S cinnamon
systemctl enable lightdm

MATE

GTK3, classic layout
pacman -S mate mate-extra
systemctl enable lightdm

LXQt

Qt5, very lightweight
pacman -S lxqt
systemctl enable sddm
06
Users & Permissions
useradd · chmod · chown · chattr
SECTION 6 · Users & Permissions
Managing users and groups
# Create a user:
useradd -m -G wheel,audio,video \
  -s /bin/bash john
passwd john

# Modify a user:
usermod -aG docker john  # add to group
usermod -s /bin/zsh john # change shell
userdel -r john          # remove with home
# Group management:
groupadd devs
groupmod -n developers devs
groupdel developers

# Inspection:
groups john          # user's groups
id john              # UID, GID, groups
cat /etc/passwd      # user list
chmod – file permissions
chmod 755 script.sh        # rwxr-xr-x  (owner=rwx, group=rx, other=rx)
chmod u+x,g-w file         # symbolic: add x for owner, remove w for group
chmod -R 644 directory/    # recursive: rw-r--r-- for all files
chmod o-rwx secret.txt     # revoke all permissions for 'others'
SECTION 6 · Users & Permissions
chown, chattr and special permissions
# chown – change ownership:
chown john file.txt
chown john:devs file.txt
chown -R www-data:www-data /var/www

# Group only:
chgrp audio /dev/snd/*
# chattr – filesystem attributes:
chattr +i file.txt    # immutable (locked)
chattr -i file.txt    # remove immutable
chattr +a log.txt     # append-only
lsattr file.txt       # show attributes

# Works on ext2/3/4, btrfs
Special permission bits
BitValueCommandEffect
SUID4xxxchmod u+s /usr/bin/progRuns as the file owner
SGID2xxxchmod g+s /directoryNew files inherit directory's group
Sticky1xxxchmod +t /tmpOnly owner or root can delete the file
SUMMARY
What we covered
01Service Management
systemctl, units, targets, custom services
02initcpio Hooks
Custom boot-time scripts, color palettes, fonts
03X11 vs Wayland
Architecture, live WM switching, session startup
04Display Managers
SDDM, GDM, LightDM, ly – enabling and config
05Desktop Environments
GNOME, KDE, XFCE and more – install and run
06Users & Permissions
useradd, chmod, chown, chattr, SUID/SGID/sticky