How to Install Newer Software in Debian

debian-backport-featured

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.

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.

pyramids

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.

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.

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

debian-backports-lsb-release

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:

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

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

debian-backports-editing-sources-list

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:

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.

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:

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/.”

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

debian-backports-sudo-apt-update

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

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

debian-backports-apt-showing-version-strings

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.

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:

debian-backports-apt-policy

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.

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.

2 comments

  1. Nice article. Didn’t know about using “deb.debian.org/debian” in my sources.list file. Note that as of this date (11-27-18), Buster is still in “testing”, so no backports until it becomes the new stable. Here is a link to the release schedule:
    https://wiki.debian.org/DebianBuster
    Should be out sometime in April/May, maybe, with Debian”s “release when ready” philosophy.
    Another source of more advanced or otherwise not available Debian software is the Deb Multimedia repository:
    http://www.deb-multimedia.org/
    Been using it for years. It does sync up well, but not perfectly, with the corresponding Debian repositories so use with
    some caution.

  2. You can install latest software with Homebrew, which was ported to Linux as Linuxbrew. Packages installed with Linuxbrew are more recent than those found in Debian backports. I’m using mkdocs 1.0.4, nano 3.2, octave 4.4.1, clang 7.0.0 etc and they work fine.

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.

Sponsored Stories