Reset Arch Linux to a clean, minimal TTY state β without reinstalling from ISO.
Useful when you want to wipe a desktop environment and start fresh, or reclaim a system that has accumulated too much cruft.
This script is destructive and irreversible. It will:
- Remove every installed package not on the keep list
- Delete your dotfiles, configs, caches, and home directory data
- Wipe the pacman package cache
- Reset systemd to boot into TTY only
Back up everything you care about before running this.
- Arch Linux with
pacman - Run as root (
sudo) - Ideally from a real TTY (
Ctrl+Alt+F2) β the script will warn you if you aren't
# Clone or download the script, then:
chmod +x arch-nuke.sh
# Interactive mode (recommended β prompts before every destructive step)
sudo ./arch-nuke.sh
# Dry-run β preview all actions without making any changes
sudo ./arch-nuke.sh --dry-run
# Full auto β no prompts, nukes everything (use with extreme caution)
sudo ./arch-nuke.sh --yes| Step | Action |
|---|---|
| 1 | Stops and disables all display managers (GDM, SDDM, LightDM, etc.) and kills any running X/Wayland session |
| 2 | Removes all AUR/foreign packages |
| 3 | Removes all explicitly installed packages not in the keep list |
| 4 | Removes orphaned packages |
| 5 | Nukes dotfiles and config directories in your home folder |
| 6 | Clears pacman cache, regenerates initramfs, sets systemd target to TTY |
| 7 | Verifies critical packages survived β warns you before rebooting if anything is missing |
These packages are never removed:
- Core:
base,linux,linux-firmware,systemd,bash,glibc, and essential GNU tools - Boot:
grub,efibootmgr - Network:
networkmanager,iwd,dhcpcd - Package management:
pacman,archlinux-keyring - Filesystem tools:
e2fsprogs,btrfs-progs,ntfs-3g, etc. - Editors:
nano,vim(so you can edit configs after reboot) - Kernel variants:
linux-lts,linux-zen,linux-hardenedare auto-detected β only kept if they are actually installed
To customize the list, edit the KEEP=() array near the top of the script.
~/.gnupg (GPG keys) is not silently deleted. The script prompts you separately before touching it, with a clear explanation of what you'd lose (git signing keys, AUR signing, etc.).
Once you reboot into the TTY:
# 1. Connect to Wi-Fi
nmcli dev wifi connect "YourSSID" password "yourpassword"
# β or using iwd β
systemctl start iwd
iwctl station wlan0 connect "YourSSID"
# 2. Update the system
pacman -Syu
# 3. Install your dotfiles / desktop environment fresh| Issue | Fix |
|---|---|
libalpm.so* in keep list |
Removed β it's a library file, not a package name |
eval "$@" in run() |
Replaced with "$@" β safer, handles special characters correctly |
Unquoted $FOREIGN variable |
Now uses mapfile array β proper word splitting |
| No TTY enforcement | Script now detects non-TTY and prompts before continuing |
~/.gnupg silently nuked |
Moved to a separate, clearly-worded prompt |
-Rdd force-remove was silent |
Now logs a loud warning per package when dep checks are skipped |
| Kernel variants always listed | Auto-detected at runtime β only kept if installed |
| No post-nuke verification | New Step 7 checks that critical packages survived |
Do whatever you want with it. If it breaks your system, that's the point β you asked it to.