Debian – Cannot install Debian Stretch kernel headers

debianlinux-kernel

I am running Debian 9 Stretch on a VPS & dedicated server. I have updated both to the latest kernel on the backports repos with apt install linux-image-4.18.0-0.bpo.1-amd64

The problem is when I go to install the headers using apt install linux-headers-4.18.0-0.bpo.1-amd64 I get the error below.

The following packages have unmet dependencies:
 linux-headers-4.18.0-0.bpo.1-amd64 : Depends: linux-compiler-gcc-6-x86 (>= 4.14.17-1~) but 4.9.110-3+deb9u6 is to be installed
E: Unable to correct problems, you have held broken packages.

How can I fix this issue, and why is this an issue for me on different servers?

Best Answer

You need to tell apt to use backports to satisfy the headers’ dependencies:

apt install -t stretch-backports linux-headers-4.18.0-0.bpo.1-amd64

I highly recommend installing the default kernel and headers packages instead:

apt install -t stretch-backports linux-image-amd64 linux-headers-amd64

That will ensure that you get updated kernels and headers as they become available, even if their ABI changes (and thus their package names).

Related Question