How to upgrade Debian
Random Tech News

How to upgrade Debian

In every two year period, there will be no change in Debian. Program versions and features remain the same throughout this time. Security fixes are backported (taken of the new version and then transferred to the old version). Sometimes, there are rare exceptions in which a package needs new features. For example, drivers can be upgraded to add support for more hardware. But this is very rare.

Keeping things constant also has certain advantages, such as making the operating system more reliable. You almost never get the error. Things are almost never broken after updating packages. Not having a new feature means no undesirable behavior will happen.

But every two (about) two years, a new Debian version is released. And the new version often brings significant improvements and new features. On a “clean” system, upgrading from one major version to the next is very “smooth”, making you feel like you’ve upgraded a few unimportant packages.

Detailed instructions on how to upgrade Debian

  • Before upgrading, clean up sources.list!
  • Prepare sources.list for the upgrade
  • Debian Upgrades

Before upgrading, clean up sources.list!

Some users experience problems when they try to upgrade Debian, such as being unable to resolve conflicts between packages, deleting critical software, etc. In the end, they only have to uninstall install old and install new new version. However, in most cases it is not Debian’s fault. The reason these users have the problem is usually because they accidentally did something that broke their operating system. Just because the operating system is still working doesn’t mean that the package manager is free of problems. That is why it is always recommended to remove any references to third-party software from your files. “sources.list” before continuing.

Please open this file for editing:

sudo nano /etc/apt/source.list

Remove any references to software outside of the official Debian repositories. There are only three lines you need in this file.

Clean up sources.list

If you need a template, copy the example below and modify it as needed.

It is important that you keep the current codename of your Debian distribution! For example, if it’s the year 2021 and you’re running Debian Buster, replace stretch equal buster or whatever applies to your situation.

deb stretch main
 deb stretch-updates main
 deb stretch/updates main

Also, keep the ending strings intact. In this example, the line ends with a string “main”. But if “sources.list” Your current ends with “main contrib non-free”, then add “contrib non-free” at the end of each line. In this case, the final result looks like this:

deb stretch main contrib non-free
 deb stretch-updates main contrib non-free
 deb stretch/updates main contrib non-free

To save the file, press Ctrl + X, followed by and And after that Enter.

Update package information:

sudo apt update

Upgrades packages:

sudo apt upgrade

If a change like the following appears, after reading it, you can exit by pressing q.

After the upgrade press q to exit

Get rid of unnecessary packages:

sudo apt autoremove

Prepare sources.list for the upgrade

It’s worth noting that you should only upgrade from one major build to the next. For example, you should upgrade Debian 7 to 8 or 8 to 9, not from 7 to 9.

Edit your software source file again.

sudo nano /etc/apt/sources.list

Replace the codename of the current Debian release with the codename of the next version. You can find the codename on the Debian distributions list page (Reference link:

For example, to upgrade Debian 9 to Debian 10, you would change this:

deb stretch main contrib non-free
 deb stretch-updates main contrib non-free
 deb stretch/updates main contrib non-free


deb buster main contrib non-free
 deb buster-updates main contrib non-free
 deb buster/updates main contrib non-free

Save the file and then refresh the package information:

sudo apt update

Debian Upgrades

If you are performing the upgrade on the desktop, please log out of the graphical interface. The update process will restart the graphical stack at some point and cause you to lose access to the terminal app.

Log in to the text console. Press ALT + CTRL + F2 or ALT + CTRL + F3, log in with your username and password, then enter the command on this screen.

Perform the safety upgrade first. This step will upgrade all packages without removing anything.

sudo apt upgrade

Pay attention to any conflicts resulting in packages that require the device to be removed. If you use this command and the next command on some systems, things like the graphics stack might be completely eliminated. However, that won’t happen on “clean” systems where you’ve never installed anything outside of the Debian repositories.

Some packages come with new configuration files. You will be asked if you want to keep the old profile or upgrade to a new one.

If you have modified the configuration file, you may want to keep or upgrade and then add customizations. However, if you have never touched this file, choose to upgrade to a new profile (import AND). The upgrade may contain significant enhancements, security bug fixes, or changes required for the software to function. That’s why you should install the Google maintenance pack version as often as possible.

Now, let’s do a full upgrade. This will upgrade the rest of the packages that cannot be updated with the previous command (this is because they conflict with old packages or outdated programs that are currently on the system). A full upgrade will remove some old packages to make room for new ones.

sudo apt full-upgrade

Full upgrade

After this command, the upgrade is completed. You can clean up unnecessary packages with the command:

sudo apt autoremove

Finally, restart the computer or the server:

sudo systemctl reboot

In most cases, the above upgrade should not encounter any problems. But if you added third-party software source to your package manager, or installed third-party packages (with commands like dpkg -i something.deb), you may encounter a conflict. In such cases, you will have to deal with them manually, by removing the offending packages first with the command:

sudo apt autoremove badpackage

Hope you are succesful.


Leave a Reply

Your email address will not be published. Required fields are marked *