CachyOS Package Management - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
CachyOS Package Management Guide
Complete beginner-friendly guide to managing packages on CachyOS using pacman, AUR helpers, and package repositories.
Table of Contents
- Understanding Package Management
- Using pacman (Package Manager)
- AUR (Arch User Repository)
- AUR Helpers (yay, paru)
- Package Repositories
- Troubleshooting Package Issues
- Best Practices
Understanding Package Management
What is Package Management?
Package management is the process of installing, updating, and removing software on your system.
What is a package?
- Package: A compressed archive containing software and its files
- Contains: Program files, configuration files, documentation, dependencies
- Purpose: Makes installing software easy and organized
Why package management matters:
- Easy installation: Install software with one command
- Dependency handling: Automatically installs required libraries
- Updates: Easy to update all software at once
- Removal: Cleanly removes software and its files
- Security: Packages are verified and signed
CachyOS package management:
- Primary tool:
pacman(Package Manager) - Repositories: Official CachyOS repositories (optimized packages)
- AUR: Arch User Repository (community packages)
- Helpers: yay, paru (make AUR easier to use)
Using pacman (Package Manager)
What is pacman?
pacman (Package Manager) is the official package manager for CachyOS and Arch Linux.
What it does:
- Installs, updates, and removes packages
- Manages dependencies automatically
- Syncs with package repositories
- Verifies package integrity
Basic pacman Commands
Update Package Database
Before installing packages, update the package database (use -Syu for full update):
# Always use -Syu together to avoid dependency issues
sudo pacman -Syu
What this command does:
sudo: Administrator privileges (needed for system changes)pacman: Package manager command-S: Sync (download package database)y: Refresh package database
What is a package database?
- Package database: List of available packages and versions
- Why update: Gets latest package information from servers
- When to run: Before installing new packages, or regularly
Update database and upgrade packages:
sudo pacman -Syu
What this does:
-S: Sync package databasey: Refresh package databaseu: Upgrade installed packages
Full system update (recommended):
sudo pacman -Syu
What happens:
- Downloads latest package database
- Compares with installed packages
- Downloads and installs updates
- Updates system to latest versions
Search for Packages
Search for a package by name:
pacman -Ss package-name
What this command does:
pacman: Package manager-Ss: Search in package databasepackage-name: What to search for
Example:
pacman -Ss firefox
Example output:
extra/firefox 120.0-1
Standalone web browser from mozilla.org
extra/firefox-i18n-en-us 120.0-1
English (US) language pack for Firefox
What the output means:
- extra/firefox: Package name and repository
- 120.0-1: Version number
- Description: What the package is
Search in installed packages only:
pacman -Qs package-name
What this does:
-Qs: Search in installed packages- Shows only packages you have installed
Install Packages
Install a single package:
sudo pacman -S package-name
What this command does:
-S: Sync (install) package- Downloads package from repository
- Installs package and dependencies
- Configures package on system
Example:
sudo pacman -S firefox
What happens:
- Checks package database
- Finds Firefox package
- Downloads Firefox and dependencies
- Installs files to system
- Configures Firefox
Install multiple packages:
sudo pacman -S package1 package2 package3
Example:
sudo pacman -S firefox vlc gimp
Install from specific repository:
sudo pacman -S extra/firefox
What this does:
extra/firefox: Specifies repository and package- Useful if multiple packages have same name
Remove Packages
Remove a package:
sudo pacman -R package-name
What this command does:
-R: Remove package- Removes package files
- Keeps configuration files
Example:
sudo pacman -R firefox
Remove package and dependencies:
sudo pacman -Rs package-name
What this does:
-Rs: Remove package and unused dependencies-s: Remove dependencies not needed by other packages- Useful: Cleans up unused packages
Remove package, dependencies, and config files:
sudo pacman -Rns package-name
What this does:
-Rns: Remove package, dependencies, and config files-n: Remove configuration files too- Warning: Deletes your settings for that package
List Installed Packages
List all installed packages:
pacman -Q
What this does:
-Q: Query installed packages- Shows all packages you have installed
List packages with descriptions:
pacman -Qe
What this does:
-Qe: Query explicitly installed packages- Shows packages you installed (not dependencies)
Show package information:
pacman -Qi package-name
What this does:
-Qi: Query information about package- Shows version, description, dependencies, etc.
Example output:
Name : firefox
Version : 120.0-1
Description : Standalone web browser from mozilla.org
Architecture : x86_64
URL : https://www.mozilla.org/firefox/
Licenses : MPL 2.0
Groups : None
Provides : None
Depends On : gtk3 libxt mime-types dbus-glib ...
Optional Deps : ...
Required By : None
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 200.00 MiB
Upgrade System
Upgrade all packages:
sudo pacman -Syu
What this does:
- Updates package database
- Upgrades all installed packages
- Installs latest versions
Check what would be updated (without updating):
pacman -Qu
What this does:
-Qu: Query packages that need updating- Shows what would be updated
- Doesn't actually update
Clean Package Cache
Package cache stores downloaded package files.
View cache size:
du -sh /var/cache/pacman/pkg
What this does:
du -sh: Shows directory size/var/cache/pacman/pkg: Package cache location- Shows how much space cache uses
Clean old package versions:
sudo pacman -Sc
What this does:
-Sc: Clean package cache- Removes old package versions
- Keeps current versions
Clean all cached packages:
sudo pacman -Scc
What this does:
-Scc: Clean all cached packages- Removes all downloaded packages
- Warning: Will need to re-download packages next time
AUR (Arch User Repository)
What is AUR?
AUR (Arch User Repository) is a community-maintained repository of package build scripts.
What it is:
- Not a repository: It's a collection of build scripts (PKGBUILDs)
- Community-maintained: Users create and maintain packages
- Not official: Not maintained by CachyOS/Arch team
- Use at your own risk: Review packages before installing
Why AUR exists:
- More packages: Thousands of packages not in official repos
- Latest versions: Often has newer versions than official repos
- Specialized software: Niche or specialized applications
- Community contributions: Users share their packages
How AUR works:
- User creates PKGBUILD (build script)
- Uploads to AUR
- Others can download and build
- You build package locally
- Install with pacman
Using AUR Manually
Search AUR:
- Visit: https://aur.archlinux.org/
- Search for packages
- View PKGBUILD files
Install from AUR manually:
# Clone AUR package
git clone https://aur.archlinux.org/package-name.git
cd package-name
# Build and install
makepkg -si
What this does:
git clone: Downloads package build scriptcd: Changes to package directorymakepkg -si: Builds and installs package-s: Install dependencies-i: Install package after building
Manual process is tedious, so use AUR helpers instead.
AUR Helpers (yay, paru)
What are AUR Helpers?
AUR helpers are tools that make using AUR easier.
What they do:
- Search AUR packages
- Download and build packages
- Install packages automatically
- Handle dependencies
- Update AUR packages
Popular AUR helpers:
- yay: Yet Another Yaourt (most popular)
- paru: Fast AUR helper written in Rust
- pikaur: AUR helper with minimal dependencies
Installing yay
yay is the most popular AUR helper.
Install yay:
# Clone yay repository
git clone https://aur.archlinux.org/yay.git
cd yay
# Build and install
makepkg -si
What this does:
- Downloads yay from AUR
- Builds yay package
- Installs yay on your system
After installation:
- yay is available in your terminal
- Can use it like pacman
Using yay
Search AUR packages:
yay package-name
What this does:
- Searches AUR for package
- Shows matching packages
- Lets you choose which to install
Example:
yay visual-studio-code-bin
Install from AUR:
yay -S package-name
What this does:
-S: Install package (same as pacman)- Downloads from AUR
- Builds package
- Installs package
Update AUR packages:
yay -Sua
What this does:
-Sua: Update AUR packages only- Updates packages installed from AUR
- Doesn't update official packages
Update everything (official + AUR):
yay -Syu
What this does:
- Updates official packages (pacman)
- Updates AUR packages (yay)
- One command updates everything
Remove AUR package:
yay -Rns package-name
Same as pacman - removes package and dependencies.
Installing paru
paru is a fast AUR helper written in Rust.
Install paru:
# Clone paru repository
git clone https://aur.archlinux.org/paru.git
cd paru
# Build and install
makepkg -si
Using paru:
- Same commands as yay
paru -S package-nameto installparu -Syuto update everything
paru advantages:
- Faster than yay (written in Rust)
- Better dependency resolution
- More features
Package Repositories
What are Repositories?
Repositories are servers that store packages.
CachyOS repositories:
- core: Essential system packages
- extra: Additional software
- community: Community-maintained packages
- multilib: 32-bit packages (for 64-bit systems)
Repository Configuration
Repository configuration file:
sudo nano /etc/pacman.conf
What this file does:
- Configures which repositories to use
- Sets repository priorities
- Configures package signing
Example configuration:
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
What this means:
- Each section is a repository
Includepoints to mirror list (download servers)- Packages from these repos are available
Mirror Configuration
Mirror list contains download servers.
Edit mirror list:
sudo nano /etc/pacman.d/mirrorlist
What this file does:
- Lists package download servers
- pacman uses fastest server
- Can prioritize specific servers
Example:
Server = https://mirror.cachyos.org/repo/x86_64/cachyos
Server = https://mirror.example.com/repo/x86_64/cachyos
Rank mirrors by speed:
sudo pacman-mirrors -c United_States
What this does:
- Tests mirror speeds
- Ranks by download speed
- Updates mirror list
Troubleshooting Package Issues
Common Problems
Package Not Found
Error:
error: target not found: package-name
Solutions:
-
Update package database (use -Syu to avoid dependency issues):
sudo pacman -Syu -
Check package name:
pacman -Ss package-name -
Check if in AUR:
yay package-name
Dependency Conflicts
Error:
error: failed to prepare transaction (conflicting files)
What this means:
- Two packages want to install same file
- Package conflicts with installed package
Solutions:
-
Remove conflicting package:
sudo pacman -R conflicting-package -
Force installation (not recommended):
sudo pacman -S --overwrite package-name
Broken Packages
Error:
error: failed to commit transaction (invalid or corrupted package)
Solutions:
-
Clean package cache:
sudo pacman -Sc -
Update package database (use -Syu to avoid dependency issues):
sudo pacman -Syu -
Reinstall package:
sudo pacman -S package-name
Signature Errors
Error:
error: package-name: signature from "..." is unknown trust
Solutions:
-
Update keyring:
sudo pacman-key --refresh-keys -
Initialize keyring:
sudo pacman-key --init sudo pacman-key --populate archlinux
Best Practices
Regular Updates
Update regularly:
sudo pacman -Syu
Why:
- Security updates
- Bug fixes
- New features
- System stability
How often:
- Weekly: Recommended for most users
- Before major changes: Always update first
- After long time: Update before installing new packages
Backup Before Updates
Before major updates:
- Backup important files
- Note current package versions
- Have recovery plan
Read Update Announcements
Check for:
- Breaking changes
- Manual intervention needed
- Configuration changes
Where to check:
- CachyOS forum
- Arch Linux news
- Package changelogs
Use Official Repositories First
Prefer official repos:
- More reliable
- Better maintained
- Security updates
- Use AUR only when needed
Review AUR Packages
Before installing from AUR:
- Check package page
- Read comments
- Review PKGBUILD
- Check last update date
Keep System Clean
Regular maintenance:
# Remove unused packages
sudo pacman -Rns $(pacman -Qtdq)
# Clean package cache
sudo pacman -Sc
What this does:
- Removes orphaned packages (dependencies no longer needed)
- Cleans old package cache
- Frees up disk space
Additional Resources
- CachyOS Getting Started Guide - System overview
- CachyOS Post-Installation Guide - Essential setup
- Arch Linux Wiki: https://wiki.archlinux.org/title/Pacman
- AUR Website: https://aur.archlinux.org/
Summary
This guide covered:
- Understanding package management - What packages are and why they matter
- Using pacman - Installing, updating, removing packages
- AUR - Arch User Repository for community packages
- AUR helpers - yay and paru for easier AUR usage
- Repositories - Understanding package sources
- Troubleshooting - Common issues and solutions
- Best practices - Maintaining your system
Key Takeaways:
- Use
pacman -Syuregularly to update system - Use
yayorparufor AUR packages - Always backup before major updates
- Prefer official repositories when possible
- Review AUR packages before installing
- Keep system clean with regular maintenance
This guide is based on the CachyOS Wiki and Arch Linux Wiki and expanded with detailed explanations for beginners. For the most up-to-date package management information, always refer to the official documentation.