How to enable the Debian backports

Debian is known for its robustness and for its special procedure for selecting packages to be in its official repositories. This means that we can’t always count on recent versions of software. To change the situation, a bit, there are Debian backports.

According to the Debian website:

Backports are recompiled packages from testing (mostly) and unstable (in a few cases only, e.g. security updates), so they will run without new libraries (wherever it is possible) on a stable Debian distribution.

So, this special repository includes very stable software whose installation should not affect the performance of the system. Thanks to them, it is possible to have more recent versions of some applications like the kernel or LibreOffice.

However, from the same Debian project it is invited not to abuse the use of this repository since it could be detrimental.

As always, Debian is a distribution with a high degree of responsibility and that is why even if you enable backports it will be disabled, and you explicitly have to enable it to install software.

Although it sounds difficult, it’s easier than you think.

Enabling Debian Backports

Actually, enabling Debian backports is really just adding this repository to the ones already in the system. So, there’s no mystery to it.

First, open a terminal and make sure to update the system

sudo apt update
sudo apt upgrade

Thereafter, you can continue with the tutorial.

Now carefully edit the APT repository file.

sudo nano /etc/apt/sources.list

Or better, use the native APT tool.

sudo apt edit-sources

In either case, what you need to add is the backports repository. Remember that this depends on the mirror you are using, but in this case, I will show you an example.

So, at the end of the file, add

deb http://ftp.debian.org/debian bullseye-backports main

You can also add the non free and contrib sections. To achieve this, then modify the previous entry.

deb http://ftp.debian.org/debian bullseye-backports main non-free contrib

Then save your changes and close the editor.

To apply the changes, you need to refresh APT.

sudo apt update

This way, Debian now has backports enabled, and you will be able to use them without any problems.

An example of how to use it

Although they are already enabled, you will not be able to install any packages from this repository because it is disabled by default. So, to use it, you will have to specify it.

A practical example is the Linux kernel. In the backports you can install version 5.18 which, while not the latest, is a mature version that supports a lot of modern hardware.

To install it, you will need to run

sudo apt -t bullseye-backports install kernel-image-5.18.0-0.deb11.4-amd64-di

As you can see, the -t option followed by the bullseye-backports repository explicitly indicates that you will get the needed package from there.

If you use Synaptic, you can browse the repository for other packages more conveniently.

Disable Debian Backports

If you no longer want to have backports on your system, the best thing to do is to remove them. In this case, simply edit the APT source file.

sudo nano /etc/apt/sources.list

And just comment out the line where the backports are. So, change it from this

deb http://ftp.debian.org/debian bullseye-backports main non-free contrib

To this:

#deb http://ftp.debian.org/debian bullseye-backports main non-free contrib

Save your changes and close the editor.

Remember to refresh APT so that the new repository information loads properly.

sudo apt update

They will no longer be active.

Conclusion

Debian is a great Linux distribution, but it has a particular style of choosing its packages, and this means that they are not always up to date. So to avoid this, you can enable Debian Backports. Now you know how to do it.

I hope you liked it, and you can share our post.

Leave a Comment

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

Scroll to Top