3

I'm connected via SSH to a PC running Linux kernel 3.11.1:

root@alix:~# uname -r
3.11.1

how can I find out which package installed this specific file or kernel version respectively?

I tried

root@alix:/boot# dpkg -S vmlinuz-3.11.1 
dpkg-query: no path found matching pattern *vmlinuz-3.11.1*

Other installed kernel versions can be found with dpkg -S:

root@alix:/boot# dpkg -S vmlinuz-3.2.23
linux-image-3.2.23-ath5kmod: /boot/vmlinuz-3.2.23-ath5kmod

My purpose: I would like to install the corresponding Linux headers for version 3.11.1 to compile a kernel module for it. apt-cache search linux-headers lists 15 different header versions but not that one for 3.11.1.

Thank you very much.

3

You can list every installed package with dpkg -l and filter through the results with grep for the kernel packages

dpkg -l | grep 'linux-image'
dpkg -l | grep 'linux-image' | grep '3.11'

To find the kernel headers package for your running kernel:

apt-cache search linux-headers-`uname -r`
  • I tried that before. dpkg -l | grep "linux-image" lists the following packages: linux-image-3.2.0-3-486, linux-image-3.2.23, linux-image-3.2.23-ath5kmod, 3.2.23-ath5kmod-10.00.Custom, linux-image-486 But package for kernel 3.11.1 is missing. Therefore, I'm slightly confused. – Benedikt Jun 17 '14 at 11:13
  • Not sure why the package isn't coming up. See my updated answer to find the headers for your running kernel – Creek Jun 17 '14 at 11:22
  • The problem is that there is also no correct header for the version 3.11.1. Is a "meta-package" responsible for installing the kernel version 3.11.1? For instance, "linux-image-486" is listed as meta-package. – Benedikt Jun 17 '14 at 11:25
  • I guess this PC is pretty misconfigured and now I have to clean up this mess. :( – Benedikt Jun 17 '14 at 11:30
  • Here's a link for installing the deb packages for 3.11.1, but I would personally stick with a kernel that's supported by the package manager – Creek Jun 17 '14 at 11:34
0

My original problem was that there were no appropriate kernel headers available for the currently installed Linux kernel (3.11.1).

Finally, I solved this issue in four steps:

  1. Removed the kernels which were installed via apt-get.
  2. Removed custom kernels:

    • /boot/vmlinuz*KERNEL-VERSION*
    • /boot/initrd*KERNEL-VERSION*
    • /boot/System-map*KERNEL-VERSION*
    • /boot/config-KERNEL-VERSION
    • /lib/modules/KERNEL-VERSION/
    • See here for a detailed description.
  3. Installed kernel and corresponding headers which are shipped per default by package manager apt-get (it's version 3.2.0-4-486).

  4. Update grub via update-grub.

Now, I can compile and use the required Linux kernel module. Thanks Creek to point me in the right direction. :)

0

Use dlocate(1) command from dlocate package:

$ dlocate /boot/vmlinuz-*
linux-image-4.9.0-6-amd64: /boot/vmlinuz-4.9.0-6-amd64
linux-image-4.9.0-7-amd64: /boot/vmlinuz-4.9.0-7-amd64

dlocate takes file name as an argument and returns name of the package that owns/provides given file.

0

apt-get install linux-headers should get you the headers for all installed kernels

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.