On one of my machines: zira:~> ll /lib/modules total 32 drwxr-xr-x 2 root root 4096 2021-10-19 02:35:29 5.14.0-1-amd64/ drwxr-xr-x 2 root root 4096 2021-11-04 23:17:00 5.14.0-2-amd64/ drwxr-xr-x 2 root root 4096 2021-11-22 04:14:28 5.14.0-3-amd64/ drwxr-xr-x 2 root root 4096 2022-01-04 20:37:12 5.14.0-4-amd64/ drwxr-xr-x 2 root root 4096 2022-02-15 12:07:48 5.15.0-1-amd64/ drwxr-xr-x 2 root root 4096 2022-02-25 12:20:03 5.15.0-3-amd64/ drwxr-xr-x 4 root root 4096 2022-02-17 12:07:07 5.16.0-1-amd64/ drwxr-xr-x 4 root root 4096 2022-02-25 12:17:30 5.16.0-2-amd64/ with, for instance: zira:~> ll /lib/modules/5.14.0-1-amd64 total 24 -rw-r--r-- 1 root root 45 2021-10-19 02:35:29 modules.alias -rw-r--r-- 1 root root 12 2021-10-19 02:35:29 modules.alias.bin -rw-r--r-- 1 root root 0 2021-10-19 02:35:29 modules.builtin.alias.bin -rw-r--r-- 1 root root 0 2021-10-19 02:35:29 modules.builtin.bin -rw-r--r-- 1 root root 0 2021-10-19 02:35:29 modules.dep -rw-r--r-- 1 root root 12 2021-10-19 02:35:29 modules.dep.bin -rw-r--r-- 1 root root 0 2021-10-19 02:35:29 modules.devname -rw-r--r-- 1 root root 55 2021-10-19 02:35:29 modules.softdep -rw-r--r-- 1 root root 49 2021-10-19 02:35:29 modules.symbols -rw-r--r-- 1 root root 12 2021-10-19 02:35:29 modules.symbols.bin while the only currently installed kernels are the 5.16.* ones. And for the modules: zira:~> dkms status nvidia-legacy-390xx/390.147, 5.16.0-1-amd64, x86_64: installed nvidia-legacy-390xx/390.147, 5.16.0-2-amd64, x86_64: installed No such issue on another machine where dkms 2.8.4-4 is still installed.
# dkms remove nvidia-legacy-390xx/390.147 -k 5.16.0-1-amd64 Module nvidia-legacy-390xx-390.147 for kernel 5.16.0-1-amd64 (x86_64). Before uninstall, this module version was ACTIVE on this kernel. nvidia-legacy-390xx.ko: - Uninstallation - Deleting from: /lib/modules/5.16.0-1-amd64/updates/dkms/ - Original module - No original module was found for this module on this kernel. - Use the dkms install command to reinstall any previous module version. nvidia-legacy-390xx-modeset.ko: - Uninstallation - Deleting from: /lib/modules/5.16.0-1-amd64/updates/dkms/ - Original module - No original module was found for this module on this kernel. - Use the dkms install command to reinstall any previous module version. nvidia-legacy-390xx-drm.ko: - Uninstallation - Deleting from: /lib/modules/5.16.0-1-amd64/updates/dkms/ - Original module - No original module was found for this module on this kernel. - Use the dkms install command to reinstall any previous module version. nvidia-legacy-390xx-uvm.ko: - Uninstallation - Deleting from: /lib/modules/5.16.0-1-amd64/updates/dkms/ - Original module - No original module was found for this module on this kernel. - Use the dkms install command to reinstall any previous module version. do_depmod 5.16.0-1-amd64 depmod: WARNING: could not open modules.order at /lib/modules/5.16.0-1-amd64: No such file or directory depmod: WARNING: could not open modules.builtin at /lib/modules/5.16.0-1-amd64: No such file or directory
fyi: I'm force merging duplicate reports to #996104. The bug was fixed upstream in 2.8.8, but Debian upgraded to 3.0.3 in the meantime (bullseye never had this bug, because it only has version 2.8.4). I assume folks tracking testing are going to have to manually downgrade to 2.8.4, or upgrade to 3.0.3, because I think it's unlikely that there will be a 2.8.8 release just for testing.
Bug 1006431 may have been fixed at the same time as bug 996104, but this was not the same bug: bug 996104 was typos in the /etc/kernel/prerm.d/dkms script, so that the dkms remove -m $name -v $vers -k $inst_kern -a $arch command failed due to incorrect arguments. So what I did was to run the correct command manually. This had the effect to remove the installed module, but was still leaving some files there. Or perhaps this command is expected to be run while the kernel is still installed (it is normally run as a prerm.d script, while I ran it after the kernel was removed).