Use when debugging crashes on Arch Linux (gdb, backtraces), resolving pacman errors (conflicting files, failed to commit, locked database), installing AUR packages, configuring system services...
Comprehensive guidance for Arch Linux system administration, package management, configuration, and troubleshooting, extracted from official Arch Wiki documentation.
Authority: All content sourced from https://wiki.archlinux.org/, continuously updated by the Arch Linux community. Reference files preserve structure and examples from source docs.
Coverage: The Quick Reference below covers ~80% of common tasks. For complex/rare issues, see Reference Files section for deep dives.
Trigger when encountering:
Package Management:
System:
systemctl to manage services)Debugging:
Desktop:
For most common tasks, this Quick Reference is sufficient. See Reference Files for complex scenarios.
Basic operations:
# Update package database and upgrade all packages
pacman -Syu
# Install a package
pacman -S package_name
# Remove a package (keep dependencies)
pacman -R package_name
# Remove a package and unused dependencies
pacman -Rs package_name
# Search for a package
pacman -Ss search_term
# Get detailed package information
pacman -Si package_name
# List all installed packages
pacman -Q
# Search installed packages
pacman -Q | grep search_term
# Check which package owns a file
pacman -Qo /path/to/file
# Clean package cache (remove old versions)
pacman -Sc
# List explicitly installed packages
pacman -Qe
Install multiple related packages:
# Pattern expansion
pacman -S plasma-{desktop,mediacenter,nm}
Resolve common errors:
# Error: "conflicting files" - use with caution, only if you understand the conflict
pacman -S package_name --overwrite '*'
# Error: "unable to lock database" - check if pacman is already running, or remove stale lock
rm /var/lib/pacman/db.lck
# Error: "failed to commit transaction (invalid or corrupted package)"
# Update mirrorlist and clear cache:
pacman -Scc
pacman -Syyu
Get a backtrace with gdb:
# Install gdb if not present
pacman -S gdb
# Start gdb with crashed program
gdb /path/to/executable
# Inside gdb, run the program
(gdb) run arg1 arg2
# When crash occurs, enable logging and get backtrace
(gdb) set logging file backtrace.log
(gdb) set logging enabled on
(gdb) bt full
# Debuginfod will automatically download symbols - answer "y" when prompted
Attach gdb to running process:
# Find process ID
pidof program_name
# Attach (may need sudo)
gdb -p PID
# Continue execution
(gdb) continue
Analyze core dump:
# If core dumps are enabled
gdb /path/to/application /path/to/core
# Get backtrace
(gdb) bt full
# Start a service
systemctl start service_name
# Stop a service
systemctl stop service_name
# Enable service to start at boot
systemctl enable service_name
# Enable and start immediately
systemctl enable --now service_name
# Check service status
systemctl status service_name
# View service logs
journalctl -u service_name
# View logs from current boot
journalctl -b
# Follow logs in real-time
journalctl -f
# List all installed shells
chsh -l
# Change your default shell
chsh -s /usr/bin/zsh
# For systemd-homed users
homectl update --shell=/usr/bin/zsh username
# Disable compositing (fixes screen tearing)
gsettings set org.mate.Marco.general compositing-manager false
# Enable accessibility features (before first MATE start)
gsettings set org.mate.interface accessibility true
# Disable low battery notifications
gsettings set org.mate.power-manager notify-discharging false
# Install OpenSSH
pacman -S openssh
# Enable and start SSH service
systemctl enable --now sshd
# Check if running
systemctl status sshd
# Configuration file
/etc/ssh/sshd_config
# Client configuration (per-user)
~/.ssh/config
# Install build essentials
pacman -S base-devel linux-headers
# Prepare kernel source
make mrproper
zcat /proc/config.gz > .config
make oldconfig
make prepare
make modules_prepare
# Compile specific module (example: btrfs)
make M=fs/btrfs
# Check loaded kernel modules
lsmod
# Get module information
modinfo module_name
# View kernel messages (hardware detection)
dmesg
# View hardware logs from current boot
journalctl -b -k
Problem: Need remote access to Arch Linux machine
Solution:
# Step 1: Install SSH server
pacman -S openssh
# Step 2: Start and enable service
systemctl enable --now sshd
# Step 3: Check firewall (if using)
# Allow SSH port 22
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Or with ufw:
ufw allow ssh
# Step 4: Test locally
ssh localhost
# Step 5: Connect from remote machine
ssh user@arch-machine-ip
# Step 6: (Optional) Configure key-based auth
# On client machine:
ssh-keygen -t ed25519
ssh-copy-id user@arch-machine-ip
# Step 7: (Security) Disable password auth in /etc/ssh/sshd_config
# PasswordAuthentication no
# Then: systemctl restart sshd
Expected result: Secure remote access to your Arch Linux machine
Problem: Application crashed, need backtrace for bug report
Solution:
# Step 1: Install debugging tools
pacman -S gdb
# Step 2: Run application under gdb
gdb /usr/bin/application
# Step 3: Run the program (it will crash)
(gdb) run
# Expected output when crash occurs:
# Program received signal SIGSEGV, Segmentation fault.
# 0x00007ffff7a1234 in some_function ()
# Step 4: Configure logging
(gdb) set logging file ~/crash_backtrace.log
(gdb) set logging enabled on
# Output: Copying output to ~/crash_backtrace.log.
# Step 5: Get full backtrace
(gdb) bt full
# Expected output: Full stack trace with local variables
# Debuginfod will download symbols automatically
# Step 6: Exit gdb
(gdb) quit
# Step 7: Include ~/crash_backtrace.log in bug report
Expected result: Complete backtrace with symbols ready for bug report
Problem: pacman -S package fails with "conflicting files" error
Solution:
# Step 1: Read the error message carefully
# Example error:
# error: failed to commit transaction (conflicting files)
# package: /usr/bin/program exists in filesystem
# Step 2: Identify which package owns the conflicting file
pacman -Qo /usr/bin/program
# If output is "error: No package owns /usr/bin/program":
# File is orphaned, safe to overwrite
# Step 3: Use --overwrite flag (ONLY if you understand the conflict)
pacman -S package --overwrite /usr/bin/program
# Or overwrite all conflicting files (use with extreme caution):
pacman -S package --overwrite '*'
# Step 4: Verify installation
pacman -Q package
Expected result: Package installed without conflicts
Problem: Need software not in official repositories
Solution:
# Step 1: Ensure you have build tools
pacman -S --needed base-devel git
# Step 2: Clone AUR package (example: yay)
cd /tmp
git clone https://aur.archlinux.org/yay.git
# Step 3: Review PKGBUILD for security
cd yay
cat PKGBUILD
# READ THE PKGBUILD! Look for suspicious commands
# Step 4: Build and install
makepkg -si
# -s: Install dependencies
# -i: Install after building
# Expected output:
# ==> Making package: yay 12.1.2-1 (timestamp)
# ==> Checking runtime dependencies...
# ==> Installing package with pacman
# Step 5: Verify installation
which yay
yay --version
Expected result: AUR package safely built and installed
When to use reference files: Quick Reference covers most tasks. Use reference files for:
Available references in references/ directory:
Navigation tip: Each reference file includes table of contents, code examples with syntax highlighting, and original Wiki URLs.
Package issues:
pacman -Scc, update mirrors/var/lib/pacman/db.lckService won't start:
systemctl status service_namejournalctl -u service_name -n 50Boot failures:
journalctl -b -1 (previous boot)Hardware not working:
lsmod | grep module_namedmesg | grep -i device_nameApplication crashes:
When working with Arch Linux, you may also need: