9

I have versions 3.16 and 4.0 of linux-image package installed. During login I can select which kernel I want to boot in the "advanced options" menu item. However, when I install a DKMS module it is compiled only for the newer version:

Setting up fglrx-modules-dkms (1:14.12-1) ...
Loading new fglrx-14.12 DKMS files...
Building only for 4.0.0-1-amd64

Relevant packages (linux-headers, linux-kbuild, linux-compiler-gcc) are installed for 3.16 too.

Why does the package not get compiled for the old kernel image? Can I configure something so it is compiled?

  • 2
    Does it already exist, perhaps? – 0xC0000022L May 22 '15 at 10:37
  • I don't have access to that computer right now to check, but I got the same message trying to reinstall that DKMS package. So, probably no. – doublep May 22 '15 at 11:31
  • No, it was not installed. However, now a newer version of that package became available, and once I upgraded, it got automatically built for both kernels. So, it might have been some problem in the package too. On the other hand, I performed upgrade while booted in 3.16, so maybe it always builds for the current kernel and any installed newer ones? – doublep May 22 '15 at 20:22
3

You can use DKMS install command (Ref: man dkms) to rebuild and install the module for specific kernel. Below an example created by removing virtualbox modules for one kernel version.

sudo dkms install <module-name>/<module-version> -k <kernel-version>

$ dkms status
vboxhost, 5.0.10, 4.2.0-21-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-22-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-23-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-25-generic, x86_64: installed

$ sudo dkms remove vboxhost/5.0.10 -k 4.2.0-22-generic
...

$ dkms status
vboxhost, 5.0.10, 4.2.0-21-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-23-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-25-generic, x86_64: installed


$ sudo dkms install vboxhost/5.0.10 -k 4.2.0-22-generic

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=4.2.0-22-generic -C /lib/modules/4.2.0-22-generic/build M=/var/lib/dkms/vboxhost/5.0.10/build...............
cleaning build area....

DKMS: build completed.

vboxdrv.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.2.0-22-generic/updates/dkms/

vboxnetflt.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.2.0-22-generic/updates/dkms/

vboxnetadp.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.2.0-22-generic/updates/dkms/

vboxpci.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.2.0-22-generic/updates/dkms/

depmod....

DKMS: install completed.

$ dkms status
vboxhost, 5.0.10, 4.2.0-21-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-22-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-23-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-25-generic, x86_64: installed
  • 1
    Great, this works. And to learn which modules and versions are known to DKMS, use dkms status command. – Ruslan Jul 9 '16 at 13:19

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.