TL;DR (2026-07-12 update): If your hardware supports the 610.x production branch (RTX 2060+, most modern cards), use
nvidia-driverfromcontribnon-free repo per Debian Wiki. It's actively maintained and already supports Kernel 7.0+. The 550/580 patch below is a band-aid for legacy/mobile cards (RTX 3050 Mobile, Quadro P1000) where upgrading to 610 is not an option due to CUDA dependency or hardware constraints.
Hitting a DKMS rebuild loop after
unattended-upgradeinstalls new kernel headers? Jump to §5: DKMS Loop Diagnosis & Triage — that's the most common reason this gist shows up in search results, and it's the section most Debian/Ubuntu users actually need before touching the patches below.
This is an RFC (Request for Comments) patch series. I derived these patches from forensic analysis of the kernel 7.0 API changes, validated with build logs from the community. Use at your own risk. If you are on 7.0+ and willing to test the patches, please leave a comment with your build logs!
If you just want a working system right now, pin to kernel 6.19:
sudo apt-mark hold linux-image-amd64 linux-headers-amd64 nvidia-driver nvidia-kernel-dkms- The Problem Architecture
- Branch Compatibility Matrix
- RFC Fix 1: VMA API (Three patches)
- Fix 2: Wayland USB-C / D3cold Lockups
- [NEW 2026-11-14] RFC Fix 3: the conftest that lies on every kernel ≥ 6.9 — silent wrong-API detection → 2.500-3.000
WARN_ON/day - [NEW 2026-11-14] Correction: what actually failed on the author's machine — OOM, not API; half-installed packages; and why hand-editing
/usr/srcbackfires - [NEW 2026-07-12 v3] DKMS Loop Diagnosis & Triage — universal recipe for any Debian/Ubuntu/Arch/Fedora user
- Why Distrobox + Arch is the Escape Hatch
- References
- Acknowledgements
- Changelog
graph TD
subgraph "Kernel 7.0 API Breakage — NVIDIA 550/580 Branch"
A["VMA_LOCK_OFFSET removed from<br/>include/linux/mm_types.h"] --> C["DKMS build fails in nv-mmap.c"]
B["__is_vma_write_locked()<br/>signature: 2 args → 1 arg"] --> C
E["dma_fence_signal_locked()<br/>return type: int → void"] --> D["DKMS build fails in nvidia-drm/<br/>nvidia-dma-fence-helper.h"]
F["strlcpy() removed<br/>(580.x only)"] --> D
end
subgraph "Wayland / ACPI D3cold Conflict"
G["USB-C Monitor Plugged"] --> H["GPU wakes from D3cold"]
H --> I{"Wayland compositor<br/>EGL context established?"}
I -->|"No — compositor ignores NVIDIA"| J["GPU panic → fans 100%"]
I -->|"Yes — nvidia_drm.fbdev=1<br/>NVreg_DynamicPowerManagement=0x02"| K["Monitor works normally"]
end
| # | Issue | Old API (≤6.x) | New API (7.0+) | File Affected | Patch |
|---|---|---|---|---|---|
| 1 | VMA_LOCK_OFFSET |
Defined in include/linux/mm_types.h |
Removed — must redefine as (1u << 31) |
nvidia/nv-mmap.c |
nvidia-7.0-vma.patch |
| 2 | __is_vma_write_locked(vma, &seq) |
2 arguments | 1 argument — now __is_vma_write_locked(vma) |
nvidia/nv-mmap.c |
nvidia-7.0-vma.patch |
| 3 | dma_fence_signal_locked() |
Returns int |
Returns void |
nvidia-drm/nvidia-dma-fence-helper.h |
nvidia-7.0-drm.patch |
| 4 | strlcpy() |
Available | Removed — replaced by strscpy() (580.x only) |
Multiple | sed pre-build |
| 5 | __vm_flags field in struct vm_area_struct |
Present — accessed via ACCESS_PRIVATE(vma, __vm_flags) |
Removed — replaced by vm_flags_reset() inline |
common/inc/nv-mm.h |
nvidia-7.0-vmflags.patch |
Note 1: Error #4 (
strlcpy) affects NVIDIA driver branches 580.x and newer, not 550.x. Note 2: Error #3 (nvidia-dma-fence-helper.h) is a second build failure that appears AFTER fixing the VMA offset. Multiple testers hit this regardless of branch (550 or 580). Note 3: Error #5 (__vm_flagsremoval) appears on kernels 7.0.2+ — earlier 7.0.x point releases may not have this yet. If your build fails innv-mm.hafter applying patches 1-3, this is likely the cause.
| NVIDIA Branch | Kernel ≤6.19 | Kernel 7.0–7.1 | Kernel 7.2+ | DKMS Patch Required |
|---|---|---|---|---|
| 550.163.01 (RTX 3050 Mobile, older Quadro) | ✅ Native | vma.patch + drm.patch + vmflags.patch |
||
| 580.x (Quadro P1000+ for CUDA) | ✅ Native | vma.patch + drm.patch + vmflags.patch + strscpy sed |
||
| 595.x | ✅ Native | ✅ Native | ✅ Native | None needed |
| 610.43.02 (production, RTX 20+) | ✅ Native | ✅ Native | ✅ Native | None needed (recommended path) |
Recommendation:
- Hardware supported by 610: Use
contrib non-freerepo (nvidia-drivermeta-package). Per Debian Wiki NvidiaGraphicsDrivers, this is the clean, supported path. - Hardware locked to 550/580 by CUDA/workstation constraints: Apply the patches in this gist.
The original patch only fixed nv-mmap.c. dCSeven reported in the gist comments that there's also a build failure in nvidia-drm/nvidia-dma-fence-helper.h that must be patched separately.
(See attached nvidia-7.0-vma.patch file in this Gist)
(See attached nvidia-7.0-drm.patch file in this Gist)
(See attached nvidia-7.0-vmflags.patch file in this Gist)
When do you need Patch 1c? If patches 1a+1b apply cleanly but your build still fails in
common/inc/nv-mm.h, you are on kernel 7.0.2 or later where__vm_flagswas removed fromstruct vm_area_struct. Apply Patch 1c additionally.
# 0. The patch files MUST live in <source>/patches/ — DKMS applies them from
# $build_dir/patches/$p and does not copy them (dkms:1449).
sudo mkdir -p /usr/src/nvidia-current-550.163.01/patches/
sudo cp nvidia-7.0-vma.patch nvidia-7.0-drm.patch nvidia-7.0-vmflags.patch \
nvidia-conftest-return-type.patch \
/usr/src/nvidia-current-550.163.01/patches/
# 1. Add to /usr/src/nvidia-current-550.163.01/dkms.conf:
# NOTE: indices must be CONTIGUOUS from 0 — dkms iterates
# index=0..${#PATCH[@]}-1 and ${#PATCH[@]} counts ELEMENTS.
PATCH[0]="nvidia-7.0-vma.patch"
PATCH_MATCH[0]="^7\\.[0-9]+"
PATCH[1]="nvidia-7.0-drm.patch"
PATCH_MATCH[1]="^7\\.[0-9]+"
PATCH[2]="nvidia-7.0-vmflags.patch"
PATCH_MATCH[2]="^7\\.[2-9]+\\.[0-9]+" # kernel 7.2+
PATCH[3]="nvidia-conftest-return-type.patch" # no PATCH_MATCH: applies to every kernel
# 580 branch only: pre-process strlcpy → strscpy
if [ "$(grep -c '"580"' /usr/src/nvidia-current-*/dkms.conf 2>/dev/null)" -gt 0 ]; then
cd /usr/src/nvidia-current-580.*/
sudo sed -i 's/strlcpy/strscpy/g' $(find . -name "*.c")
fi
# --force: without it dkms reuses the previously built .ko (0 s, stale module).
# parallel_jobs: never -j$(nproc) on a memory-constrained box (the OOM of §C).
sudo parallel_jobs=4 dkms build --force -m nvidia-current -v 550.163.01 -k $(uname -r)
sudo parallel_jobs=4 dkms install -m nvidia-current -v 550.163.01 -k $(uname -r)
sudo update-initramfs -u -k $(uname -r)In hybrid Optimus laptops (AMD iGPU + NVIDIA dGPU), the USB-C DisplayPort alt-mode is physically wired to the NVIDIA dGPU. When your compositor routes rendering through the AMD iGPU for power saving, the NVIDIA GPU enters D3cold. Hotplug a monitor → GPU wakes up but Wayland never establishes an EGL context → panic and fans at 100%.
1. Kernel Parameters (GRUB) — append to GRUB_CMDLINE_LINUX_DEFAULT:
nvidia-drm.modeset=1 nvidia_drm.fbdev=1
Run sudo update-grub and reboot.
2. Modprobe Power Management Rule — create /etc/modprobe.d/nvidia-pm.conf:
options nvidia NVreg_DynamicPowerManagement=0x02
This one is not about kernel 7.0. It affects the kernel you are running right now, it is silent, and it is a driver bug — not a kernel bug.
On any kernel ≥ 6.9, the 550.x driver probes struct drm_connector_list_iter as absent, even though the kernel has provided it since Linux 4.11 (2016). The driver then compiles its legacy connector-iterator branch, which carries:
WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));That WARN_ON sits in nv_drm_revoke_modeset_permission() — the path taken on every close() of a DRM file descriptor. Measured on the author's machine (ASUS TUF A15 FA506IC, Debian 14 "forky", kernel 6.19.14+deb14-amd64, driver 550.163.01): 6,839 WARN_ON events in 2d15h of uptime, each dumping a full register block into the journal. Triggers observed: chromium (49 % of events), Steam's fossilize_replay (22 %), and niri's own master drop.
Correction (2026-11-14): these are WARNINGS, not oops, and they are not fatal.
panic_on_warn=0is the default, so theud2in the__bug_tableprints the warning and execution continues. That machine's boot journal contains 0 "Kernel panic" and 0 "BUG:" entries. The cost is journal noise, kernel-side overhead and measurable input latency (libinputreported "event processing lagging behind by 38-53 ms") — not a crash. Claims that this "poisons DRM" and "kills the compositor" have not been demonstrated; the causal chain is unproven.
Linux 6.9 enabled -Werror=return-type in the kernel build. NVIDIA's conftest.sh probes the type with:
#include <drm/drm_connector.h>
int conftest_drm_connector_list_iter(void) {
struct drm_connector_list_iter conn_iter;
}No return → with -Werror=return-type the compile fails → compile_check_conftest concludes "type absent" → #undef NV_DRM_CONNECTOR_LIST_ITER_PRESENT → the legacy branch gets compiled.
It is the only one of the 97 "types" probes in conftest.sh with this shape; the other 96 use return offsetof(...) and are unaffected:
$ grep -c 'compile_check_conftest.*"types"' conftest.sh # 97
1 broken by -Werror=return-type (NV_DRM_CONNECTOR_LIST_ITER_PRESENT)
96 fine
The matching "functions" probe for drm_connector_list_iter_begin() is not affected, which is why the function was detected correctly while the struct was not. NVIDIA inverts the "functions" category on purpose (conftest.sh:300-321): it calls the function with a deliberately wrong signature, so a compile failure means "present":
if [ "${CAT}" = "functions" ]; then
# The logic for "functions" compilation tests is inverted compared to
# other compilation steps: if the function is present, the code
# snippet will fail to compile because the function call won't match
# the prototype.
echo "#undef ${DEF}" | append_conftest "${CAT}"
else
echo "#define ${DEF} ${VAL}" | append_conftest "${CAT}"
fiCompile the snippet with the kernel's own build system:
mkdir /tmp/lzt-ctest && cd /tmp/lzt-ctest
printf 'obj-m := ctest.o\n' > Makefile
cat > ctest.c <<'EOF'
#include <drm/drm_connector.h>
int conftest_drm_connector_list_iter(void) {
struct drm_connector_list_iter conn_iter;
}
EOF
make -C /lib/modules/6.19.14+deb14-amd64/build M=/tmp/lzt-ctest modulesctest.c:4:1: error: control reaches end of non-void function [-Werror=return-type]
Note what is not in that output: no "unknown type" error. The struct is there. The probe fails for a reason that has nothing to do with the API.
--- a/conftest.sh
+++ b/conftest.sh
@@ -4331,6 +4331,7 @@
#include <drm/drm_connector.h>
int conftest_drm_connector_list_iter(void) {
struct drm_connector_list_iter conn_iter;
+ return 0;
}"
compile_check_conftest "$CODE" "NV_DRM_CONNECTOR_LIST_ITER_PRESENT" "" "types"Wire it into dkms.conf and put the file in <source>/patches/:
sudo mkdir -p /usr/src/nvidia-current-550.163.01/patches/
sudo cp nvidia-conftest-return-type.patch /usr/src/nvidia-current-550.163.01/patches/
# in /usr/src/nvidia-current-550.163.01/dkms.conf
PATCH[0]="nvidia-conftest-return-type.patch"Two DKMS traps that cost real debugging time (both fail silently — no error, no warning, the patch is simply never applied):
Trap 1 — the patch file must live in <source>/patches/, not in the source root. DKMS applies patches from $build_dir/patches/$p (dkms:1449) and it does not copy them: build_dir is a cp -a of the source tree, so the file has to be inside <source>/patches/ to end up inside <build>/patches/.
Trap 2 — the PATCH[] indices must be contiguous from 0. DKMS builds the patch list with
for ((index=0; index < ${#PATCH[@]}; index++)); doand ${#PATCH[@]} counts elements, not the highest index. A lone PATCH[3]="…" gives ${#PATCH[@]}=1, so the loop only ever inspects PATCH[0] — and your patch is ignored without a single message. If you define only the conftest patch, it must be PATCH[0]. If you stack it on top of the three patches above, use PATCH[3] (0,1,2,3 is contiguous and works).
No PATCH_MATCH on purpose. The fix is a no-op on kernels < 6.9 (it only adds a return 0; to a probe that already compiled there), so applying it everywhere is safe — and it avoids depending on DKMS' regex matching, which did not behave as expected in practice.
Always build with --force. Without it, dkms build sees the module as already built for that kernel and reuses the previous .ko (the run takes 0 s and you "verify" the stale module):
sudo parallel_jobs=4 dkms build --force -m nvidia-current -v 550.163.01 -k $(uname -r)
sudo parallel_jobs=4 dkms install -m nvidia-current -v 550.163.01 -k $(uname -r)
sudo update-initramfs -u -k $(uname -r)The legacy branch is a macro expansion, so the warning surfaces at every use of nv_drm_for_each_connector() — on the author's machine at nvidia-drm/nvidia-drm-drv.c:1226, inside nv_drm_revoke_modeset_permission():
WARNING: nvidia-drm/nvidia-drm-drv.c:1226 at nv_drm_revoke_modeset_permission+0x348/0x3a0 [nvidia_drm], CPU#15: linux-wallpaper/1979816
With the patch, NV_DRM_CONNECTOR_LIST_ITER_PRESENT is defined, so the driver calls nv_drm_connector_list_iter_begin() to initialise the iterator and the macro expands to drm_for_each_connector_iter() — the WARN_ON is never compiled.
Gate 1 — the modern API is now used (0 before, 3 after):
$ nm -u /lib/modules/$(uname -r)/updates/dkms/nvidia-current-drm.ko | grep -c drm_connector_list_iter
3Gate 2 — the number of mutex_is_locked call sites collapses (7 before, 1 after):
$ objdump -r /lib/modules/$(uname -r)/updates/dkms/nvidia-current-drm.ko | grep -c mutex_is_locked
1Do not use nm -u | grep mutex_is_locked as the gate: one call site legitimately survives. nvidia-drm/nvidia-drm-connector.c:167 carries an unconditional
BUG_ON(!mutex_is_locked(&dev->mode_config.mutex));which is unrelated to the iterator and is compiled in both builds. (It is a BUG_ON, i.e. fatal if it ever fires — it has not fired on the author's machine, whose boot journal contains zero BUG: entries. Worth watching separately.)
And the probe result itself, before compiling anything:
$ grep CONNECTOR_LIST_ITER /var/lib/dkms/nvidia-current/*/build/conftest/compile-tests/drm_connector_list_iter.h
#define NV_DRM_CONNECTOR_LIST_ITER_PRESENT
#define NV_DRM_CONNECTOR_LIST_ITER_BEGIN_PRESENTMeasured end to end on the author's box (Debian nvidia-kernel-dkms 550.163.01-6, kernel 6.19.14+deb14-amd64, built in a scratch tree with -j4): build clean, drm_connector_list_iter_* imported, mutex_is_locked call sites 7 → 1.
Gate 3 — the module you are actually running. After dkms install the file on disk is fixed but the kernel keeps the old module in RAM until you reboot. Compare build-ids:
# what is loaded
xxd -p /sys/module/nvidia_drm/notes/.note.gnu.build-id | tr -d '\n' | tail -c 40
# what is on disk
xz -dc /lib/modules/$(uname -r)/updates/dkms/nvidia-current-drm.ko.xz > /tmp/drm.ko
readelf -x .note.gnu.build-id /tmp/drm.ko | awk '/^ 0x/ {gsub(/[^0-9a-f]/,""); printf "%s", $1}' | tail -c 40Different IDs ⇒ the fix is installed but not yet active. Only a reboot (or an explicit module reload) activates it.
- Applies to any branch whose
conftest.shstill carries this snippet — verified present in 550.163.01-5 and 550.163.01-6 (Debian). Check your ownconftest.shbefore applying. - It fixes the detection, not the kernel-7.0 API breaks of Fix 1. They are orthogonal: Fix 1 is about kernel 7.0 APIs; Fix 3 is about a probe that lies on every kernel ≥ 6.9, including the 6.x you are running today.
- It does not make the 550 branch build on kernel 7.0 by itself.
- On 550.x against a 6.x kernel you also need the
__is_vma_write_locked()adaptation; Debian ships it innvidia-kernel-dkms 550.163.01-6(see the correction below).
Re-running the 7.0.10 build on the author's Debian 14 box produced three findings that change how the rest of this document should be read.
The build log from 2026-07-12 contains exactly one compiler error:
x86_64-linux-gnu-gcc-15: fatal error: Terminado (killed) signal terminated program cc1
and zero occurrences of VMA_LOCK_OFFSET, dma_fence_signal_locked, __vm_flags or is_vma_write_locked:
$ grep -c 'VMA_LOCK_OFFSET' make.log # 0
$ grep -c 'dma_fence_signal_locked' make.log # 0
$ grep -c '__vm_flags' make.log # 0
$ grep -c 'signal terminated program cc1' make.log # 1
The build was launched with make -j16 on a 30 GiB box with ~25 GiB already in use; cc1 was killed by the OOM killer. The API breaks described in Fix 1 are real — they are what upstream reports — but they were not what this machine hit. If your build dies with "killed", lower the parallelism before hunting for API changes:
sudo dkms build -m nvidia-current -v 550.163.01 -k $(uname -r) -- -j4On that machine, nvidia/nv-mmap.c had been edited by hand (the whole #if !NV_CAN_CALL_VMA_START_WRITE block — including nv_vma_start_write() and its EXPORT_SYMBOL — deleted) to try to get past the VMA API change on 7.0. Consequences:
- The 6.19 build then fails with
becauseERROR: modpost: "nv_vma_start_write" [nvidia.ko] undefined!common/inc/nv-mm.hstill calls the function while its definition is gone. dkms buildre-copies the source tree on every run, so hand edits live only until the next DKMS operation — and then they fail in confusing ways.
Detect this class of problem on your own box:
$ dpkg --verify nvidia-kernel-dkms | grep -v '^dpkg:'
??5?????? /usr/src/nvidia-current-550.163.01/nvidia/nv-mmap.cA modified file is flagged with ??5?????? (the 5th checksum slot = MD5 mismatch). Restore it with the package manager rather than by hand:
sudo apt-get install --reinstall -y nvidia-kernel-dkmsUse PATCH[] / PATCH_MATCH[] in dkms.conf instead of editing the tree: they are declarative, reproducible, survive every DKMS run, and show up in dkms status.
On that machine the driver package itself was stuck:
$ dpkg -l nvidia-kernel-dkms
hi nvidia-kernel-dkms 550.163.01-5 amd64 NVIDIA binary kernel module DKMS source
hi = half-installed. A DKMS source package in hi state means its postinst (which runs the build) never completed — so every later kernel install re-triggers the same failing build, which is exactly the loop described in §5. Fix the package state first (apt-get -f install or reinstall), then the build story is much easier to read.
Debian's nvidia-kernel-dkms 550.163.01-6 adds the __is_vma_write_locked() adaptation that 550.163.01-5 lacks:
+static inline int nv_is_vma_write_locked(struct vm_area_struct *vma, unsigned int *mm_lock_seq)
+{
+#if defined(NV_IS_VMA_WRITE_LOCKED_HAS_MM_LOCK_SEQ_ARG)
+ return __is_vma_write_locked(vma, mm_lock_seq);
+#else
+ *mm_lock_seq = __vma_raw_mm_seqnum(vma);
+ return __is_vma_write_locked(vma);
+#endif
+}Before hand-patching a driver, check whether a newer package revision already carries the fix — and note that Fix 3's conftest bug is still present in -6, so the two are independent.
This section was added after debugging a real production incident on a Debian Sid machine (ASUS TUF A15, RTX 3050 Mobile, 30GB RAM, load avg 28). Symptoms:
cc1chewing 100%+ CPU for hours, system lag, fans at max. The pattern is universal across apt-based distros. Skip this section if your build actually succeeds.
- Load average ≥ 10 sustained for hours
ps aux | grep -E "cc1|make|nvidia"shows gcc compiling nvidia-uvm or nvidia-drm for many minutes/var/log/dpkg.logshows repeatedstatus installed linux-headers-<new-kernel>followed bystatus half-configuredtopshowscc1at 100%+ CPU fromroot- Even after
kill -9, the loop restarts within 30s
5.2 Root cause: kernel postinst triggers DKMS, DKMS fails on 7.0+ API break, unattended-upgrade respawns
The chain:
graph TD
A["apt-daily-upgrade.timer<br/>(daily cron)"] --> B["apt installs<br/>linux-headers-7.0.10"]
B --> C["linux-headers-7.0.10.postinst runs"]
C --> D["/etc/kernel/header_postinst.d/dkms hook"]
D --> E["dkms autoinstall -k 7.0.10+deb14-amd64"]
E --> F{"Build succeeds?"}
F -->|"Yes (e.g. 610 prod branch)"| G["✓ DKMS module installed, loop ends"]
F -->|"No (550/580 branch<br/>on kernel 7.0+)"| H["✗ Build fails: VMA / dma_fence"]
H --> I["dpkg marks package half-configured"]
I --> J["Next timer run: retry"]
J --> B
K["user session entrypoint<br/>pre-init hook"] --> E
L["apt-daily.service (download)"] --> B
Three independent triggers can fire dkms autoinstall for the new kernel:
linux-headers-<ver>.postinst→/etc/kernel/header_postinst.d/dkmslinux-image-<ver>.postinst→/etc/kernel/postinst.d/dkms- User session init scripts (e.g.
entrypoint --pre-init-hooks)
This is why "killing unattended-upgrade" doesn't stop the loop — the user session re-triggers it.
# === Layer 1: stop DKMS from re-attempting the broken build ===
# Touch the no-autoinstall flag. The dkms framework exits 0 immediately
# if this file exists. This stops ALL three triggers above.
sudo touch /etc/dkms/no-autoinstall
# === Layer 2: prevent unattended-upgrade from installing problematic headers ===
# Hold the specific kernel versions you don't want updated
sudo apt-mark hold linux-image-7.0.10+deb14-amd64 \
linux-headers-7.0.10+deb14-amd64 \
linux-headers-7.0.10+deb14-common
# === Layer 3: blacklist kernel/driver patterns in unattended-upgrade config ===
# Edit /etc/apt/apt.conf.d/50unattended-upgrades and add to
# the existing Unattended-Upgrade::Package-Blacklist block:
sudo sed -i '/Unattended-Upgrade::Package-Blacklist/,/^};/{
/"linux-";/a\
\
// LZT hardening 2026-07-12: skip kernels + nvidia drivers (manual control)\
"linux-image-.*";\
"linux-headers-.*";\
"nvidia-.*";\
"nvidia-kernel-.*";
}' /etc/apt/apt.conf.d/50unattended-upgrades
# Verify
sudo unattended-upgrade --dry-run --debug 2>&1 | grep -i "skip\|blacklist\|hold"Why all three layers?
| Layer | What it blocks | Reversibility |
|---|---|---|
1: /etc/dkms/no-autoinstall |
All three trigger types (postinst hooks + user session) | sudo rm /etc/dkms/no-autoinstall |
2: apt-mark hold |
apt/apt-get upgrades |
sudo apt-mark unhold <pkg> |
3: unattended-upgrade blacklist |
unattended-upgrade specifically (not regular apt upgrade) |
Edit config, remove entries |
Run these BEFORE applying the fix to confirm you're hitting the same root cause:
# 1. What is the load average?
cat /proc/loadavg
# If 1-min avg > 5 sustained → likely DKMS loop
# 2. What is gcc actually compiling?
ps auxf | grep -E "cc1.*nvidia|make.*nvidia-current" | head -5
# If you see nvidia-uvm or nvidia-drm files → confirmed
# 3. What kernel is failing?
sudo dkms status
# Look for entries WITHOUT "installed" suffix
# 4. Who's holding the dpkg lock?
sudo fuser -v /var/lib/dpkg/lock-frontend
# Often shows unattended-upgrade OR dpkg --configure --pending
# 5. Recent kernel installs?
grep -E "linux-image|linux-headers" /var/log/dpkg.log | tail -10
# If you see a new kernel version installed in last 24h → trigger source# Kill the build chain (innermost first)
sudo pkill -KILL -f "cc1.*nvidia"
sudo pkill -KILL -f "make.*nvidia-current"
sudo pkill -KILL -f "dkms_autoinstaller"
sudo pkill -KILL -f "linux-headers-7.0.10.*postinst"
# Wait 5s, verify clean
sleep 5
ps auxf | grep -E "cc1.*nvidia|make.*nvidia-current|dkms_autoinstaller" | grep -v grep || echo "✓ clean"
# Apply Layer 1 (no-autoinstall) IMMEDIATELY to prevent respawn
sudo touch /etc/dkms/no-autoinstall
# Then run Layers 2-3The same diagnosis applies to all Debian/Ubuntu-family distros:
| Distro | Package name | Trigger location | Note |
|---|---|---|---|
| Debian Sid/Testing/Bookworm | nvidia-kernel-dkms |
/etc/kernel/{postinst,header_postinst}.d/dkms |
This gist |
| Ubuntu 24.04 LTS | nvidia-driver-550 (or current) |
Same /etc/kernel/postinst.d/dkms |
Same fix |
| Pop!_OS | system76-driver-nvidia |
Same + apt hooks |
System76 manages nvidia separately |
| Linux Mint | nvidia-driver-<ver> |
Same | Identical to Ubuntu LTS |
| Arch / Manjaro | nvidia-dkms (AUR) |
pacman hooks in /usr/lib/initcpio/install/ |
Different mechanism, similar idea |
| Fedora / RHEL | kmod-nvidia from RPM Fusion |
%post scriptlet in RPM, not dkms |
See RPM-specific fix below |
Arch equivalent (for the same problem):
# Skip nvidia-dkms build for a specific kernel:
sudo dkms remove nvidia/580.xx.xx -k 6.12.arch1-1
# Or blacklist the package from pacman upgrades:
# Add to /etc/pacman.conf:
# IgnorePkg = nvidia-dkms linux-headersFedora equivalent (for the same problem):
# dnf config-manager plugin to skip
echo 'excludepkgs=nvidia-kmod,akmod-nvidia,kernel*' | sudo tee -a /etc/dnf/dnf.confProxmox VE hosts: the Debian-packaged
nvidia-kernel-dkms550.163.01 source layout is shared with Proxmox VE 9'spvekernels (e.g.7.0.2-2-pve), but those kernels have additional transitional fixes (GCC 15-std=gnu17,del_timer_sync,in_irq→in_hardirq,map_resource→map_phys, plus__vm_flagsremoval viavm_flags_reset()— our Patch 1c). A comprehensive Proxmox helper script is ategeekial/nvidia-550xx-dkms-proxmox— it covers GCC 15, timer functions,drm_print, and thevm_flagsfixes in one pass. Patch 1c (vmflags.patch) above is derived from their work and is also usable standalone viadkms.conf PATCH[N]. See PR #1 for the full context and the dma-fence correctness fix.
After applying the 3 layers, monitor for 24h:
# Cron-friendly check (add to /etc/cron.d/lzt-dkms-monitor)
DKMS_BUILDING=$(ps aux | grep -cE "cc1.*nvidia|make.*nvidia-current" )
LOAD=$(cut -d' ' -f1 /proc/loadavg)
LOCK=$(sudo fuser /var/lib/dpkg/lock-frontend 2>/dev/null | tr -d ' ')
if [ "$DKMS_BUILDING" -gt 0 ] || awk "BEGIN{exit !($LOAD > 5)}" || [ -n "$LOCK" ]; then
echo "ALERT: dkms loop active (builds=$DKMS_BUILDING load=$LOAD lock=$LOCK)"
# Send notification, page, etc.
fiFor long-running prevention, the systemd units at lzt-dpkg-broken-detect.service (5min before apt-daily-upgrade) + lzt-unattended-upgrade-stuck-kill.service (5min after) provide automated detection + remediation.
If you find yourself fighting Sid + NVIDIA + DKMS daily, the isolation strategy is Distrobox + Arch (or Bazzite for gaming):
- Host: Debian Sid for development (your familiar toolchain)
- Guest: Arch inside Distrobox for NVIDIA-heavy workloads (gaming, CUDA, proprietary rendering)
- Forward
nvidia-container-toolkitto the guest for GPU passthrough
This decouples your base system from NVIDIA's release cadence.
References: r/linux_gaming Distrobox Gaming · r/archlinux 2026 NVIDIA status
| Project | Issue / URL |
|---|---|
| NVIDIA open-gpu-kernel-modules | GitHub #1113 |
| NixOS nixpkgs | GitHub #510962 |
| Niri WM | GitHub #3265 |
| Debian NVIDIA Wiki | https://wiki.debian.org/NvidiaGraphicsDrivers |
| r/linux (v1 RFC, 2026-06-17) | https://www.reddit.com/r/linux/comments/1sodpgh/ |
| r/debian (community triage thread, 2026-07) | https://www.reddit.com/r/debian/comments/1tbt36v/ |
| DKMS framework | man dkms / /usr/lib/dkms/common.postinst |
| Proxmox VE 9 patch helper (egeekial) | GitHub PR #1 — includes the vmflags and dma-fence fixes adopted here |
- dCSeven: First tester to confirm patch 1a (
vma.patch) builds successfully; reported patch offset bug (fixed in v2) and identified the secondarynvidia-dma-fence-helper.hbuild failure that required patch 1b (drm.patch). - 80kman (r/linux, Quadro P1000 user): Reported the 580 branch strlcpy error path; full 580 workflow documented here.
- egeekial (nvidia-550xx-dkms-proxmox): Identified the
__vm_flagsremoval in kernel 7.0.2+ as a separate failure; contributed thevm_flags_reset()replacement pattern and the comprehensiveapply-patches-proxmox.shscript that covers GCC 15, timer functions, anddrm_printupdates.
- v7 (2026-11-14): RFC Fix 3 deployed and verified on the author's machine (
nvidia-kernel-dkms 550.163.01-6+ the one-line conftest patch, kernel 6.19.14+deb14-amd64): build clean,drm_connector_list_iter_*imported,mutex_is_lockedcall sites 7 → 1, module installed and signed. Documented the two silent DKMS traps that cost the most debugging time: (1) patch files must live in<source>/patches/— DKMS reads$build_dir/patches/$pand does not copy them; (2)PATCH[]indices must be contiguous from 0, because DKMS iteratesindex=0..${#PATCH[@]}-1and${#PATCH[@]}counts elements — a lonePATCH[3]is ignored without a message. Addeddkms build --force(without it the stale.kois reused in 0 s) andparallel_jobsguidance. Added a Gate 3 comparing the build-id of the loaded module against the one on disk:dkms installdoes not change what is running until reboot. - v6 (2026-11-14): Added RFC Fix 3 — NVIDIA's
conftest.shprobesstruct drm_connector_list_iterwith anint-returning function that never returns, so on every kernel ≥ 6.9 (-Werror=return-type) the probe fails and the driver silently compiles the legacy connector-iterator branch withWARN_ON(!mutex_is_locked(...)). 1-line patch + anm -uverification gate. Added Correction (2026-11-14): the 7.0.10 build failure logged on the author's machine was an OOM kill (-j16, 0 API errors), the packagednv-mmap.chad been hand-edited (dpkg --verifydetects it), the driver package washi(half-installed), and Debian's550.163.01-6already carries the__is_vma_write_locked()adaptation. Corrected the earlier "these WARN_ONs are oops / they kill the compositor" claim: they are warnings, non-fatal by default. - v5 (2026-07-13): Added Patch 1c (
nvidia-7.0-vmflags.patch) for__vm_flagsremoval (kernel 7.0.2+). Updated Branch Compatibility Matrix to reflect kernel 7.0–7.1 vs 7.2+ distinction. Added reference to egeekial/nvidia-550xx-dkms-proxmox PR #1. Added egeekial to Acknowledgements. - v4 (2026-07-12): Added Proxmox VE footnote to §5.6 cross-distro table (links to
egeekial/nvidia-550xx-dkms-proxmoxforpvekernels). Added twor/linux+r/debianthread references in §7 with dates. No RFC/patch changes. - v3 (2026-07-12): Added §5 DKMS Loop Diagnosis & Triage — universal recipe for Debian/Ubuntu/Arch/Fedora. Documents the 3-trigger root cause, the 3-layer fix (no-autoinstall + hold + blacklist), diagnosis one-liners, recovery procedure, and cross-distro applicability matrix. Derived from a real production incident (Debian Sid, ASUS TUF A15, 30GB RAM, load avg 28).
- v2 (2026-07-12): Added
drm.patchfor the second build error. Restructured with TL;DR + Branch Compatibility Matrix + Distrobox escape hatch + Acknowledgements. - v1 (2026-06-17): Initial patch + Wayland D3cold fix.
Hi there,
I tried your patch.
Pulling the first patch down two lines (below the two following includes) makes the file compile for me.
However, I get another issue in nvidia-drm/nvidia-drm-fence-helper.h
Find my make.log below
[I stripped the comments from your diff, therefore the lines don't match. The warning of the unused result of refcount_sub_and_test is in the (untouched) function nv_vma_enter_locked.
Also I had to snip away a bit of the output to fit it in this comment (compiled files without errors or warnings)]