How to Upgrade Debian

Upgrade Debian Featured

For approximately two years, Debian remains relatively unchanged. Program versions and features remain the same for this duration. Security fixes get backported. Sometimes, exceptions are made for rare situations where a package might need new features. For example, a driver may get upgraded to add support for more hardware. But it rarely happens.

Keeping things constant has its advantages. It makes the operating system dependable. You almost never encounter bugs. Things almost never break after updating packages. No new features also means no unexpected surprises/behavior.

But every two years (approximately) a new Debian version is released. And it often brings significant improvements and new features you may want or need. Although the operating system is often described as “rock solid,” for reasons mentioned above, the upgrade process is also rock solid. On a clean system the upgrade from one major version to the next is so smooth, it feels like you just upgraded a few unimportant packages.

Before Upgrading, Clean Up sources.list

Some users encounter issues when they try to upgrade. They get unresolvable package conflicts, important software gets removed, and so on. They end up preferring to just remove the old installation and fresh-install the new version. However, most of the time this isn’t Debian’s fault. The reason they encounter problems is often because they did one or more of these things to break their operating system. Just because it seems to be working doesn’t mean that the package manager isn’t suffering in silence. That’s why it’s recommended to remove any reference to third-party software from your “sources.list” files before continuing.

Open the file for editing:

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

Upgrade Debian Sources List Example

If you need a template, copy the example below and modify it according to your needs.

It’s very important that you preserve the current codename of your Debian release! So, if it’s year 2021, and you’re running Debian Buster, replace stretch with buster, or whatever applies to you.

Also, preserve the ending strings. In this example the line ends with the string “main.” But if your current “sources.list” strings end with “main contrib non-free,” then add “contrib non-free” at the end of each line. In this case your end result might look like this:

To save the file, press Ctrl + X, followed by y and then Enter.

You can read more about the sources.list on Debian’s wiki.

Update package information:

Upgrade your packages:

If a changelog resembling the following picture appears, after you read through it, you can exit by pressing q.

Upgrade Debian Changelogs

Remove unnecessary packages:

Prepare sources.list for Upgrade

It’s worth noting that you should only upgrade from one major version to the next. Example: you should upgrade Debian 7 to 8, or 8 to 9, but not 7 to 9.

Edit your software sources file again.

Replace the codename of your current Debian release with the codename of the next. You can find codenames on Debian’s list of releases page.

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

to this:

Save the file and then refresh package information:

Upgrade Debian

If you are doing this on your desktop, log out from your graphical interface. The update process will restart your graphical stack at some point, which will make you lose access to your terminal application.

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

Perform a “safe upgrade” first. This tries to upgrade all packages without removing anything.

Pay close attention to see if there are any conflicts leading to necessary packages being removed. This, and the next command, is where on some systems things like the graphical stack may be entirely removed. It shouldn’t happen on clean systems where you never installed things outside of Debian’s repository, though.

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

Upgrade Debian Configuration Changes

If you made modifications to the configuration file, you may want to either keep it or upgrade it and later re-add your customizations. If you never touched the file, however, select to pull in the new configuration (type Y). It may have important improvements, security fixes, or required changes for the software to work. That’s why it’s recommended that you “install the package maintainer’s version” as often as possible.

Now, do a “full upgrade.” This will upgrade the rest of the packages that couldn’t be updated by the previous command. That is because they conflict with older packages or obsolete programs you have on your system. The full upgrade will remove some old packages to make room for the new.

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

Finally, reboot your computer/server:


In most cases this should work without any issues. But if you had third-party software sources added to your package manager, or installed third-party packages (with commands such as dpkg -i something.deb), you may run into conflicts. In such cases you will have to solve these manually by removing offending packages first (sudo apt autoremove badpackage).

Also, if you want to read more details about upgrading to a new release, Google something like “Debian stretch upgrade.” Of course, replace codename “stretch” appropriately in that search. You will find a page like this one, detailing the upgrade path from one release to another.


  1. After reading this article it seems much less hassle to just do a fresh install of the new version. No need to worry if you are skipping versions or upgrading to the next one. You can go from vers.6 to vers.10 without any problems.

  2. Before you change any system file, make a backup.

    cp /etc/apt/sources.list /etc/apt/sources.list.bak

  3. Excellent article.
    It is also a good idea to check there is enough space if the OS is installed to a separate partition. The default is 10G if you chose a separate home partition when installing. This may not leave enough space for an upgrade. I write from recent experience – my recent upgrade to Buster ran out of space. Fortunately I was able to free up some space and finish it.

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.