Table of Contents
Understanding System Upgrades
In the context of package management, “system upgrades” means updating all or most installed packages to newer versions, often including the kernel and core libraries. This is different from:
- Installing a single new package
- Updating one package at a time
System upgrades can:
- Deliver security fixes
- Add new features
- Remove or replace obsolete packages
- Change configuration defaults
Most distributions distinguish between:
- Regular updates: Security and bug-fix updates, usually safe and small.
- Distribution upgrades: Moving to a new major release or snapshot (e.g. Ubuntu 22.04 → 24.04), which is larger and more disruptive.
Exact naming and commands differ by distribution, but the concepts are consistent.
General Best Practices Before Upgrading
Regardless of your distribution:
- Backup important data
- At least back up your home directory and configuration files you’ve customized (often in
/etc). - On servers or critical systems, use an actual backup strategy (covered elsewhere) rather than relying on “it usually works”.
- Ensure a stable environment
- Plug in laptops; don’t run major upgrades on low battery.
- Avoid hard power-offs during upgrades.
- On remote systems (SSH), consider using
screenortmuxso the upgrade continues if your connection drops. - Check available disk space
- Use
df -hto ensure you have enough free space, especially on/and/var. - On some systems you can also check the package cache size in
/var/cache. - Read what will change
- Most tools show:
- Packages to upgrade
- Packages to install (new dependencies)
- Packages to remove
- For bigger changes (desktop environments, kernels, drivers), read the summary carefully.
- Watch for configuration file prompts
- If a configuration file has changed upstream and you’ve modified it locally, tools will often ask:
- Keep your version
- Use the new maintainer’s version
- Show differences
- On a beginner desktop system, you can usually keep your configuration unless advised otherwise by distribution documentation.
System Upgrade Workflows by Package Manager
This section assumes you already know the basics of APT, DNF, and Pacman from earlier chapters, and focuses only on their use for system-wide upgrades.
APT (Debian/Ubuntu and derivatives)
Step 1: Refresh package lists
Always refresh before upgrading:
sudo apt updateThis downloads the latest list of available package versions from your repositories.
Step 2: Apply upgrades
Two common commands:
- Safe upgrade (no removals, minimal changes):
sudo apt upgrade- Upgrades installed packages where possible.
- Won’t remove packages or install large new ones that change dependencies heavily.
- Full upgrade (may remove/replace packages):
sudo apt full-upgradeor on older systems:
sudo apt dist-upgrade- Resolves complex dependency changes.
- May remove or replace packages.
- Often necessary for kernel and major desktop updates.
For a typical desktop, you can regularly use:
sudo apt update
sudo apt upgrade
and use full-upgrade when the system suggests it (e.g., large changes, kernel transitions).
Distribution release upgrades (Ubuntu/Debian major version)
Moving between major versions (e.g. Ubuntu 22.04 → 24.04, Debian 11 → 12) isn’t done with just upgrade. Different tools are used:
- Ubuntu (desktop):
sudo do-release-upgrade- Ubuntu (server/headless):
sudo do-release-upgrade -d # when upgrading to a development release or early- Debian: Usually by editing
/etc/apt/sources.listto the new codename and then doing a series ofupdateandfull-upgradesteps (follow official release notes).
Always read the official release notes before a distribution upgrade; they list known issues and manual steps.
Cleaning up after upgrades
To free space and remove leftover packages:
sudo apt autoremove
sudo apt cleanautoremoveremoves automatically installed packages that are no longer needed.cleanclears package caches, freeing disk space.
DNF (Fedora/RHEL family)
Step 1: Refresh metadata and upgrade
dnf updates its metadata automatically as needed, so you typically use:
sudo dnf upgradeor equivalently:
sudo dnf update- Upgrades all packages to the latest versions available in enabled repositories.
- May install/remove packages to satisfy dependencies.
On Fedora, this command is used both for regular updates and for large updates within the same release.
Distribution upgrades (Fedora release version)
For moving between Fedora releases (e.g. 39 → 40):
- Install the system upgrade plugin:
sudo dnf install dnf-plugin-system-upgrade- Download packages for the target release:
sudo dnf system-upgrade download --releasever=40- When downloading is complete, reboot into the upgrade:
sudo dnf system-upgrade rebootFor RHEL/CentOS/Alma/Rocky, major version upgrades usually follow distribution-specific tools and guides; always refer to official documentation.
Cleaning up
Common cleanup commands:
sudo dnf autoremove
sudo dnf clean allautoremoveremoves packages no longer needed.clean allclears cached metadata and packages.
Pacman (Arch Linux and derivatives)
Because Arch Linux is rolling-release, system upgrades are central to using the system.
Step 1: Sync and upgrade
This command both refreshes package lists and upgrades the system:
sudo pacman -Syu-S= sync-y= refresh package databases-u= upgrade out-of-date packages
On Arch, partial upgrades (updating only some packages) are not supported. Always do full system upgrades when upgrading.
On some Arch derivatives, graphical tools may wrap pacman, but the underlying mechanism is the same.
Reading Arch news
Because of its rolling nature, Arch sometimes requires manual steps during upgrades. Before running pacman -Syu, you’re expected to:
- Check the Arch news page for recent announcements.
- Apply any manual interventions they describe.
Ignoring these can result in broken upgrades.
Cleaning the cache
Pacman keeps a cache of old package versions. To manage cache size, use paccache from pacman-contrib:
sudo paccache -r # remove old versions, keep a few recent onesTo remove all cached packages (more aggressive):
sudo pacman -SccBe cautious: clearing all cache means you can’t easily downgrade to previous versions via cache.
Recognizing and Handling Common Upgrade Issues
Even on well-designed distributions, upgrades can sometimes cause problems. Some issues beginners are most likely to see:
Broken or missing dependencies
Symptoms:
- Upgrade command fails with messages about:
- “broken packages”
- “unmet dependencies”
- “conflicting packages”
Strategies:
- APT:
- Try:
sudo apt --fix-broken install- DNF:
- Often suggests exact commands to resolve conflicts.
- You can also try:
sudo dnf distro-syncto make installed versions match repository versions.
- Pacman:
- Check the exact error message.
- Often requires uninstalling or rebuilding conflicting packages; consult distribution documentation or forums if unsure.
Partially completed upgrades
Causes: interrupting an upgrade, power loss, full disk.
General steps:
- Free up disk space if that was the cause.
- Run the standard upgrade command again:
sudo apt full-upgradesudo dnf upgradesudo pacman -Syu- Follow any repair instructions shown.
Don’t ignore repeated error messages; copy them and search documentation or ask for help if needed.
Configuration file changes
During upgrades, you might see prompts such as:
- “A new version of
/etc/…is available.” - Options:
- Keep the local version currently installed
- Use the package maintainer’s version
- Show differences
- Install a new version and keep the old as a backup
Tips for beginners:
- For configuration files you haven’t manually edited, it’s usually safe to accept the maintainer’s version.
- For files you have edited, a conservative choice is to keep your version, then compare with the new example file (often saved with a suffix like
.dpkg-distor.rpmnew).
Safe Upgrade Habits for Beginners
To keep things manageable as a new user:
- Update regularly, but not obsessively
- Desktop: every few days or at least once a week.
- Servers: align updates with maintenance windows; prioritize security updates.
- Avoid mixing package sources unnecessarily
- Extra third-party repositories increase the chance of conflicts.
- Prefer official or well-documented repositories.
- Reboot after kernel or low-level library upgrades
- Especially when kernels, graphics drivers, or system libraries are updated.
- Some tools (like Ubuntu’s GUI update manager) will tell you when a reboot is recommended.
- Keep a record of major upgrades
- When you do a distribution release upgrade, note:
- Date
- Source and target versions
- Any manual commands run
- This can help troubleshooting later.
- Read distribution-specific guidance
- Many distributions provide:
- Release notes
- Upgrade guides
- Known issues pages
Spending a few minutes with those documents can save hours of repair work later.
Summary
For system upgrades:
- APT (Debian/Ubuntu):
sudo apt update && sudo apt upgrade(andsudo apt full-upgradewhen needed). - DNF (Fedora/RHEL):
sudo dnf upgrade. - Pacman (Arch):
sudo pacman -Syu.
Combine these commands with:
- Backups
- Enough disk space
- Careful reading of what will be changed
- Attentive handling of configuration file prompts
and you’ll be able to keep your Linux system secure, current, and stable.