1

I'm following a simple tutorial on how to create a Linux kernel module, for a class I'm taking, and one of the steps asks me to install the necessary kernel headers using

sudo apt-get install linux-headers-`uname -r`

When I attempt to do this I get the following error

E: Unable to locate package linux-headers-5.5.1-CS369
E: Couldn't find any package by glob 'linux-headers-5.5.1-CS369'
E: Couldn't find any package by regex 'linux-headers-5.5.1-CS369'

(Note: '-CS369' is the local version string we were asked to create for the kernel using menuconfig)

I thought initially that my local version string was making it so I couldn't locate the headers but when I "apt-cache search linux-headers" I don't get any 5.5.1 headers, only 'linux-headers-4.1.5 to linux-headers-5.3.0 . Does anybody know why I'm unable to install the headers I need?

version: Ubuntu 18.04.3

edit: I'm new to all of this and trying to understand how it all works. I apologize if this wasn't an appropriate place to ask this question.

Schierke
  • 13
  • 4
  • To follow up, the top answer was actually incorrect. The method I used to compile and install the kernel should have placed the corresponding headers in the repositories but didn't due to a compatibility issue. I downloaded a slightly older version kernel from the same archive and didn't have any problems. – Schierke Feb 24 '20 at 01:25

1 Answers1

2

You have installed some custom kernel image 5.5.1-CS369.

Why would you expect that corresponding linux headers would appear in Ubuntu repositories?

If you installed a custom kernel image, you should install headers from the same place.

You ask why you don't see the 5.5.1 headers in Ubuntu repos. It is for the same reason you don't see the 5.5.1 kernel image there.

Pilot6
  • 92,169
  • 1
    I'm sorry if this was a stupid question. This is my first time doing anything with linux. I followed the tutorial expecting it to guide me, but I guess I missed a step or didn't understand something. Thank you for your help. – Schierke Feb 04 '20 at 21:50
  • 1
    You need to take the kernel headers from the place you got the image. If you compiled the image, you should compile the headers. As simple as that. Another way is to boot with an Ubuntu kernel and use the Ubuntu headers. – Pilot6 Feb 04 '20 at 22:03
  • 2
    I forgot to 'make headers_install'. Thank you for your help. I only cried once. – Schierke Feb 04 '20 at 22:37