There isn't enough detail to be sure, but this might be the same issue I hit on sid yesterday, so adding it here. It might also count as a dkms bug for all I know.
In my case, zfs-dkms fails to build against either of my currently installed kernels (5.19.0-1-amd64, 6.0.0-5-amd64), but only after updating the package dkms to version 3.0.8-2 (from 3.0.8-1). This appears to be the result of the changes to the export-CC.patch: https://sources.debian.org/patches/dkms/3.0.8-2/export-CC.patch/ The 3.0.8-2 version adds the following commands to the prepare_build() function: export CC=$CC export MAKEFLAGS="--environment-overrides" I've verified that zfs-dkms builds fine for me if I temporarily comment out the second line from /usr/sbin/dkms. A build log for a failed attempt (with the flag present) is at: https://0x0.st/o0fu.txt The log also includes a dump of the environment variables at the start of the build, from a command I added to the dkms script. Digging a little deeper, it appears that when `--environment-overrides` is set, a number of required command-line options (in particular, an -I option to add /var/lib/dkms/zfs/2.1.6/build/include in the include search path) fail to be set. I didn't manage to trace why exactly that is, but you can see both a failing and a working example (for one object file) at: https://0x0.st/o0EC.txt FWIW, it seems like the build environment dkms uses inherits whatever was present in the environment when apt was called. If this is the case, then it feels to me including the `--environment-overrides` flag has potential to make things brittle. The effect of the flag is to: "Give variables taken from the environment precedence over variables from makefiles." Any arbitrary environment variables the user may have set for their own purposes might be unexpectedly overriding important variables from the Makefile(s).