#843113 better missing kernel headers message

Package:
dkms
Source:
dkms
Submitter:
積丹尼 Dan Jacobson
Date:
2021-01-28 16:45:05 UTC
Severity:
wishlist
#843113#5
Date:
2016-11-03 23:37:52 UTC
From:
To:
Setting up linux-image-4.8.0-1-686-pae (4.8.5-1) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.7.0-1-686-pae
I: /initrd.img.old is now a symlink to boot/initrd.img-4.7.0-1-686-pae
I: /vmlinuz is now a symlink to boot/vmlinuz-4.8.0-1-686-pae
I: /initrd.img is now a symlink to boot/initrd.img-4.8.0-1-686-pae
/etc/kernel/postinst.d/dkms:
Error! Your kernel headers for kernel 4.8.0-1-686-pae cannot be found.
Please install the linux-headers-4.8.0-1-686-pae package,
or use the --kernelsourcedir option to tell DKMS where it's located

1. That error message is not coming from that file. In fact from no
file with dkms in its name:
$ dlocate --filename-only dkms|xargs grep Error.*You 2>&-|wc -l
0

2. Please also have the message mention if one then needs to reinstall
linux-image-4.8.0-1-686-pae .

(Seen when offine installing from a /var/cache/apt/archives/ that has
some, but not all packages...)

#843113#10
Date:
2016-11-04 00:04:39 UTC
From:
To:
Control: reassign -1 dkms
[...]

That's the hook script the kernel's postint script is running, that
(indirectly) generates the error message.  The error message *does*
come from dkms.

Ben.

#843113#19
Date:
2021-01-28 16:35:37 UTC
From:
To:
I've encountered a similar issue today:

  Setting up linux-image-5.10.0-2-amd64 (5.10.9-1) ...
  I: /vmlinuz.old is now a symlink to boot/vmlinuz-5.10.0-1-amd64
  I: /initrd.img.old is now a symlink to boot/initrd.img-5.10.0-1-amd64
  I: /vmlinuz is now a symlink to boot/vmlinuz-5.10.0-2-amd64
  I: /initrd.img is now a symlink to boot/initrd.img-5.10.0-2-amd64
  /etc/kernel/postinst.d/dkms:
  dkms: WARNING: Linux headers are missing, which may explain the above failures.
        please install the linux-headers-5.10.0-2-amd64 package to fix this.

There are no "above failures", so reading this warning message is
somewhat misleading. Of course, if dkms needs some extra package, it
should ideally depend on it in some way, but this seems to be
nontrivial and is already covered by other bug reports, such as
#762061 and #951404.

But perhaps it is possible to make the above warning conditional and
only print it if there actually were any errors?