You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Debian 12升级kernel 6.1.0-18时出现依赖及模块编译问题

问题描述
  • 环境:Debian 12,使用一周,第三次配置系统
  • 操作:为TP-Link Archer T4U Plus AC1300无线网卡安装第三方驱动,执行sudo apt update && sudo apt upgrade后,新内核6.1.0-18与88x2bu、nvidia-current/525.147.05驱动冲突
  • 已尝试操作:用驱动仓库自带的remove-driver.sh卸载88x2bu,问题未解决
  • 当前症状:执行sudo apt install或sudo apt upgrade时触发dpkg配置报错(详情见下方)
  • 核心需求:执行sudo apt install或sudo apt remove时不自动安装新内核

报错详情

Setting up linux-image-6.1.0-18-amd64 (6.1.76-1) ...
I: /initrd.img is now a symlink to boot/initrd.img-6.1.0-18-amd64
/etc/kernel/postinst.d/dkms:
dkms: running auto installation service for kernel 6.1.0-18-amd64.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
'make' all KVER=6.1.0-18-amd64...^[.......(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.0-18-amd64 (x86_64)
Consult /var/lib/dkms/88x2bu/1.1/build/make.log for more information.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
env NV_VERBOSE=1 make -j36 modules KERNEL_UNAME=6.1.0-18-amd64............(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.0-18-amd64 (x86_64)
Consult /var/lib/dkms/nvidia-current/525.147.05/build/make.log for more information.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
dkms: autoinstall for kernel: 6.1.0-18-amd64 failed!
run-parts: /etc/kernel/postinst.d/dkms exited with return code 11
dpkg: error processing package linux-image-6.1.0-18-amd64 (--configure):
 installed linux-image-6.1.0-18-amd64 package post-installation script subprocess returned error exit status 1
Setting up linux-headers-6.1.0-18-amd64 (6.1.76-1) ...
/etc/kernel/header_postinst.d/dkms:
dkms: running auto installation service for kernel 6.1.0-18-amd64.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
'make' all KVER=6.1.0-18-amd64............(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.0-18-amd64 (x86_64)
Consult /var/lib/dkms/88x2bu/1.1/build/make.log for more information.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
env NV_VERBOSE=1 make -j36 modules KERNEL_UNAME=6.1.0-18-amd64............(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.1.0-18-amd64 (x86_64)
Consult /var/lib/dkms/nvidia-current/525.147.05/build/make.log for more information.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
dkms: autoinstall for kernel: 6.1.0-18-amd64 failed!
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 11
Failed to process /etc/kernel/header_postinst.d at /var/lib/dpkg/info/linux-headers-6.1.0-18-amd64.postinst line 11.
dpkg: error processing package linux-headers-6.1.0-18-amd64 (--configure):
 installed linux-headers-6.1.0-18-amd64 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-amd64:
 linux-image-amd64 depends on linux-image-6.1.0-18-amd64 (= 6.1.76-1); however:
  Package linux-image-6.1.0-18-amd64 is not configured yet.

dpkg: error processing package linux-image-amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-headers-amd64:
 linux-headers-amd64 depends on linux-headers-6.1.0-18-amd64 (= 6.1.76-1); however:
  Package linux-headers-6.1.0-18-amd64 is not configured yet.

dpkg: error processing package linux-headers-amd64 (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for fontconfig (2.14.1-4) ...
Processing triggers for libc-bin (2.36-9+deb12u4) ...
Errors were encountered while processing:
 linux-image-6.1.0-18-amd64
 linux-headers-6.1.0-18-amd64
 linux-image-amd64
 linux-headers-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

解决方案

1. 先修复当前dpkg配置错误

首先处理未配置成功的内核包:

  • 重启系统,选择之前能正常启动的旧内核(比如6.1.0-17及更早版本)
  • 执行以下命令卸载有问题的新内核及依赖:
sudo apt purge linux-image-6.1.0-18-amd64 linux-headers-6.1.0-18-amd64 linux-image-amd64 linux-headers-amd64
sudo dpkg --configure -a
sudo apt autoremove --purge

2. 配置APT阻止自动安装新内核

有两种方法可以实现内核版本锁定:

方法一:使用apt-mark hold快速锁定

先通过uname -r查看当前正在使用的内核版本(比如输出6.1.0-17-amd64),然后执行:

# 锁定内核镜像相关包
sudo apt-mark hold linux-image-$(uname -r) linux-image-amd64
# 锁定内核头文件相关包
sudo apt-mark hold linux-headers-$(uname -r) linux-headers-amd64
# 锁定内核编译依赖包
sudo apt-mark hold linux-kbuild-6.1 linux-libc-dev

如果之后需要解锁内核更新,执行:

sudo apt-mark unhold linux-image-$(uname -r) linux-image-amd64 linux-headers-$(uname -r) linux-headers-amd64 linux-kbuild-6.1 linux-libc-dev

方法二:修改APT配置文件强制固定版本

创建/etc/apt/preferences.d/00-hold-kernel文件,添加以下内容(将6.1.0-17替换为你当前使用的内核版本):

Package: linux-image-6.1.0-17-amd64
Pin: version 6.1.0-17*
Pin-Priority: 1001

Package: linux-headers-6.1.0-17-amd64
Pin: version 6.1.0-17*
Pin-Priority: 1001

Package: linux-image-amd64
Pin: version 6.1.0-17*
Pin-Priority: 1001

Package: linux-headers-amd64
Pin: version 6.1.0-17*
Pin-Priority: 1001

Pin-Priority: 1001表示强制保留指定版本,不会被更新替换。

3. 额外建议:修复驱动兼容性

  • 无线网卡:确认使用的第三方驱动支持Debian 12的6.1内核,或尝试官方仓库中的rtl882bu-dkms包
  • NVIDIA驱动:可尝试Debian backports中的最新版本,或降级到与当前内核兼容的版本

内容的提问来源于stack exchange,提问作者starleks

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 12:47:14