| name | arch-sysadmin |
| description | Arch Linux system administration. Use when the user asks to manage services, install packages, configure networking, inspect logs, manage users, tune kernel parameters, secure a server, or diagnose system issues on Arch. Covers pacman, AUR helpers (yay/paru), systemd, firewalld/nftables, systemd-networkd, journalctl, mkinitcpio, reflector, SSH hardening, and common diagnostic workflows. |
Arch Linux System Administration
Arch is a rolling-release distribution. There are no version upgrades — packages are continuously updated. This changes key workflows compared to fixed-release distros.
Execution Model
Pi executes tool calls sequentially, even when you emit multiple calls in one turn. Batch independent calls in a single turn to save round-trips:
| Pattern | Use for |
|---|
| Multiple bash calls in one turn | Independent diagnostics (df & free & uptime) |
read /path & read /other via bash | Read multiple files concurrently |
Step 1: Classify the Request
| Type | Trigger | Primary Approach |
|---|
| Package Ops | Install, remove, update, search packages | pacman + yay/paru for AUR |
| Service Ops | Start, stop, restart, enable, check status | systemctl + journalctl |
| Diagnostic | "Why is X slow?", "What's using Y?", "Check Z" | top/free/df/ss + targeted log inspection |
| Network | "Configure IP", "Fix DNS", "Check port" | ip/ss/systemd-networkd/resolvectl |
| Security | "Harden", "Audit", "Check firewall", "SSH setup" | firewalld/nftables/fail2ban/SSH config |
| User/Access | "Add user", "Groups", "Permissions" | useradd/usermod/chown/chmod |
| Storage | "Add disk", "Mount", "Check space", "LVM" | lsblk/df/mount/fdisk/LVM tools |
| Kernel/Tuning | "Tune sysctl", "Check modules", "Boot issues" | sysctl/modprobe/dmesg/mkinitcpio |
| Mirrors | "Slow downloads", "Update mirrors" | reflector/pacman-mirrors |
| AUR | "Install from AUR", "AUR package broken" | yay/paru + makepkg for manual builds |
Step 2: Run Commands
Always use sudo for privileged operations. Check the current user first with whoami. For AUR builds, do NOT use sudo — makepkg refuses to run as root.
Package Management (pacman)
pacman -Syu
pacman -Syu --noconfirm
pacman -Ss <keyword>
pacman -Si <pkg>
pacman -Qi <pkg>
pacman -Qs <keyword>
pacman -Ql <pkg>
pacman -Qo /path/to/file
pacman -Qdt
pacman -Qe
pacman -Qm
pacman -S <pkg>
pacman -S --needed <pkg>
pacman -R <pkg>
pacman -Rs <pkg>
pacman -Rns <pkg>
pacman -Rdd <pkg>
pacman -Sc
pacman -Scc
paccache -rk1
paccache -ruk0
du -sh /var/cache/pacman/pkg/
pacman -Fy
pacman -F <filename>
pacman -Dk
AUR (yay / paru)
yay -Syu
yay -S <pkg>
yay -Ss <keyword>
yay -Si <pkg>
yay -Rns <pkg>
yay -Yc
yay -Ps
paru -Syu
paru -S <pkg>
paru -Ss <keyword>
paru -Rns <pkg>
git clone https://aur.archlinux.org/<pkg>.git
cd <pkg>
makepkg -si
Mirror Management
reflector --latest 20 --sort rate --protocol https --save /etc/pacman.d/mirrorlist
reflector --country US,CA --age 12 --sort rate --save /etc/pacman.d/mirrorlist
systemctl enable --now reflector.timer
systemctl status reflector.timer
cat /etc/pacman.d/mirrorlist
Service Management
systemctl status <service>
systemctl start|stop|restart|reload <service>
systemctl enable|disable <service>
systemctl enable --now <service>
systemctl list-units --state=failed
systemctl list-unit-files --state=enabled
systemctl daemon-reload
journalctl -u <service> -n 50 --no-pager
journalctl -u <service> --since "10 min ago" --no-pager
journalctl -xe | tail -30
journalctl --boot -p err --no-pager | tail -30
System Diagnostics
free -h
df -h
du -sh /* 2>/dev/null | sort -rh | head -15
top -b -n1 | head -20
ps auxf --sort=-%mem | head -20
ps auxf --sort=-%cpu | head -20
lsof -p <pid>
strace -p <pid> -c -S time
iotop -b -n1 -o 2>/dev/null
uptime
vmstat 1 5
dmesg --level=err,warn | tail -30
dmesg | grep -i "out of memory"
Network
ip addr show
ip route show
ss -tlnp
ss -ulnp
ss -s
resolvectl status
resolvectl query <domain>
curl -sI https://example.com --max-time 5
mtr -r <host>
networkctl list
networkctl status <iface>
cat /etc/systemd/network/*.network
nmcli device status
nmcli connection show
nmcli connection show --active
Firewall (firewalld / nftables)
systemctl status firewalld
firewall-cmd --state
firewall-cmd --list-all
firewall-cmd --list-services
firewall-cmd --list-ports
firewall-cmd --add-service=http --permanent
firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --remove-port=8080/tcp --permanent
firewall-cmd --reload
nft list ruleset
nft list table inet filter
nft list ruleset > /etc/nftables.conf
systemctl enable --now nftables
iptables -L -n -v
User & Permissions
id <user>
getent passwd <user>
getent group <group>
useradd -m -s /bin/bash <user>
usermod -aG wheel,docker <user>
passwd -l <user>
passwd -S <user>
last -n 20
lastlog | grep -v "Never"
cat /etc/sudoers
visudo -c
Storage
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,FSTYPE
blkid
cat /etc/fstab
mount | column -t
findmnt
swapon --show
Logs
journalctl --boot -p err --no-pager | tail -30
journalctl --since "1 hour ago" --no-pager | tail -50
journalctl --since today | tail -50
journalctl -u sshd --no-pager | tail -30
cat /var/log/pacman.log | tail -20
journalctl --disk-usage
journalctl --vacuum-size=500M
Security Audit
firewall-cmd --list-all 2>/dev/null || nft list ruleset 2>/dev/null || iptables -L -n
ss -tlnp
passwd -S -a 2>/dev/null
awk -F: '($2 == ""){print}' /etc/shadow
awk -F: '($3 == 0){print}' /etc/passwd
find / -perm -4000 -o -perm -2000 -ls 2>/dev/null | head -20
cat /etc/ssh/sshd_config | grep -v '^#' | grep -v '^$'
lastb -n 20 2>/dev/null
journalctl -u sshd | grep "Failed password" | tail -20
pacdiff -o
find /etc -name "*.pacnew" -o -name "*.pacsave" -o -name "*.pacorig"
Kernel & Hardware
uname -a
hostnamectl
cat /etc/os-release
lscpu
lspci -k | grep -A3 -i net
lsmod | grep <module>
modinfo <module>
sysctl -a | grep <param>
sysctl -w <param>=<value>
sysctl -p
cat /etc/sysctl.d/*.conf
mkinitcpio -P
ls /boot/initramfs-*.img
ls /boot/vmlinuz-*
pacman -Q linux
ls /usr/lib/modules/
Boot Management (systemd-boot / GRUB)
bootctl status
bootctl list
ls /boot/loader/entries/
grub-mkconfig -o /boot/grub/grub.cfg
cat /etc/default/grub
SSH Hardening
ssh-keygen -t ed25519 -C "comment" -f ~/.ssh/id_ed25519
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@host
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
systemctl restart sshd
Cron & Scheduling (systemd timers)
systemctl list-timers
systemctl list-timers --all
cat /etc/systemd/system/*.timer
cat ~/.config/systemd/user/*.timer
crontab -l
cat /etc/crontab
ls /etc/cron.*/
Step 3: Interpret & Advise
When reporting results:
- Prioritize actionable issues (failed services, full disks, OOM kills, auth failures)
- Show raw output first, then summarize key findings
- For errors: check journalctl for the service, then suggest fixes
- For performance: correlate CPU/memory/IO with process list
- For security: flag open ports, empty passwords, and weak SSH config
- For Arch-specific: check for
.pacnew files after updates, partial upgrades (pacman -Qk), and AUR package breakage after system updates
Common Workflows
"System update"
find /etc -name "*.pacnew" -o -name "*.pacsave" | head -10
reflector --latest 10 --sort rate --protocol https --save /etc/pacman.d/mirrorlist
pacman -Syu
yay -Syu
pacman -Qdt
pacman -Dk
"Server is slow"
free -h && uptime && df -h && top -b -n1 | head -20
Then: check for OOM kills (dmesg | grep -i oom), high I/O (iotop -b -n1 -o 2>/dev/null), or swap thrashing (vmstat 1 5).
"Service won't start"
systemctl status <service> --no-pager -l
journalctl -u <service> -n 100 --no-pager
"Disk is full"
df -h && du -sh /* 2>/dev/null | sort -rh | head -15
du -sh /var/cache/pacman/pkg/
Then drill into the largest directory. On Arch, package cache is the most common culprit — run paccache -rk1 or pacman -Sc.
"AUR package broke after update"
yay -S <pkg> --rebuild
yay -S <pkg> --cleanbuild
cd /tmp && git clone https://aur.archlinux.org/<pkg>.git && cd <pkg>
makepkg -si
"Unauthorized access suspected"
last -n 30 && lastb -n 20 2>/dev/null && journalctl -u sshd | grep "Failed" | tail -50
Check for: unknown users, logins at odd hours, repeated failures from same IP.
"Pacman database is corrupted"
pacman -Dk
sudo pacman -Syy
pacman -Qk <pkg>
Guidelines
- Run
sudo only when needed; check whoami first
- Never run makepkg as root — it will refuse and corrupt your build environment
- Always do a full system update (
pacman -Syu) before installing new packages on a rolling release
- Prefer
pacman -Rs over -R to clean up unused dependencies
- Use
paccache from pacman-contrib for cache management; don't blindly pacman -Scc
- Arch uses
wheel group for sudo, not sudo group like Ubuntu
- Arch uses systemd-networkd or NetworkManager, not netplan
- Arch uses firewalld or nftables, not ufw (though ufw is available in repos)
- After large updates, check for
.pacnew files with pacdiff or find /etc -name "*.pacnew"
- Partial upgrades are not supported — always use
pacman -Syu not pacman -Sy && pacman -S <pkg>
- Back up config files before modifying:
cp file file.bak.$(date +%s)
- The AUR is user-submitted content; always review PKGBUILDs before installing (
yay -Si <pkg> shows votes and popularity)
- For boot issues: keep
linux-lts kernel installed as a fallback
- Use
reflector to keep mirrors fast; stale mirrors cause download failures