How to Install Newer Software in Debian

Spread the love

Debian is an excellent Linux distribution, especially for servers. It is also a great distribution to run on a regular desktop computer or laptop. You very rarely encounter a bug on this operating system, and packages integrate exceptionally well with one another.

For example, you can easily switch to a different display/login manager, add another desktop environment or change other key components of your software stack. In contrast, you might get weird conflicts on other distributions when trying to switch default packages.

Why Debian Has Old Software

Here’s the short version, without too many technical details. Once most of the known bugs are removed, packages are frozen to a particular version. Most of them will never receive feature upgrades, only security fixes. This way, no new bugs get introduced, and the distribution can remain “stable.” To be stable means that what worked in a certain way one year ago will work exactly the same way next year on the same version of Debian. The advantage is that you get an operating system that (almost) never “breaks.” You can pull in the latest security fixes, and rest assured that your laptop or computer will work just fine the next day.

You don’t lose a lot by not having the latest version of everything. Most software doesn’t dramatically change in the course of two years. But some software does indeed change often and brings important improvements.

Sometimes, you may even require the latest version of something. This may be the case with a new video card you bought that doesn’t work without the latest driver. For such situations, Debian has a special repository where you can upgrade certain pieces of software that you absolutely need to have.

What Are Debian Backports?

Here’s how Debian’s official backports webpage describes what back-porting means:

Backports are packages taken from the next Debian release (called “testing”), adjusted and recompiled for usage on Debian stable.

This repository is not enabled by default, but the steps to do so are fairly straightforward.

How to Enable Backports Repository on Debian

Open a terminal emulator, and find the codename of your Debian installation:

lsb_release -sc

Note: in this example the codename is “stretch.” If at the time you read this the codename is different, for example “buster,” replace every occurence where you see “stretch” with “buster.”

Debian’s APT package manager stores the list of repositories where it can download software in a file. View and edit this file with the following command:

sudo apt edit-sources

At the end of the file, add the following line:

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

On Debian Buster the line would be: “deb http://deb.debian.org/debian buster-backports main contrib non-free.

Your APT sources list might not include the words “contrib” and “non-free.” In this case it means you don’t have some packages available. Among other things, such as the RAR archiver or Steam game platform, you will find drivers for your video card, Wi-Fi adapter and other hardware in “non-free.” If you need these, for example to play 3D video games or if your Wi-Fi isn’t working, enable “contrib” and “non-free.” Simply add the words at the end of each line, after “main.” The following is some text you can copy and paste:

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

Your sources.list file might also contain different URLs instead of “deb.debian.org.” Use “deb.debian.org,” as it has some advantages. It dynamically redirects you to a server close to you. Since it won’t always redirect you to the same server, there’s another advantage. If you use a static address, such as ” ftp.uk.debian.org/debian/,” if the server goes down, you won’t be able to download packages for that time.

With “deb.debian.org” that should no longer be an issue. It helps a lot, especially if you enable automatic upgrades. With a static server you might notice that your computer hasn’t been automatically updating for days or weeks, while the server was offline.

Empty Screen After Running “sudo apt edit-sources”

On some installations the default file “/etc/apt/sources.list” might be missing. In this case sudo apt edit-sources will show an empty screen. Repositories might be stored in a file at “/etc/apt/sources.list.d/base.list” instead. With the following commands, you can see files in that directory and their contents:

ls /etc/apt/sources.list.d/
cat /etc/apt/sources.list.d/*

When you edit the default sources file with sudo apt edit-sources, don’t repeat the lines you see here. Only add what is missing. Copy the lines from those files, add them to “/etc/apt/sources.list” and then delete the files in “/etc/apt/sources.list.d/.”

How to Install Software from Debian Backports

Make the package manager pick up on your recent changes and update its database:

sudo apt update

On Debian 9, codenamed Stretch, to install a newer Nvidia driver from backports, you would use this command:

sudo apt -V -t=stretch-backports install nvidia-driver

On Debian 10, codenamed Buster, the command would be:

sudo apt -V -t=buster-backports install nvidia-driver

It’s not required to use the -V parameter, but it is useful in this case. This makes APT show version strings of the packages that it will install. It makes it easier to spot which packages will be pulled from backports and which will be pulled from regular repositories. Packages that contain the string “bpo” are from backports.

Find Versions Available for a Package

Not all packages have backports available. Only the ones which have important or necessary features in new versions are usually backported. You can quickly check if you can install a newer version for a package with the following command:

apt policy nvidia-driver

In this case you can see that Nvidia’s proprietary driver version 384 is available in Debian’s regular repository. A superior version, 390, is available in backports.

Debian’s list of backported packages can also help you check if a package has a backport available. Remember to adjust the URL in the future with the codename of your current Debian release. “https://packages.debian.org/stretch-backports/allpackages” will be “https://packages.debian.org/buster-backports/allpackages.

Conclusion

Consider upgrading an emergency method from backports. This means don’t overdo it. Install only the packages you really need, otherwise you might make your system unstable or generate conflicts between packages.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Alexandru Andrei

Fell in love with computers when he was four years old. 27 years later, the passion is still burning, fueling constant learning. Spends most of his time in terminal windows and SSH sessions, managing Linux desktops and servers.

Comments (2)