Arch Linux Pacman: Complete Guide & Tutorial
📖 Preamble
In the Arch Linux ecosystem — a pure rolling release distribution — pacman (Package Manager) is the central software management tool. It natively handles official repositories, automatically resolves dependencies, and relies on the .pkg.tar.zst format for package handling. For AUR (Arch User Repository) access, complementary tools like yay or paru are layered on top.
/image%2F7127247%2F20260228%2Fob_d194a5_9a13e453-18db-4525-bf92-026e7321b136.png)
This guide uses Arch Linux (rolling release, core , extra , multilib repositories) as its base, with testing repositories ( core-testing , extra-testing ) and the AUR as supplementary sources. All commands are verified for an up-to-date standard Arch system (February 2026), running pacman 7.1.0 (November 2025).
Master pacman progressively, from beginner to expert, with concrete practical cases and verified commands.
👥 Target Audience
Sections: Starter Pack
Sections: Concepts & Practices
Sections: Advanced & Critical
📚 How to Read This Guide
| Level | Content | Recommendation |
|---|---|---|
| 🟢 Essential | Common commands, examples | Master these first |
| 🟠 Intermediate | Concepts, workflows | To deepen your knowledge |
| 🔴 Expert | Critical cases, AUR, advanced operations | For experienced users |
❓ What is Pacman?
| Element | Description |
|---|---|
| Role | Native package manager of Arch Linux |
| Engine | Written in C, libalpm library, .pkg.tar.zst format |
| Strengths | Rolling release, dependency resolution, AUR via helpers, speed |
| Current version | 7.1.0 (November 2025) |
| Audience | All Arch users, from beginners to administrators |
📝 Basic Syntax
General structure
Breakdown
| Element | Role | Example |
|---|---|---|
| OPERATION | Main action (uppercase letter) | -S , -R , -Q , -U |
| OPTIONS | Operation modifiers | -y , -u , -s , -i |
| TARGETS | Package name, file, pattern | htop , ./pkg.tar.zst |
Annotated example
Pacman uses letter flags ( -S , -R , -Q …) where APT uses verbose subcommands ( install , remove , search …).
🧩 Difference between pacman , yay and paru
| Tool | Main role | Language | Audience |
|---|---|---|---|
| pacman | Official management (core/extra/multilib) | C | Daily use + scripts |
| yay | Pacman wrapper + AUR (Yet Another Yaourt) | Go | Good choice, simple interface |
| paru | Pacman wrapper + AUR, built-in PKGBUILD review | Rust | Recommended 2026 — more actively maintained |
| makepkg | Manual compilation from PKGBUILD | Bash | Manual AUR build / low level |
paru is more actively maintained in 2026, forces a PKGBUILD review before installation, and supports building in a clean chroot ( --chroot ). Recommended at all levels.
🏗️ Internal Architecture: pacman + AUR
┌────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ pacman │ ──► │ libalpm (lib) │ ──► │ Système Linux │
└────────────┘ └──────────────────┘ └──────────────────┘
│ │ │
▼ ▼ ▼
CLI Interface Install/remove File management
Repo management Local database Pre/post-transaction hooks
Dependency /var/lib/pacman/ Sandbox (NO_NEW_PRIVS)
resolution
┌────────────┐ ┌──────────────────┐
│ yay/paru │ ──► │ AUR + pacman │
└────────────┘ └──────────────────┘
│
▼
Downloads PKGBUILD ► makepkg ► pacman -UComponent roles
| Component | Role | Importance |
|---|---|---|
| pacman | User interface, official repo management, resolution | Daily interaction |
| libalpm | Underlying C library, transactional core | System core |
| /var/lib/pacman | Local database of installed packages | System integrity |
| yay / paru | AUR access + pacman wrapping | Extensibility |
| makepkg | Compiles PKGBUILDs into .pkg.tar.zst | AUR/custom build |
🆕 Pacman 7.1.0 — Major Changes (November 2025)
Security & Sandbox
| Feature | Description | Impact |
|---|---|---|
| NO_NEW_PRIVS | Downloads run without possibility of privilege escalation | Reduces attack surface during installs |
| Enhanced syscall filtering | Restricts system calls in the download process | Stricter sandbox for libalpm |
| Fine-grained sandbox options | New directives in pacman.conf and CLI | Customizable sandbox level |
makepkg — build improvements
| Feature | Description |
|---|---|
| NPROC dans makepkg.conf | Controls build operation parallelism |
| Parallelized stripping | Reduces build time for large packages |
| options_$arch dans PKGBUILD | Architecture-specific options in PKGBUILDs |
| Source reproducibility | Source tarballs generated reproducibly |
repo-add — new flags
If you maintain an older config, check sandbox option compatibility after upgrading to 7.1.0 with man pacman.conf .
📦 Repositories
Repository roles: the foundation
Repositories are defined in /etc/pacman.conf .
┌─────────────────────┐
│ core │ (base system, boot, network, build tools)
└─────────────────────┘
│
┌─────────────────────┐
│ extra │ (Xorg, DE, browsers, Python, Ruby…)
│ [former community, │ merged August 2023
└─────────────────────┘
│
┌─────────────────────┐
│ multilib │ (32-bit libs, Steam) — disabled by default
└─────────────────────┘
│
┌─────────────────────┐
│ core/extra-testing │ (pre-releases, tests — experts only)
└─────────────────────┘
│
┌─────────────────────┐
│ AUR │ (Arch User Repository — unofficial)
└─────────────────────┘Types de dépôts
| Type | Content | Notes |
|---|---|---|
| core | Fundamental packages (boot, network, build) | Maximum quality, signoffs required |
| extra | Everything else — formerly community merged August 2023 | Maintained by Arch Package Maintainers |
| multilib | 32-bit libs and apps (Steam, Wine…) | Disabled by default, enable in pacman.conf |
| core-testing | Candidats pour core | ⚠️ Must enable alongside extra-testing |
| extra-testing | Candidats pour extra | ⚠️ Must enable alongside core-testing |
| gnome-unstable | GNOME alphas/betas | Reserved for GNOME testers |
| kde-unstable | KDE Plasma and Applications betas/RCs | Reserved for KDE testers |
| staging | Packages being rebuilt | ⛔ Never enable — internal dev use only |
| AUR | Paquets communauté (PKGBUILD) | Unofficial — via paru/yay/makepkg only |
Enable multilib
Then: sudo pacman -Syu
Enable kde-unstable
Best practices by use case
| Context | Recommended repos | Discouraged repos |
|---|---|---|
| Standard desktop | core , extra | staging — toujours |
| Gaming / Steam | core , extra , multilib | staging |
| KDE tester | core , extra , core-testing , extra-testing , kde-unstable | staging |
| GNOME tester | core , extra , core-testing , extra-testing , gnome-unstable | staging |
| Server | core , extra | multilib , testing , AUR |
⚖️ Repository Priorities
Pacman does not have a fine-grained pinning system like APT. Priority is determined by the order of sections in /etc/pacman.conf : the repository listed first wins in case of name conflict.
pacman needs to install a package:
│
▼
1. Repository listed FIRST in pacman.conf
│
▼
2. Most recent version (if same repo)
│
▼
3. Résolution des resolutionIn /etc/pacman.conf , section [options]:
Arch does not support partial upgrades. Running pacman -Sy without -u is dangerous and can leave the system in an inconsistent state. Always use pacman -Syu .
🔄 Arch Rolling Release — In 20 seconds
Risks: Low if updated regularly
Usage: Everyone
Routine: pacman -Syu
Risks: Moderate
Usage: Arch testers
Routine: Enable in pacman.conf
Risks: Variable (PKGBUILD quality)
Usage: Everything not in official repos
Routine: paru -Syu or yay -Syu
🚀 Starter Pack — The 15 Essential Commands
📦 Repository Management
Inspecting repositories
Add, modify, remove
🔍 Advanced Query Commands ( -Q , -S , -F )
| Command | Description |
|---|---|
| pacman -Si <pkg> | Infos complètes depuis les dépôts (versions, resolution) |
| pacman -Qi <pkg> | Info of locally installed package |
| pacman -Ql <pkg> | List of files installed by a package |
| pacman -Fl <pkg> | List of files in a remote package |
| pacman -Qo <fichier> | Which package owns this file (installed) |
| pacman -F <fichier> | Which package owns this file (repos) — requires pacman -Fy |
| pacman -Qdt | Paquets orphelins (plus requis comme resolution) |
| pacman -Qet | Paquets installés explicitement (non resolution) |
| pacman -Qmq | Foreign packages (AUR, manually installed) |
| pacman -Qk <pkg> | Check file integrity of a package |
| pacman -T <dep1> <dep2> 🆕 | Vérifier si des resolution sont satisfaites (checkdeps — utile en scripting) |
| pactree <pkg> | Arbre de resolution (paquet pacman-contrib ) |
📥 Install / Update / Remove
pacman -Su vs pacman -Syu vs full upgrade
| Criterion | -Su | -Syu | paru -Syu |
|---|---|---|---|
| Sync database | ❌ Non | ✔️ Oui | ✔️ Oui |
| Updates official packages | ✔️ Oui | ✔️ Oui | ✔️ Oui |
| Updates AUR packages | ❌ Non | ❌ Non | ✔️ Oui |
| Recommended use | ⛔ Discouraged alone | Daily | If using AUR |
Advanced installation
Removal
Locking packages (IgnorePkg)
Cache cleanup
paccache is surgical — it keeps a configurable number of previous versions, preserving the ability to downgrade without re-downloading. pacman -Scc is radical and eliminates any possibility of local rollback. On a production system, never use -Scc .
🛠️ Maintenance & Diagnostics
Broken packages / database lock
Integrity check
pacman -T — Dependency checking in scripts 🆕
pacman -T (checkdeps) vérifie si des resolution sont satisfaites sans déclencher aucune transaction — précieuse en scripting et dans les PKGBUILDs.
Before each pacman -Syu after a long absence, read the Arch News . News items flag required manual interventions: critical .pacnew files, renamed packages, rebuilds (e.g. NVIDIA 590, .NET, kernel…).
Dependencies and consistency
⚡ Advanced Commands (Expert)
Working with testing / unstable repositories
Downgrade — 3 strategies
Pacman hooks
Hooks run before ( PreTransaction ) or after ( PostTransaction ) transactions.
-dkms packages (e.g. nvidia-dkms ) include their own automatic hook . Creating a manual DKMS hook is unnecessary. Verify with: pacman -Ql dkms | grep hook
Mirrors: optimize with reflector
🔧 Tools Requiring Installation
| Tool | Role | Install |
|---|---|---|
| pacman-contrib | pactree , paccache , pacdiff , checkupdates | sudo pacman -S pacman-contrib |
| pkgfile | Find the package providing a file (repo database) | sudo pacman -S pkgfile && sudo pkgfile --update |
| reflector | Automatically optimize the mirrorlist | sudo pacman -S reflector |
| paru | Modern AUR helper (Rust) — recommended | git clone https://aur.archlinux.org/paru.git && cd paru && makepkg -si |
| yay | AUR helper (Go) — reliable alternative | git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si |
| downgrade | Downgrade easily (cache + ALA, interactive) | paru -S downgrade |
| needrestart | Services to restart after update | paru -S needrestart |
| namcap | Analyze PKGBUILD quality | sudo pacman -S namcap |
⚠️ Dangerous Commands — Danger Zone
Some commands can irreversibly break an Arch system .
| Command | Danger |
|---|---|
| pacman -Sy <pkg> (sans -u ) | Partial upgrade — #1 cause of broken Arch systems |
| pacman -Rdd <pkg> | Supprime en ignorant les resolution inverses |
| pacman -Rsc <pkg> | Recursive removal of dependents — may take out critical packages |
| pacman -S --overwrite "*" <pkg> | Overwrites all conflicting files — reserved for cases prescribed by Arch News |
| rm /var/lib/pacman/db.lck | Only remove if no active pacman process ( fuser first) |
| pacman -Scc | Empties entire cache → rollback impossible without re-downloading |
| Activer [staging] | Guaranteed broken system — internal dev use only |
Best practices
- Use --print to simulate before applying
- Back up with timeshift or snapper (Btrfs) before any critical update
- Read Arch News before pacman -Syu after a long absence
- Never use pacman -Sy without -u
- Prefer paccache -rk2 over pacman -Scc
🏆 Top 12 Advanced pacman Commands
🎯 Advanced Practical Cases (GPS format)
🔗 Complete References
Official Arch documentation
| Source | Content |
|---|---|
| ArchWiki — pacman | Complete reference for the pacman command |
| ArchWiki — AUR | Arch User Repository — usage and security |
| ArchWiki — paru | Complete reference for paru |
| Arch News | Required manual interventions — read before each update |
Local help pages
📖 Recommended Reading from SafeITExperts
| Source | Content |
|---|---|
| APT Debian | Complete APT / Debian guide 2026 |
| Zypper openSUSE | Complete Zypper / openSUSE guide 2026 |
| DNF Fedora | Complete DNF / Fedora guide 2026 |
| sudo ou su ? | Linux privilege escalation |
🎯 Conclusion
Pacman is a remarkably simple, fast, and consistent package manager, perfectly suited to Arch Linux's rolling release model. Mastering it requires understanding repositories, the priority order in pacman.conf , and a few essential reflexes.
- Always pacman -Syu (never -Sy alone)
- Use paru for AUR — safer, better maintained
- Prefer paccache -rk2 over pacman -Scc
- Read Arch News before each update after absence
- Handle .pacnew files with pacdiff after updates
- Pacman 7.1.0 brings enhanced sandbox — check man pacman.conf if using older config
/image%2F7127247%2F20260228%2Fob_a0db27_9a13e453-18db-4525-bf92-026e7321b136.png)