Kernel modules are not built when the kernel is upgraded

Bug #812979 reported by Alberto Milone
50
This bug affects 7 people
Affects Status Importance Assigned to Milestone
dkms (Ubuntu)
Fix Released
Medium
Alberto Milone

Bug Description

When a new kernel is installed, a kernel hook in postinst.d is called and, in my case I saw that dkms_autoinstaller was called in the following way when I upgraded to linux-image 3.0.0-5-generic:

/usr/lib/dkms/dkms_autoinstaller start 3.0.0-5-generic

(dkms_autoinstaller, in turn, calls "dkms autoinstall")

However no module was built against the new kernel even though I have nvidia-current, nvidia-173 and fglrx installed on my system (the relevant kernel headers are installed too):

:~$ dkms status
fglrx, 8.861, 3.0-2-generic, x86_64: installed
nvidia-173, 173.14.30, 3.0-0-generic, x86_64: installed
nvidia-173, 173.14.30, 3.0-2-generic, x86_64: installed
nvidia-current, 275.09.07, 3.0-0-generic, x86_64: installed
nvidia-current, 275.09.07, 3.0-2-generic, x86_64: installed

I tried to get a log but it was pretty useless:
:~$ sudo /usr/lib/dkms/dkms_autoinstaller start 3.0.0-5-generic &> dkms_problem.log

Then I added "set -xv" in /usr/sbin/dkms to make it more verbose:

:~$ sudo /usr/lib/dkms/dkms_autoinstaller start 3.0.0-5-generic &> dkms_problem_verbose.log

In the log I noticed the following line:

++ make_command='make module KERNDIR=/lib/modules/3.0-2-generic IGNORE_XEN_PRESENCE=1 IGNORE_CC_MISMATCH=1 SYSSRC=/lib/modules/3.0.0-5-generic/build'

The line comes from one of the Nvidia drivers' dkms.conf:
MAKE[0]="make module KERNDIR=/lib/modules/$kernelver IGNORE_XEN_PRESENCE=1 IGNORE_CC_MISMATCH=1 SYSSRC=$kernel_source_dir"

This (and some other lines in the log) clearly show that $kernelver is set to $(uname -r) in setup_kernel_arches() (in dkms) while $kernel_source_dir is correct.

I ported my kernel detection work from the common.postinst template to the dkms script so as to make sure that we always build against the newest kernel when no kernel version is specified.

Apply the attached patch to dkms (and add set -xv) and then try to reproduce the problem:

:~$ sudo /usr/lib/dkms/dkms_autoinstaller start 3.0.0-5-generic &> dkms_problem_fix_verbose.log

And here's the result:

:~$ dkms status
fglrx, 8.861, 3.0.0-5-generic, x86_64: installed
fglrx, 8.861, 3.0-2-generic, x86_64: installed
nvidia-173, 173.14.30, 3.0.0-5-generic, x86_64: installed
nvidia-173, 173.14.30, 3.0-0-generic, x86_64: installed
nvidia-173, 173.14.30, 3.0-2-generic, x86_64: installed
nvidia-current, 275.09.07, 3.0.0-5-generic, x86_64: installed
nvidia-current, 275.09.07, 3.0-0-generic, x86_64: installed
nvidia-current, 275.09.07, 3.0-2-generic, x86_64: installed

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: dkms 2.2.0.1-0ubuntu1 [modified: usr/sbin/dkms]
ProcVersionSignature: Ubuntu 3.0-2.3-generic 3.0.0-rc4
Uname: Linux 3.0-2-generic x86_64
NonfreeKernelModules: fglrx
Architecture: amd64
Date: Tue Jul 19 17:57:44 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20110302)
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: dkms
UpgradeStatus: Upgraded to oneiric on 2011-07-19 (0 days ago)

Revision history for this message
Alberto Milone (albertomilone) wrote :
Revision history for this message
Alberto Milone (albertomilone) wrote :
Revision history for this message
Alberto Milone (albertomilone) wrote :
Revision history for this message
Alberto Milone (albertomilone) wrote :
Revision history for this message
Alberto Milone (albertomilone) wrote :
Revision history for this message
Alberto Milone (albertomilone) wrote :

After discussing the issue with Mario, it turns out that a much simpler solution exists (as we're dealing with a regression). We should simply use the kernel version passed to the dkms_autoinstaller.

I ran the following command with my new patch and all went well:

sudo /usr/lib/dkms/dkms_autoinstaller start 3.0.0-5-generic &> dkms_simpler_solution.log

:~$ dkms status
fglrx, 8.861, 3.0.0-5-generic, x86_64: installed
fglrx, 8.861, 3.0-2-generic, x86_64: installed
nvidia-173, 173.14.30, 3.0.0-5-generic, x86_64: installed
nvidia-173, 173.14.30, 3.0-0-generic, x86_64: installed
nvidia-173, 173.14.30, 3.0-2-generic, x86_64: installed
nvidia-current, 275.09.07, 3.0.0-5-generic, x86_64: installed
nvidia-current, 275.09.07, 3.0-0-generic, x86_64: installed
nvidia-current, 275.09.07, 3.0-2-generic, x86_64: installed

Revision history for this message
Alberto Milone (albertomilone) wrote :
Revision history for this message
Alberto Milone (albertomilone) wrote :
Changed in dkms (Ubuntu):
assignee: nobody → Alberto Milone (albertomilone)
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Mario Limonciello (superm1) wrote :

This has been committed upstream, I'd just like to make sure it's the same root cause as https://bugzilla.redhat.com/show_bug.cgi?id=702483 before doing another release.
http://linux.dell.com/cgi-bin/gitweb/gitweb.cgi?p=dkms.git;a=commit;h=3a0115cf1725b50141b0be9810a0a2df358c4b2e

Changed in dkms (Ubuntu):
status: Triaged → Fix Committed
tags: added: patch
Revision history for this message
Andy Whitcroft (apw) wrote :

@Mario -- I do wonder why this replacement does not follow the form of its predecessor, and do something like below:

  kernel=`uname -r`
  [ -n "$2" ] && kernel="$2"

It does seem a lot of smarts have gone since the version in Natty.

Revision history for this message
Mario Limonciello (superm1) wrote :

Andy,

A lot of the smarts have been moved out of helper scripts and into DKMS itself to reduce code duplication with the bash rewrite. It's fixed in the latest release, we are just waiting for an archive admin to sync it. (bug 811231).

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dkms - 2.2.0.2-1

---------------
dkms (2.2.0.2-1) unstable; urgency=low

  [ Mario Limonciello ]
  * [c5846b6] Imported Upstream version 2.2.0.2
    - Doesn't leave files in /tmp (Closes: #633802)
    - Autoinstall works on multiple kernels (Closes: #634979) (LP: #812979)
    - PRE_BUILD command working directory fix. (LP: #812088)
  * [83b5f6e] Drop kfreebsd.patch. Merged upstream

  [ Giuseppe Iuculano ]
  * [a80ecc5] Updated VCS control field

dkms (2.2.0.1-3) unstable; urgency=low

  * [c9f7ed0] Fixed kFreeBSD subdirs check
  * [57c5c9d] Removed improved-error-messages.patch
  * [370ff7b] Remove debian-lsb.patch. Now Ubuntu can sync from Debian

dkms (2.2.0.1-2) unstable; urgency=low

  * [6b2d392] Run depmod command only in Linux.
    Thanks to Robert Millan (Closes: #631657)

dkms (2.2.0.1-1) unstable; urgency=low

  * [18353fe] Imported Upstream version 2.2.0.1
  * [2a56b4e] Refreshed and removed patches merged upstream.
  * [c552af9] Use linux-headers-686-pae and linux-headers-amd64 in Recommends
    (Closes: #628873)
 -- Mario Limonciello <email address hidden> Wed, 03 Aug 2011 06:05:34 +0000

Changed in dkms (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
PeterPall (peterpall) wrote :

Did get a new kernel installed by today's update and bcmwl-kernel-source wasn't automatically rebuilt. Is there anybody else who can confirm that the bug is not fixed yet?

Revision history for this message
PeterPall (peterpall) wrote :
Revision history for this message
PeterPall (peterpall) wrote :

The last kernel update did automatically trigger the build of the kernel modules I need => Marking this bug as solved.

Revision history for this message
Anthony LoRe (someitalian123) wrote :

Are you sure that this bug is fixed, cause I have dkms 2.2.0.2-1 installed and I'm still having issues

https://bugs.launchpad.net/ubuntu/+source/dkms/+bug/917980

Revision history for this message
PeterPall (peterpall) wrote : Re: [Bug 812979] Re: Kernel modules are not built when the kernel is upgraded

I'm using precise pangolin now and there the bug didn't reappear and interesting decided to work fine one day for me. But that of course does not mean that the problem is really fixed for everybody.

Anthony LoRe <email address hidden> wrote:

>Are you sure that this bug is fixed, cause I have dkms 2.2.0.2-1
>installed and I'm still having issues
>
>https://bugs.launchpad.net/ubuntu/+source/dkms/+bug/917980
>
>--
>You received this bug notification because you are subscribed to a
>duplicate bug report (816594).
>https://bugs.launchpad.net/bugs/812979
>
>Title:
> Kernel modules are not built when the kernel is upgraded
>
>To manage notifications about this bug go to:
>https://bugs.launchpad.net/ubuntu/+source/dkms/+bug/812979/+subscriptions

Revision history for this message
Anthony LoRe (someitalian123) wrote :

I just upgraded to dkms 2.2.0.3-1 which is the version used in precise and I still have the problem. The module compiles successfully but it's using the wrong headers. so naturally when I try to load it with modprobe i get the following error

FATAL: Error inserting rt3562sta (/lib/modules/3.1.5-030105-generic/updates/dkms/rt3562sta.ko): Invalid argument

Revision history for this message
Mario Limonciello (superm1) wrote :

Anthony Lore: The original bug was fixed, can you please file your own bug to track the problem down. It's entirely possible that the dkms make.conf or the Makefile for this other module you are using is broken too. So in your new bug, please include the dkms.conf and the Makefile and that failed make.log and we can review it there.

Thanks

Revision history for this message
PeterPall (peterpall) wrote : Re: [Bug 812979] Re: Kernel modules are not built when the kernel is upgraded

My original problem was that dkms didn't even try to build the modules.
If it does I an afraid you'll have to file a separate bug report for
your problem.

Kind regards,

   Gunter.

Revision history for this message
Anthony LoRe (someitalian123) wrote :

I already have filled the bug, it was in the link I posted up there. I'll post it again here in this comment.

https://bugs.launchpad.net/ubuntu/+source/dkms/+bug/917980

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.