dkms postinst should handle missing headers

Bug #1427175 reported by Stefan Bader
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
dkms (Ubuntu)
Won't Fix
High
Unassigned

Bug Description

In the kernel post-install script of DKMS we have the following:

if [ -x /usr/lib/dkms/dkms_autoinstaller ]; then
    exec /usr/lib/dkms/dkms_autoinstaller start $inst_kern > /dev/null
fi

if ! _check_kernel_dir $inst_kern ; then
    echo "dkms: WARNING: $kernel headers are missing, which may explain the above failures." >&2
    echo " please install the $header_pkg package to fix this." >&2
fi

Supposedly the intention is to produce a warning if the kernel-headers are missing (might also cause the overall exit code to be 0). But execution of this script stops and is replaced by the dkms_autoinstaller when using exec. So it probably should be:

if [ -x /usr/lib/dkms/dkms_autoinstaller ]; then
  if ! /usr/lib/dkms/dkms_autoinstaller start $inst_kern > /dev/null; then
    if !_check_kernel_dir $inst_kern ; then
   ...

Tags: patch
Revision history for this message
Stefan Bader (smb) wrote :

Forgot to mention: the post-inst script is at: /etc/kernel/postinst.d/dkms.

Changed in dkms (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Stefan Bader (smb) wrote :

Alberto, did you hear anything back about this? Or should we go ahead and come up with something to try for Vivid. I could prepare something.

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

Sorry, I've been busy with other work.

@Mario: any ideas about this?

Revision history for this message
Mario Limonciello (superm1) wrote : Re: [Bug 1427175] Re: dkms postinst should handle missing headers

Sorry i'm really consumed with other stuff right now too.

That sounds reasonable to me.

On 03/11/2015 05:48 AM, Alberto Milone wrote:
> Sorry, I've been busy with other work.
>
> @Mario: any ideas about this?
>

Revision history for this message
Stefan Bader (smb) wrote :

Ok, let me put something together to start trying in Vivid and then (if it looks good) we can work backwards from there.

Revision history for this message
Stefan Bader (smb) wrote :

So this turns out to offer many twists and turns. Looking closer at a kernel installation which caused FTBS reports from DKMS, I found that the apt installer is unpacking all packages before calling the post install hooks. So all checking for existing headers that the postinst hook script does is succeeding as the files are already there.

From what I saw it looked like the DKMS autobuild was attempted 3 times. Once for kernel-image and another one for kernel-image-extra, both of those failed. Then another one for headers which looked to be successful. After that I checked the hooks and found that we (Debian/Ubuntu) seem to have two places. The kernel postinst hook, but also one exclusively for the headers. So it seemed reasonable to reduce this to one hook. After all building external modules only makes sense after the headers are configured.

The attached patch would do this and also fix up the hook to do what we think was intended. *However*, this actually was not our real problem. The _REAL_ problem is the ingenious cross-module action (I have an itch to call it evil layer violation) which the nvidia driver is causing (Alberto, is this your work?). Doing a complete run of DKMS autoinstallation seems to have a certain chance to always fail on the first attempt. I *should* have been suspicious after nvidia seemed to be the only one affected by FTBS reports which had everything installed after all. Really I am not entirely sure any DKMS module ever should meddle in another modules build directory like nvidia-uvm does. >:-(

Bottom line: The changes to the DKMS package that I attached might be nice improvements, but not necessarily worth backporting. The real fix very likely has to be made to the nvidia DKMS build procedure.

tags: added: patch
Revision history for this message
Stefan Bader (smb) wrote :

So Alberto, I filed bug #1431753 against one nvidia source package. Though this likely needs the same approach in all of those having the nvidia + nvidia-uvm split. I re-checked this morning and can now say that accessing the build directory of another DKMS module never can work because the kernel post-install hook will end up compiling the DKMS modules in parallel (to speed up that step). And this will rather likely fail with a setup like nvidia. It currently only gets along because we trigger the build (accidentally or not) 3 times.

Revision history for this message
Stefan Bader (smb) wrote :

So, while the postinst hook script still has code which never gets executed, this is not really harmful as the dkms call itself prints the same and actually does not return an error on a failure to build. Running the hook more often than required also does not seem to be harmful. It actually helps to have any nvidia driver after upgrades.
So I am closing this one as won't fix. Mario, if you feel to re-open it or pick parts of this if you like.

Changed in dkms (Ubuntu):
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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