Debian

How do I check for updates on Debian 11?

This tutorial shows how to check for updates on Debian 11 using the aptitude and apt commands.

After reading this tutorial, you’ll know how to easily check for updates on Debian 11 and how to keep your system up to date. This tutorial also explains how to use the cron-apt tool for the system to check for updates automatically.

Checking for updates on Debian 11 using apt:

Before checking for available updates on Debian 11 using apt, you need to check your repositories for the last software versions. You can use the apt command followed by the update option as depicted in the screenshot below.

sudo apt update

Then, you can fully upgrade your system, or you can read the available updates. To print available updates (optional) before upgrading, run the command below.

sudo apt list --upgradable

Finally, to upgrade your system run apt followed by the –upgrade option as shown below. You will be asked for confirmation. To confirm, press Y. You also can confirm when launching the command.

sudo apt upgrade

To confirm the upgrade when launching the command, avoid confirmation; add the -y option below.

sudo apt upgrade -y

As you can see, by implementing -y the upgrade process started without requesting confirmation.

Checking for updates on Debian 11 using aptitude:

The first section of this tutorial explains how to upgrade your Debian 11 system using aptitude.

First, check the packages list by running aptitude followed by the update option, as shown in the screenshot below.

sudo aptitude update

Then you can run aptitude followed by the full-upgrade option to upgrade your system and software.

sudo aptitude full-upgrade

As you can see, in my case, the system is already upgraded (I wrote the apt instructions before aptitude), so no packets are upgraded in this specific case.

Upgrading Debian 11 using aptitude in an interactive mode:

The aptitude packages manager features an interactive mode. You can update your packages list by running the command below.

sudo aptitude -u

In the screenshot below, the root password is requested because aptitude -u was executed without sudo.

If requested, fill in your password.

And the packages list will start getting updated, as shown below.

If new updates are available for your packages, you’ll see Upgradable Packages at the top of the list, as shown in the screenshot below. Press the key U to select updates to install.

Once the updates are selected, press the key g to install the updates.

As you can see in the screenshot below, the update process will start.

As you can see, the update process was done correctly.

The aptitude command vs. apt:

All aptitude and apt or apt-get are frontends for the dpkg command. Additionally to the command line functions, aptitude features a ncurses based interactive mode you can launch by running aptitude without additional options. The screenshot below shows interactive aptitude mode similar to a synaptics text mode version.

Most Debian-based Linux distributions use the apt command for its simplicity, while aptitude remains a good terminal option for users who don’t like to deal with commands.

Automatically updating Debian 11 using cron-apt:

The cron-apt tool allows your system to automatically check for updates on Debian 11 and based Linux distributions. To install it, use the apt command as shown in the screenshot below.

sudo apt install cron-apt

As you can see by reading the configuration file /etc/cron.d/cron-apt, by default, cron-apt is scheduled to run every day at 4:00 am. You can edit this time by opening the file /etc/cron.d/cron-apt using nano, as shown below.

sudo nano /etc/cron.d/cron-apt

Once you make the changes you want, exit nano-saving changes (Ctrl+X).

Now, let’s enable security updates by creating (using sudo) the file /etc/apt/sources.list.d/security.list as shown below.

sudo nano /etc/apt/sources.list.d/security.list

Copy the following content within the file you just created.

deb http://deb.debian.org/debian-security/ bullseye-security main

deb-src http://deb.debian.org/debian-security/ bullseye-security main

Now create the file /etc/cron-apt/action.d/4-security as shown below.

sudo nano /etc/cron-apt/action.d/4-security

Copy the following line as shown in the screenshot below.

upgrade -d -y -o APT::Get::Show-Upgraded=true

Then exit nano saving changes.

Now create the file /etc/cron-apt/config.d/4-security using the command below.

sudo nano /etc/cron-apt/config.d/4-security

Copy the following code into the file you just created.

OPTIONS="-o quiet=1 -o APT::Get::List-Cleanup=false -o Dir::Etc::SourceList=/etc/apt/sources.list.d/security.list -o Dir::Etc::SourceParts="/dev/null""

Exit nano saving changes. Now your system will update automatically.

Conclusion:

Checking for updates on Debian 11 is a mandatory task any user must execute periodically and always when installing new software from repositories. As you can see, checking for updates is pretty simple. A task any Linux user, independently of his level, can carry out. Linux offers different package managers and ways to upgrade your systems, such as apt, apt-get, aptitude, and synaptics. Automatic updates may be a great option to keep Debian 11 up to date. As you see, implementing automatic updates with cron-apt is also really easy.

Thank you for reading this tutorial showing how to check for updates on Debian 11. Keep following Linux Hint for additional Linux tips and tutorials.

About the author

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.