Hi,
I understand.
I found why the “linux-headers-generic” and “linux-headers-4.13.0-37-generic” were removed, it was because an application (“multisystem”, maybe ?) asked my sudo password to install “virtualbox-5.2:i386” :
$ zgrep -B5 "^Remove:.*linux-headers-[^:]*:amd64" /var/log/apt/history.log.1.gz | egrep "^$|Start-Date|Commandline|Remove|linux-headers-[^:]*:amd64"
Start-Date: 2018-03-15 10:55:40
Commandline: apt-get --quiet install -y --force-yes virtualbox-5.2:i386
Remove: linux-headers-generic:amd64 (4.13.0.37.40), notification-daemon:amd64 (3.20.0-1), linux-headers-4.13.0-37-generic:amd64 (4.13.0-37.42), grub-efi-amd64:amd64 (2.02~beta3-4ubuntu7.2), grub-efi-amd64-signed:amd64 (1.85.2+2.02~beta3-4ubuntu7.2)
But, each time (I did this twice or thrice) I remove all “cuda” and “nvidia” packages and reinstall the “nvidia-390 package”, it does NOT install “linux-headers-generic” nor “linux-headers-$(uname -r)” packages.
You said that the “the dependency to the headers is there”, but in fact the “nvidia-390” package does NOT depend on “linux-headers”, it depends on “dkms”.
But then “dkms” does NOT depend on “linux-headers-generic”, it actually only RECOMMENDS the “linux-headers-generic” :
$ dpkg -s nvidia-390 | grep dkms
Depends: x11-common (>= 1:7.0.0), make, sed (>> 3.0), dkms, linux-libc-dev, libc6-dev, patch, acpid, lib32gcc1, libc6-i386, passwd, adduser, xserver-xorg-legacy, libc6 (>= 2.2.5), libgl1, libwayland-client0 (>= 1.3.92), libwayland-server0 (>= 1.2.0), libx11-6, libxext6, xorg-video-abi-11 | xorg-video-abi-12 | xorg-video-abi-13 | xorg-video-abi-14 | xorg-video-abi-15 | xorg-video-abi-18 | xorg-video-abi-19 | xorg-video-abi-20 | xorg-video-abi-23, xserver-xorg-core
$ dpkg -s dkms | grep linux-headers
Recommends: fakeroot, sudo, linux-headers-686-pae | linux-headers-amd64 | linux-headers-generic | linux-headers, lsb-release
This problems did not occur because of NVIDIA but because of Debian SID “dkms” (https://packages.debian.org/sid/dkms) missing dependency (ies).
Do you think, it could be possible to add a “linux-headers-generic” dependency to your “nvidia-xyz” packages ?