“sudo apt full-upgrade” Command Explained for Beginners

This article is all about demystifying the “sudo apt full-upgrade” command by learning what it does and how it does it!

For those of you in a hurry, here is the “Short Version” of the answer!

sudo apt full-upgrade: In a Nutshell!

The full-upgrade command is

  • used to update the software on our systems
  • this update is usually done when we need to take our distro from one version to another (for example from Ubuntu 23.04 to Ubuntu 23.10)
  • during this update, apt is free to remove any packages as it sees fit and hence caution is needed while using this command!

The 3 points above can be compiled into a short and “jargon-heavy” answer as follows:

The “sudo apt full-upgrade  command is used to download and apply any available updates to your software packages. During this process, if needed previously installed packages are removed to make the upgrade to the next version of the distribution.

The reason why full-upgrade can require caution is explained in more detail later on in the article where the following questions are addressed

  • Why full-upgrade needs caution?
  • How to prevent broken packages when using full-upgrade?
  • Why do we even have full-upgrade if it is not so safe?

You can jump to the section of interest using the table of contents below.

Also, don’t worry if the above answer does not make sense to you as that was targeted at more experienced programmers who just wanted to refresh their memories. The rest of this article is dedicated to those of you in the first steps of your journey to becoming a Linux Expert!

By the time you reach the end of this article, I suggest you come back and read this summary once more, I assure you it will make much more sense then!

When I was a complete beginner and I needed to install something on my Ubuntu machine, I went online and typed in “How to install <software name> on Ubuntu” and it usually led me to a page with some commands which looked like this

sudo apt update
sudo apt upgrade
sudo apt install <software name>

I was just happy that I was able to type something in the Terminal and see it actually working!

I did not pay much attention to what I actually typed in. I guess to beginners, it just feels like a magic spell to get our favorite software installed!

As time went on, so many of my Google searches led to using very similar patterns of “apt update” and “apt upgrade” commands to install stuff and my curiosity got the better of me, which inspired me to learn what these commands do and what happens in the background when you execute these commands.

I decided to put together everything I learned into an “easy-to-digest” article so that it can be useful for beginners!

Without further ado, let’s begin!

The Fundamentals

Let us start with the following question.

How Do Commands Work?

For those of you who love learning via videos, here is a video we made to the answer to the question above!

If you are looking for some quiet reading time, then skip the video and read on!

Nowadays we are all used to applications with fancy graphical user interfaces, with buttons to click and forms to enter data.

But back in the era when graphics hardware was not capable enough to handle fancy graphical user interfaces, people interacted with the computers with simple text-based commands.

This interface is called the Command Line Interface (CLI)

The structure of these “text-based commands” usually looks like this

<software name> <option to click inside software>

If apt were a modern-day application, its interface will likely look something like this

So when you type in the terminal

sudo apt update

what you are doing is opening an application named apt and clicking the button named update!

So next time you look at any Linux command don’t let all the jargon overwhelm you as it’s just an app with some buttons!

Before looking at what happens when you click on the update and upgrade buttons, let us first learn how apps are managed in a Linux system with apt.

What is apt and how it works?

If you are a complete beginner I highly recommend reading the article in the link below before continuing with this one.

A Beginners Introduction To Linux Package managers: apt, yum, dpkg & rpm

Let us start our discussion by answering the following question.

What is apt?

APT stands for Advanced Packaging Tool, which is a tool used to manage apps a.k.a “software packages” that are installed in our system.

The words “manage” above simply refer to these 5 basic tasks

  • install software
  • remove software
  • upgrade software
  • upgrade system and
  • book-keeping/maintaining the list of software installed in our system

Also, it’s worth mentioning that apt is just the improved version of apt-get. apt essentially makes the user experience a little bit better by keeping things simpler. apt-get still has its uses though. If you wish to explore this topic further we have an excellent article on that topic linked below. (you can go ahead and skip the “Nutshell answer” section and start reading from the “Thorough Explanation” section!)

apt vs apt-get: Explained For Beginners!

Coming back to the topic, to understand the role of apt on our systems consider the following analogy.

If your computer is an office and your apps are employees then you can think of apt as the manager who is responsible for the hiring and firing of the employees (apps)

embeddedinventor.com

Now that we know what apt is, it is time to learn how apt works!

How apt works?

Similar to AppStore and PlayStore, Linux apps also come from marketplaces where developers can upload their apps and which are then verified to be free from malware and made ready to be downloaded.

In fact, the very idea of a “centralized location for storing verified software” originated in the world of Linux before it made it to iOS and Android!

These official “app stores” where you can find apps a.k.a “software packages” are called “repositories” in Linux.

apt enables you to keep track of what software is already installed on your system, what versions they are and what are the latest versions available in the market.

An oversimplified version of the apt’s database is presented in the picture below.

Every time we install or delete apps on our systems apt makes sure this database gets updated and maintained so that it portrays the present situation accurately.

Apart from the bookkeeping, apt also enables us to install, delete and update apps that are installed on our system by communicating with repositories in the cloud.

This is of course just the big picture and if you want to get into the nitty-gritty details we have a separate article on that which you can find in the link below!

A Beginners Introduction To Linux Package managers: apt, yum, dpkg & rpm

Now that we understand what apt is and how it works, we are ready to answer the question: what does sudo apt full-upgrade do?

What does apt full-upgrade do?

In essence, when we run the apt full-upgrade command, we are saying to the apt package manager that we trust it to uninstall packages as it deems necessary.

This is what the official description of apt full-upgrade command looks like

As you can see above, apt full-upgrade is a special variation of the apt upgrade command, whose description is shown below.

As you can see, the key difference here between the 2 is the fact that upgrade stops the app update if a removal of any installed package is necessary to perform the update, while full-upgrade has the license to remove any installed package if needed.

But then why have 2 versions?

It has different use-cases

  • apt upgrade is for regular maintenance” while
  • apt full-upgrade is for upgrading the system as a whole.

Example

For example, say we wish to upgrade the Ubuntu version from 22.04 to 22.10. Then in such situations, the packages that came with 22.04 might be obsolete on 22.10 due to the following reasons

  • The developer stopped maintaining this package
  • None of the software in the new release depends on this package
  • The package name has been changed.

Source: linuxbabe.com

Any one of these is a good reason to remove packages from the repos to keep them operating smoothly.

When using apt full-upgrade apt is free to decide whether to keep or remove these packages depending on what it knows about a given package.

Why apt full-upgrade needs caution?

Case#1: Custom Software

One corner case where this might do you more harm than good is when you may have some custom software on your Linux system that may be dependent on the older packages, and these custom software which you have built and installed yourselves might not be known to the apt tool, so removing that package might not be the best thing to do!

Case#2: Dependency Conflicts

Also apt has a smart conflict resolution system, which can delete some packages to satisfy changing dependencies while upgrading. To give you a general idea consider the following example.

Say you have 2 games installed on your PC

  • Angry Birds 1.0
  • Super Mario 1.0

Say your present graphics card driver version is 1.0, and both these games depend on this driver and run fine for now.

Let’s say Angry Birds has been updated to version 2.0 in the latest distro release and this version of Angry Birds needs Graphics card driver version 2.0 to be present.

The repos for the new distro release do not have graphics card v1.0 which is needed by Super Mario v1.0. This creates a conflict of dependency.

Apt‘s smart conflict resolution system might decide to remove graphics card v1.0 as this is not available anymore in new distro releases, but then this might break Super Mario!

A reason why some drivers might stop working in new releases could be the fact that the kernel got updated and with that, the support for old drivers got removed.

Hence, running a full-upgrade might mean you might not be able to play Super Mario anymore as there is no guarantee that Super-Mario-V1.0 will be compatible with graphics card driver v2.0.

Preventing broken packages while using apt full-upgrade

So best practice is to read what packages will be removed before typing Y and pressing the Enter key!

Debian recommends the following 13-step procedure before performing a full upgrade

If you are lucky like me, the “full-upgrade” command might not need to remove any packages as shown in the screenshot below.

In my case, the outputs of both upgrade and full-upgrade commands look the same as there were no package conflicts, and hence no removal was needed!

So long story short: use full-upgrade with caution, especially if you are messing with production servers!

If all you wish to do is regular maintenance, then the right command to use us the apt upgrade command. If you wish to learn more we have an entire article on it, which you can find in the link below!

“sudo apt upgrade” Command Explained For Beginners!

You might ask if full-upgrade is not safe why do we even have this? Why don’t we use apt upgrade all the time instead?

Why do we even have full-upgrade?

Distributions like Ubuntu do not support a single release forever. For example, their LTS (Long Term Support) releases are only good for a 5-year period, which means they will only get security updates for 5 years. At the end of this period, you cannot just do apt upgrade anymore to get the latest fixes.

If you are hosting a website, then running it on a server that is not updated can lead to hackers stealing your data. So if your distro version is near the expiry of its service period, then you have 2 options

  1. set up your server from scratch again using the latest version of your distro or
  2. Do a full-upgrade, this way you do not need to set things up again from scratch all over again!

Ofcourse as mentioned in the previous section do a full backup before performing this else you might end up with a broken system!

If you wish to learn the differences between these 2 commands in more detail you can refer to the article mentioned below.

“apt upgrade vs full-upgrade” Differences Explained For Beginners!

And with that, I will end this article.

Congratulations on making it to the end of the article, not many have the perseverance to do so!

I hope you enjoyed reading this article and found it useful!

Feel free to share it with your friends and colleagues!

If your thirst for knowledge has not been quenched yet, here are some related articles that might spark your interest!

Related Articles

“sudo apt-get install” Command Explained For Beginners!

apt vs apt-get: Explained For Beginners!

A Beginners Introduction To Linux Package managers: apt, yum, dpkg & rpm

Linux Distros That Uses apt commands for Package Management

Photo of author
Editor
Balaji Gunasekaran
Balaji Gunasekaran is a Senior Software Engineer with a Master of Science degree in Mechatronics and a bachelor’s degree in Electrical and Electronics Engineering. He loves to write about tech and has written more than 300 articles. He has also published the book “Cracking the Embedded Software Engineering Interview”. You can follow him on LinkedIn