[HowTo] Install a kernel from Backports

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
sunrat
Site admin
Site admin
Posts: 7481
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 135 times
Been thanked: 670 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. This includes packages which use Dynamic Kernel Module Support (DKMS) such as Nvidia drivers
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/

:linked:
“ 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: 1158
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 101 times
Been thanked: 265 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
Site admin
Site admin
Posts: 7481
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 135 times
Been thanked: 670 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!

larienna
Posts: 189
Joined: 2014-09-27 20:54
Been thanked: 1 time

Re: [HowTo] Install a kernel from Backports

#4 Post by larienna »

Question, after upgrading the kernel, do I have to remove the backports from the sources.list?

Else, I imagine any further software update will use the backports? Is it necessary since I am using a new kernel, or it's optional only if I want newer software?

User avatar
sunrat
Site admin
Site admin
Posts: 7481
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 135 times
Been thanked: 670 times

Re: [HowTo] Install a kernel from Backports

#5 Post by sunrat »

larienna wrote: 2024-10-15 17:07 Question, after upgrading the kernel, do I have to remove the backports from the sources.list?

Else, I imagine any further software update will use the backports? Is it necessary since I am using a new kernel, or it's optional only if I want newer software?
Backports inherits a default pin priority of 100 whereas the main repo is 500. This means it won't install or replace anything unless you specifically specify the -t bookworm-backports option when you wish to install a package from backports. I think any packages you do install from backports however will be updated if a new version appears in backports (not 100% sure on this, I'll check later).
I keep backports active in sources, never had any issue.
“ 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: 1158
Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 101 times
Been thanked: 265 times

Re: [HowTo] Install a kernel from Backports

#6 Post by fabien »

sunrat wrote: 2024-10-15 22:12 I think any packages you do install from backports however will be updated if a new version appears in backports (not 100% sure on this, I'll check later).
Yes, because of the ButAutomaticUpgrades: yes field

Code: Select all

$> head -n17 /var/lib/apt/lists/deb.debian.org_debian_dists_bookworm-backports_InRelease
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Origin: Debian Backports
Label: Debian Backports
Suite: stable-backports
Codename: bookworm-backports
Changelogs: https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog
Date: Tue, 15 Oct 2024 20:21:00 UTC
Valid-Until: Tue, 22 Oct 2024 20:21:00 UTC
NotAutomatic: yes
ButAutomaticUpgrades: yes
Acquire-By-Hash: yes
No-Support-for-Architecture-all: Packages
Architectures: all amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x
Components: main contrib non-free-firmware non-free
Description: Debian bookworm - 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

larienna
Posts: 189
Joined: 2014-09-27 20:54
Been thanked: 1 time

Re: [HowTo] Install a kernel from Backports

#7 Post by larienna »

OK thanks, so I can update in peace :)

Danathar
Posts: 33
Joined: 2021-01-10 12:44
Been thanked: 1 time

Re: [HowTo] Install a kernel from Backports

#8 Post by Danathar »

Once you use a kernel from backports, how does this affect upgrades when going to the next major version (like 13)? I’m contemplating upgrading my hardware soon and will need a later kernel for the newer motherboard, but I wonder what I’ll need to do when upgrade time comes to make sure the upgrade does not break.

Thanks!

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 1325
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 135 times
Been thanked: 239 times

Re: [HowTo] Install a kernel from Backports

#9 Post by wizard10000 »

Danathar wrote: 2025-01-05 12:28Once you use a kernel from backports, how does this affect upgrades when going to the next major version (like 13)?
It won't affect an upgrade to 13. Kernels are backported from Testing so there's zero chance a kernel in bookworm-backports will be newer than Trixie's kernel.

Hope this helps -
we see things not as they are, but as we are.
-- anais nin

Danathar
Posts: 33
Joined: 2021-01-10 12:44
Been thanked: 1 time

Re: [HowTo] Install a kernel from Backports

#10 Post by Danathar »

wizard10000 wrote: 2025-01-05 12:39
Danathar wrote: 2025-01-05 12:28Once you use a kernel from backports, how does this affect upgrades when going to the next major version (like 13)?
It won't affect an upgrade to 13. Kernels are backported from Testing so there's zero chance a kernel in bookworm-backports will be newer than Trixie's kernel.

Hope this helps -
Thanks! During my testing, I noticed one thing: using the latest kernel in backports may not be compatible with the kernel modules you are using. When I tried 6.11 with ZFS and NVIDIA, building the modules for both failed. I had to downgrade to 6.9 in backports to get them working. So anybody looking to use a backport kernel needs to be aware of that before they upgrade.

dynamicsubspace+
Posts: 1
Joined: 2025-01-08 01:04

Re: [HowTo] Install a kernel from Backports

#11 Post by dynamicsubspace+ »

@sunrat, thank you for the backports guide, and @Danathar, thank you for the note about NVIDIA--I installed 6.9 without any issues!

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 1325
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 135 times
Been thanked: 239 times

Re: [HowTo] Install a kernel from Backports

#12 Post by wizard10000 »

@Best_Threads
we see things not as they are, but as we are.
-- anais nin

DebianFox
Posts: 207
Joined: 2024-05-05 14:11
Has thanked: 26 times
Been thanked: 15 times

Re: [HowTo] Install a kernel from Backports

#13 Post by DebianFox »

Danathar wrote: 2025-01-06 00:39
wizard10000 wrote: 2025-01-05 12:39
Danathar wrote: 2025-01-05 12:28Once you use a kernel from backports, how does this affect upgrades when going to the next major version (like 13)?
It won't affect an upgrade to 13. Kernels are backported from Testing so there's zero chance a kernel in bookworm-backports will be newer than Trixie's kernel.

Hope this helps -
Thanks! During my testing, I noticed one thing: using the latest kernel in backports may not be compatible with the kernel modules you are using. When I tried 6.11 with ZFS and NVIDIA, building the modules for both failed. I had to downgrade to 6.9 in backports to get them working. So anybody looking to use a backport kernel needs to be aware of that before they upgrade.
@wizard10000, @Danathar and @FreewheelinFrank would it be possible to add this information along with other NVidia driver issues to the topic Please read - Current Issues in Debian?

If required I can draft it and then post it.

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2562
Joined: 2010-06-07 16:59
Has thanked: 50 times
Been thanked: 282 times

Re: [HowTo] Install a kernel from Backports

#14 Post by FreewheelinFrank »

DebianFox wrote: 2025-01-17 05:56
Thanks! During my testing, I noticed one thing: using the latest kernel in backports may not be compatible with the kernel modules you are using. When I tried 6.11 with ZFS and NVIDIA, building the modules for both failed. I had to downgrade to 6.9 in backports to get them working. So anybody looking to use a backport kernel needs to be aware of that before they upgrade.
@wizard10000, @Danathar and @FreewheelinFrank would it be possible to add this information along with other NVidia driver issues to the topic Please read - Current Issues in Debian?

If required I can draft it and then post it.
[/quote]

Sounds good to me. You can start a topic in Beginners Questions. I have zero knowledge of NVidia, so will have to leave it to other members to validate advice such as that above. If the topic is useful (ie the information is not subject to so many disputations, caveats and conditions that it would be confusing more than helpful), I can certainly add a link to the "Problems" page.

Post Reply