Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Update your Linux system

By updated

Improve this page

To update all the software on your Linux system, two commands are enough: sudo apt update && sudo apt upgrade (Debian/Ubuntu) or sudo dnf upgrade (RHEL/Fedora). This guide explains why updates matter, how to apply them and when a reboot is needed. It assumes you know how to install and remove software with your distribution's package manager.

What you will learn

  • Why updates are essential for security
  • The difference between update and upgrade
  • Apply updates with apt and dnf
  • Know when a reboot is needed
  • Check the available updates before applying them

Why should you update your system?

Updates fix three kinds of problems, and the risk of ignoring them is not the same for each:

Kind of updateWhat it fixesRisk if ignored
SecurityKnown vulnerabilities (CVE)System exploitable remotely
Bug fixSoftware malfunctionsInstability, crashes
FeaturesNew capabilitiesNo immediate risk

Security updates are the ones not to postpone. When a flaw is found in a piece of software, the distribution publishes a fix in its repositories. As long as you do not apply it, your system stays vulnerable.

What is the difference between update and upgrade?

On Debian/Ubuntu systems, update and upgrade are often confused. They are two distinct steps, and only the second one changes software:

CommandWhat it doesChanges software?
apt updateDownloads the list of available versionsNo
apt upgradeInstalls the new versionsYes

Think of apt update as browsing the catalogue of a shop, and apt upgrade as buying the items. Running apt upgrade without having run apt update is therefore like buying from an outdated catalogue.

This distinction does not exist everywhere. On RHEL and Fedora, there is no command equivalent to apt update: DNF refreshes its metadata (the list of available versions) when it has expired, 48 hours by default. dnf check-update, dnf upgrade and dnf install perform this check, and the --refresh option forces the refresh. dnf check-update lists the available updates; it is not an equivalent of apt update. So you will not find this step in RHEL procedures, and it is not an oversight.

How do you apply updates?

The three steps below always follow the same logic: look at what is waiting, apply it, then check that nothing is left.

  1. Check the available updates:

    Terminal window
    sudo apt update

    The last line of the output gives the number of packages to upgrade and reminds you of the command that displays their list. Tested on Ubuntu Server 26.04.1 (APT 3.2.1, English locale), on November 13, 2026:

    Output (Ubuntu 26.04.1, end of sudo apt update)
    Reading package lists...
    Building dependency tree...
    Reading state information...
    1 package can be upgraded. Run 'apt list --upgradable' to see it.

    To see the details:

    Terminal window
    apt list --upgradable
    Output (Ubuntu 26.04.1)
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    Listing...
    distro-info/resolute-updates 1.15ubuntu0.1 amd64 [upgradable from: 1.15]

    The warning comes from apt itself: its output is meant to be read, not parsed by a script. Each package takes one line, and the origin repository (here resolute-updates) comes right after the name.

  2. Apply the updates:

    Terminal window
    sudo apt upgrade

    APT 3 shows a one-line summary (Summary:) that counts the packages upgraded, installed, removed and left aside, then asks for confirmation with Continue? [Y/n]. Read this summary before answering: a package to be removed deserves a look. Enter or Y confirms, n cancels. The prompt shown here is the one of an English locale; on a system set to French, its text may differ, but its meaning is the same.

    In the Ubuntu 26.04.1 example, the only pending package was not installed, and the output says so:

    Output (Ubuntu 26.04.1, end of sudo apt upgrade)
    Calculating upgrade...
    Not upgrading yet due to phasing:
    distro-info
    Summary:
    Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 1

    Ubuntu rolls out some updates in stages (phasing): the package shows up in apt list --upgradable, but apt upgrade defers it for this machine. This is not a failure: the update goes out to a growing number of machines, and apt upgrade installs it as soon as the rollout reaches yours. Security updates are never deferred this way.

  3. Check that everything is up to date:

    Terminal window
    sudo apt update && apt list --upgradable

    On an up-to-date system, apt list --upgradable shows no package, only the Listing... line and the apt warning:

    Output (Debian 13, after apt update, system up to date, 2026-11-13)
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    Listing...

    A package still listed after apt upgrade is not necessarily a failure: this is the case of the package deferred by the phasing seen in step 2.

How do you apply security updates only?

Sometimes you want to apply only the security fixes, without updating features. The two families do not handle this the same way:

Terminal window
apt list --upgradable 2>/dev/null | grep -- '-security'

The filter looks for the text -security in each line. On Ubuntu, a security fix comes from a repository whose name ends in -security, and the command returns one line per package. On Ubuntu 26.04.1 (November 13, 2026), the only pending package came from resolute-updates: the command returned no line. On Debian 13, no package was pending and the result was empty too. An empty result means "no pending package from a security repository", not "the command is broken". On Debian, look at the repository name shown in apt list --upgradable: the filter only works if it ends in -security.

Another form circulates widely, apt upgrade -s | grep -i security, and it is misleading for two reasons.

The first comes from the -s option, which simulates the upgrade: it displays one Inst line then one Conf line for each package, plus a summary line. The number of lines therefore does not count the security packages. When nothing is to be installed, the simulation returns neither an Inst nor a Conf line.

The second is sneakier. This grep works on free text, not on the origin repository: any package whose name contains "security" passes the filter, whether it brings a security fix or not.

The form given above, which filters on -security, aims better, but it also keeps any line that contains "-security", including a package whose name contains that word. Some exist: debian-security-support, libapache2-mod-security2 or python3-flask-security appear in the Debian 13 and Ubuntu 26.04 repositories (apt-cache search --names-only -- -security lists them). Take this form as an overview, not as a reliable count.

To install only these fixes, APT has no equivalent of DNF's --security: you have to go through unattended-upgrades, whose configuration only keeps the security source. The guide apply security updates shows this configuration.

When do you need to reboot?

Many updates apply without a reboot. But some cases require one:

UpdateReboot needed?
Ordinary application (curl, vim...)No
System library (libc, openssl)Recommended (services to restart)
Linux kernelYes, to switch to the new kernel

How do you know whether a reboot is needed?

Each family gives a direct answer, without having to guess from the list of updated packages:

If the /var/run/reboot-required file exists, a reboot is needed:

Terminal window
cat /var/run/reboot-required 2>/dev/null || echo "No reboot needed"

If the file exists, cat displays its content, a message that asks for the reboot. Otherwise, the command displays the fallback sentence:

Output (Ubuntu 26.04.1, no kernel installed since boot)
No reboot needed

On Debian, the absence of this file guarantees nothing: only the packages whose install script asks for it create it. The Debian Policy describes it in section 9.12. On Ubuntu, the update-notifier-common package takes care of it; dpkg -l update-notifier-common tells you whether it is installed (it was not on the Ubuntu 26.04.1 tested on November 13, 2026). Without it, the fallback message proves only one thing: the file is absent.

To reboot:

Terminal window
sudo reboot

One last point, about method more than technique: on a production server, a reboot is planned in an announced maintenance window. Never restart a production machine without warning the team, even for an urgent fix: other services may depend on it without that showing anywhere on the machine itself.

Which update routine should you follow?

For a workstation or a test server, adopt this simple routine:

Terminal window
sudo apt update && sudo apt upgrade -y

The -y option answers "yes" to the confirmation automatically. Use it only when you trust the updates (workstation, lab).

The following table gives an editorial opinion, not a rule set by APT, DNF or a distribution: adapt it to how the machine is used.

ContextRecommended pace
Workstation, labRegularly, for example every week
Server exposed to the InternetSecurity updates without waiting, preferably automatic
Production serverIn a maintenance window

Troubleshooting

An update usually fails for one of these reasons: another package manager is already running and holds the lock, a repository no longer answers or no longer exists, or a dependency conflict leaves the system half-way. Running the same command again fixes none of the three: find in the table the line that matches your message before insisting. For a dependency conflict that resists, the guide fix broken dependencies details the cases.

SymptomLikely causeFix
Could not get lock /var/lib/dpkg/lock-frontendAnother manager is runningWait, or check with ps aux | grep apt
The repository no longer has a Release fileRepository obsolete or removedRemove that repository from /etc/apt/sources.list.d/
Broken packagesDependency conflictsudo apt --fix-broken install
Error: Failed to download metadata (DNF message)Network problem or repository downCheck the connection, try again
Kernel updated without a rebootOld kernel still runningReboot with sudo reboot

Key points

  • apt update refreshes the list; apt upgrade installs the new versions. Both are needed.
  • dnf upgrade refreshes its metadata by itself when it has expired, then installs: there is no equivalent of apt update.
  • Security updates come first: do not postpone them.
  • A reboot is needed after a kernel update, and recommended after a system library update.
  • Automate security updates on exposed servers, as the guide apply security updates explains.
  • On a production server, update in a maintenance window.

Knowledge check

Check that the essentials of this guide stuck. The questions cover only what has just been explained here.

Knowledge check

Check what you have learned with this interactive quiz

6 questions
6 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer