How to Convert Debian Stable Version to Testing

4 min


This article provides a step-by-step guide on upgrading, potential risks and considerations before converting a Debian stable installation to a testing version.

Debian is a popular Linux distribution known for its stability and reliability. Due to this, it is used primarily on servers worldwide. But with stability, the adoption of new packages is a little slower in the Debian stable ecosystem.

However, some users may want to use Debian’s latest and greatest software versions before officially being released in the stable version.

In this case, the testing version of Debian can be a good choice. This version of Debian is a developmental version of the stable version, which contains the latest software versions that have been tested and are considered stable enough for everyday use. There is another version called Debian unstable, which contains bleeding edge packages, which is obviously “unstable”. It is also called “sid”.

Debian Versions and Sources File

To summarize, here’s what all three versions mean (as of the current schedule and code names):

StableTestingUnstable
bullseye (Debian 11)bookworm (Debian 12)Sid

Each version in the above table builds are available in separate repositories and mentioned in the /etc/apt/sources.list file for your system as separate line entries. Hence, you can tweak this file to add any version you want for your Debian system. It is so much flexible. Here’s the syntax of one line in this file:

deb (respository server/mirror) (repository name) (sub branches of the repo)

So, to enable Debian testing, you should have the following in the sources.list file.

# Testing repository – main, contrib and non-free branches
deb http://deb.debian.org/debian testing main non-free contrib
deb-src http://deb.debian.org/debian testing main non-free contrib

# Testing security updates repository
deb http://security.debian.org/debian-security testing-security main contrib non-free
deb-src http://security.debian.org/debian-security/ testing-security main contrib non-free

Alternatively, you can use code names such as “bookworm” instead of “testing”. But I would recommend you use the above.

deb http://deb.debian.org/debian bookworm main non-free contrib
deb http://security.debian.org/ bookworm/updates main contrib non-free

Let’s look at how you can convert a Debian stable version to testing.

Debian stable to testing

Please note that testing versions of packages may contain bugs and not be entirely stable, so you should use this version at your own risk.

I assume you already have a Debian stable version installed. If not, you can try out one of my older guides to install Debian.

To switch from Debian stable to testing, you can follow these steps:

  • Open the terminal window. And run the following command to update the package list.
sudo apt update
  • Take a backup of the /etc/apt/sources.list file. We are going to make a change for this conversion.
cp /etc/apt/sources.list /etc/apt/sources.list.backup
  • Once the above command is complete, open the /etc/apt/sources.list file using a text editor such as nano or vim.
sudo nano /etc/apt/sources.list
  • Comment all the deb lines by adding “#” at the beginning of the lines.
  • Change all the occurrences of strings stable to testing. Or, add the following lines:
# Testing repository – main, contrib and non-free branches
deb http://deb.debian.org/debian testing main non-free contrib
deb-src http://deb.debian.org/debian testing main non-free contrib

# Testing security updates repository
deb http://security.debian.org/debian-security testing-security main contrib non-free
deb-src http://security.debian.org/debian-security/ testing-security main contrib non-free

Note: If you want, you can change the URL to your nearest mirror. Here’s the official mirror list. If you are unsure, keep the above lines unchanged. The US mirror will work just fine.

Updating the sources.list file
Updating the sources.list file
  • Press CTRL+O, ENTER, CTRL+X to save and exit from the nano editor.
  • Now, run the following command to update the package list with the new testing repository.
sudo apt update
  • Then, upgrade the installed packages to the testing version using the below command. While running this command, there will be several prompts which require your input. And it takes some time (around 20 minutes, depending on mirror); wait until it finishes.
sudo apt upgrade
  • Finally, run the following command to install any dependencies or packages required for the testing version.
sudo apt full-upgrade
  • Restart your system and ensure that all the packages are running from the testing version of Debian.

Advanced configuration for selective package update to testing (optional)

The above configuration will apply to all packages in your Debian installation. But if you want to install specific packages from the testing while maintaining the stable repo, then you need to tell the apt package manager about the priority. So, the stable version can be of a higher priority, then testing, followed by the unstable having a lower priority.

This definition can be made in the /etc/apt/preferences.d file. Open the file using any editor and add the followings:

Package: *
Pin: release a=stable
Pin-Priority: 700

Package: *
Pin: release a=testing
Pin-Priority: 650

Package: *
Pin: release a=unstable
Pin-Priority: 600

Once done, save and close the file. And run the following:

sudo apt update

Now, you can easily install a package from the testing repo using the following (example):

sudo apt install gnome-shell/testing

You can learn more about the above in the apt_preferences manual.

apt priorities manual
apt priorities manual

Wrapping Up

In general, switching to the Debian testing version is not recommended for production environments. It’s a straight NO for servers running Debian stable. It’s more appropriate for testing and development purposes. For instance, for testing new features and helping to identify bugs in the new version.

In conclusion, switching from Debian stable to testing can be a great way to access the latest software versions before they are officially released. However, using it at your own risk is also a good idea to back up your data periodically while using Debian testing.

References
https://wiki.debian.org/AptPreferences
https://wiki.debian.org/DebianTesting


Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, LinkedIn, or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments