Kahibaro
Discord Login Register

System upgrades

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:

System upgrades can:

Most distributions distinguish between:

Exact naming and commands differ by distribution, but the concepts are consistent.

General Best Practices Before Upgrading

Regardless of your distribution:

  1. 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”.
  2. 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 screen or tmux so the upgrade continues if your connection drops.
  3. Check available disk space
    • Use df -h to ensure you have enough free space, especially on / and /var.
    • On some systems you can also check the package cache size in /var/cache.
  4. 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.
  5. 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:

bash
sudo apt update

This downloads the latest list of available package versions from your repositories.

Step 2: Apply upgrades

Two common commands:

bash
  sudo apt upgrade
bash
  sudo apt full-upgrade

or on older systems:

bash
  sudo apt dist-upgrade

For a typical desktop, you can regularly use:

bash
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:

bash
  sudo do-release-upgrade
bash
  sudo do-release-upgrade -d   # when upgrading to a development release or early

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:

bash
sudo apt autoremove
sudo apt clean

DNF (Fedora/RHEL family)

Step 1: Refresh metadata and upgrade

dnf updates its metadata automatically as needed, so you typically use:

bash
sudo dnf upgrade

or equivalently:

bash
sudo dnf update

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):

  1. Install the system upgrade plugin:
bash
   sudo dnf install dnf-plugin-system-upgrade
  1. Download packages for the target release:
bash
   sudo dnf system-upgrade download --releasever=40
  1. When downloading is complete, reboot into the upgrade:
bash
   sudo dnf system-upgrade reboot

For RHEL/CentOS/Alma/Rocky, major version upgrades usually follow distribution-specific tools and guides; always refer to official documentation.

Cleaning up

Common cleanup commands:

bash
sudo dnf autoremove
sudo dnf clean all

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:

bash
sudo pacman -Syu

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:

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:

bash
sudo paccache -r     # remove old versions, keep a few recent ones

To remove all cached packages (more aggressive):

bash
sudo pacman -Scc

Be 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:

Strategies:

bash
    sudo apt --fix-broken install
bash
    sudo dnf distro-sync

to make installed versions match repository versions.

Partially completed upgrades

Causes: interrupting an upgrade, power loss, full disk.

General steps:

  1. Free up disk space if that was the cause.
  2. Run the standard upgrade command again:
    • sudo apt full-upgrade
    • sudo dnf upgrade
    • sudo pacman -Syu
  3. 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:

Tips for beginners:

Safe Upgrade Habits for Beginners

To keep things manageable as a new user:

  1. Update regularly, but not obsessively
    • Desktop: every few days or at least once a week.
    • Servers: align updates with maintenance windows; prioritize security updates.
  2. Avoid mixing package sources unnecessarily
    • Extra third-party repositories increase the chance of conflicts.
    • Prefer official or well-documented repositories.
  3. 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.
  4. 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.
  5. 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:

Combine these commands with:

and you’ll be able to keep your Linux system secure, current, and stable.

Views: 27

Comments

Please login to add a comment.

Don't have an account? Register now!