1. Home
  2. Linux

How To Upgrade Debian Linux To A New Release

Debian Linux doesn’t upgrade often. Usually, the distribution will stick with a single release for more than a year at a time. Since new versions are rare, many users don’t know how to upgrade Debian Linux to a new release.

The Debian upgrade process is painless and relatively quick. Though, it doesn’t work like other Linux distributions. Before you upgrade Debian Linux, you’ll need to understand what “codenames” and “branches” are.

Debian Codenames And Branches

Each version of the OS has a codename and a release branch. Codenames are nicknames that the Debian development team gives out as a unique identifier for each version of the OS. These codenames aren’t particularly important in the grand scheme of things and the release branch name matters a lot more.

What’s a release branch? It’s the way Debian developers can tell its users what types of updates they’ll receive, and how stable the OS is. On Debian, there are about four separate release branches. These branches are labeled Stable, Testing, Unstable, and Experimental. It’s easy to understand what these branches mean, without going too far into it, as they explain themselves.

When upgrading to a new version of Debian Linux, you’ll have to change the codename or release branch in the sources file. Doing this allows the system to start the conversion from the old version to the new version. However, please understand that sometimes it may not be enough to change the release branch, as the new version isn’t there yet.

For example, Debian 10 is about to be the new Stable release, but we still have Debian Stable (9), so just doing an update with “Stable” in the sources isn’t enough. Instead, users who want to use the new version of Debian need to switch “Stable” to “Buster.”

Change Debian Sources

On Debian, the apt sources are your best friend. Mastering this file will let you install all kinds of software quite easily even if it’s not available in the provided software sources for your installation. During upgrades, you’ll need to tinker with this file. Luckily, it’s not that difficult, and only a few things need modifying.

As of 2018, the Debian community is anticipating Debian 10, which will be the latest “Stable” release. The codename for this release is Buster, so this is the codename we’ll be working with for this tutorial. If you’re reading this in the future, replace “Buster” with the upcoming version’s codename.

The Debian sources file can easily be modified right from the terminal, as it’s a traditional text configuration file. To edit it, open up a new terminal window and switch from your user to the root user. Switch to root by executing the su command.

su -

Now that you’ve got su access, it’s possible to touch any part of the system with no limits — including the sources file. Launch the sources file with the Nano text editing tool.

nano /etc/apt/sources.list

In the Debian sources file, you’ll notice dozens of software repositories. These repositories are how your Debian PC regularly accesses updates and installs software. To upgrade, change all instances of “stable” to “buster.”

Now that the sources file has all instances of “stable”  set to the new “buster” codename look through and remove any third-party software sources from the file. While it might be annoying to have to remove links to software you need, doing this is a good idea, as you have no idea if the new version supports it yet. These third-party software sources can always be re-added after the fact.

In the sources file press Ctrl + O to save the changes, exit with Ctrl + X and run the update command to finalize the changes.

Note: it’s also possible to transition Debian from Stable to Unstable, Testing or Experimental. Instead of changing everything to “buster,” try changing it to your desired branch and follow the tutorial.

apt-get update

After running the update, Debian will have replaced all software available to you from Stable to Buster. Replacing the software sources is the first step before running the final upgrade. However, before doing the actual update, it’s a good idea to clean up stray files and packages. Clean everything by running the autoremove and clean commands.

apt-get autoremove

apt-get autoclean

Running autoclean and autoremove will uninstall orphaned packages on your system and clean up the package cache.

Upgrading to a new release of Debian requires two separate commands. Upgrade and dist-upgrade. Using the upgrade command will renew all of the software already on your system. The dist-upgrade command will change your current release of Debian to the new Buster release.

apt-get upgrade -y

apt-get dist-upgrade

The dist-upgrade command takes a while, but when it finishes your upgrade is complete. To finish up, restart your Debian Linux PC and re-login.

Leave a comment