[HowTo] Install a kernel from Backports

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
sunrat
Administrator
Administrator
Posts: 6761
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 122 times
Been thanked: 542 times

[HowTo] Install a kernel from Backports

#1 Post by sunrat »

There are various Backports guides in random places but as the most common reason for Backports is to install a kernel more recent than the one in Stable for hardware support, here's a specific guide.

Add Backports to sources.list:

Code: Select all

deb http://deb.debian.org/debian bookworm-backports main
to /etc/apt/sources.list (or add a new file with the ".list" extension to /etc/apt/sources.list.d/ . I use backports.list)
Update the package database, run:

Code: Select all

apt update
Install kernel metapackages (these will ensure any kernel updates are applied during normal update process):

Code: Select all

apt install -t bookworm-backports linux-image-amd64 linux-headers-amd64
Note: as @fabien posted below, linux-headers is not essential unless you need to build packages.
Reboot to use the new kernel.
That is for the most common amd64 architecture, modify if you use something else but check first if it is available in backports.
That is all!

New(ish) hardware may also require more current firmware. Check if a backports version is available and install it. If not, it is normally safe to install newer firmware packages from Testing or Unstable but do not add those as sources. Rather download the required package and install manually.

More info on Backports - https://backports.debian.org/Instructions/
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
fabien
Forum Helper
Forum Helper
Posts: 831
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 77 times
Been thanked: 196 times

Re: [HowTo] Install a kernel from Backports

#2 Post by fabien »

Thanks @sunrat, just wanted to note that linux-headers-amd64 is not always necessary. It is mainly needed if you use dkms, e.g. to install the nvidia proprietary driver. I guess the rule is, if you already have it installed, install it from Backports, otherwise, don't install it.
How to check if linux-headers-amd64 is installed:

Code: Select all

$> apt policy linux-headers-amd64 
linux-headers-amd64:
  Installed: (none)
  Candidate: 6.1.90-1
  Version table:
     6.7.12-1~bpo12+1 100
        100 https://deb.debian.org/debian bookworm-backports/main amd64 Packages
     6.1.90-1 500
        500 https://deb.debian.org/debian-security bookworm-security/main amd64 Packages
     6.1.76-1 500
        500 https://deb.debian.org/debian bookworm/main amd64 Packages
     6.1.67-1 500
        500 https://deb.debian.org/debian bookworm-updates/main amd64 Packages
In the above case, it is not installed.

Edit 2024-06-05: it is possible that a linux-headers package is installed while the linux-headers-amd64 meta-package is not. Here is a method to display all installed linux-headers packages:

Code: Select all

$> apt list --installed "linux-headers-*amd64"
If this command shows linux-headers packages installed, it is probably advisable to install the linux-headers-amd64 meta-package from Backports.
ImageShare your Debian SCRIPTS
There will be neither barrier nor walls, neither official nor guard, there will be no more desert and the entire world will become a garden. — Anacharsis Cloots

User avatar
sunrat
Administrator
Administrator
Posts: 6761
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 122 times
Been thanked: 542 times

Re: [HowTo] Install a kernel from Backports

#3 Post by sunrat »

fabien wrote: 2024-06-02 09:59 Thanks @sunrat, just wanted to note that linux-headers-amd64 is not always necessary. It is mainly needed if you use dkms, e.g. to install the nvidia proprietary driver. I guess the rule is, if you already have it installed, install it from Backports, otherwise, don't install it.
Thanks @fabien . I added a note to my post above. I always install it as I use nvidia drivers and build some other things.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

Post Reply