在 Debian 9 中执行升级时出错

在 Debian 9 中执行升级时出错

即使我以 root 身份登录,以下是我在尝试执行升级时遇到的冲突:

root@:/home/frederic# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up linux-headers-4.9.0-3-amd64 (4.9.30-2+deb9u3) ...
/etc/kernel/header_postinst.d/dkms:
Error! You must be root to use this command.
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 1
Failed to process /etc/kernel/header_postinst.d at /var/lib/dpkg/info/linux-headers-4.9.0-3-amd64.postinst line 11.
dpkg: error processing package linux-headers-4.9.0-3-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up linux-image-4.9.0-3-amd64 (4.9.30-2+deb9u3) ...
/etc/kernel/postinst.d/dkms:
Error! You must be root to use this command.
run-parts: /etc/kernel/postinst.d/dkms exited with return code 1
dpkg: error processing package linux-image-4.9.0-3-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-amd64:
 linux-image-amd64 depends on linux-image-4.9.0-3-amd64; however:
  Package linux-image-4.9.0-3-amd64 is not configured yet.

dpkg: error processing package linux-image-amd64 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-headers-4.9.0-3-amd64
 linux-image-4.9.0-3-amd64
 linux-image-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

在我看来,似乎有一个问题dkms包,但当我尝试重新安装它时,情况并没有更好:

root@:/home/frederic# apt-get install --reinstall dkms
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/74.8 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 142800 files and directories currently installed.)
Preparing to unpack .../archives/dkms_2.3-2_all.deb ...
Unpacking dkms (2.3-2) over (2.3-2) ...
Setting up linux-headers-4.9.0-3-amd64 (4.9.30-2+deb9u3) ...
/etc/kernel/header_postinst.d/dkms:
Error! You must be root to use this command.
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 1
Failed to process /etc/kernel/header_postinst.d at /var/lib/dpkg/info/linux-headers-4.9.0-3-amd64.postinst line 11.
dpkg: error processing package linux-headers-4.9.0-3-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up dkms (2.3-2) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up linux-image-4.9.0-3-amd64 (4.9.30-2+deb9u3) ...
/etc/kernel/postinst.d/dkms:
Error! You must be root to use this command.
run-parts: /etc/kernel/postinst.d/dkms exited with return code 1
dpkg: error processing package linux-image-4.9.0-3-amd64 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-amd64:
 linux-image-amd64 depends on linux-image-4.9.0-3-amd64; however:
  Package linux-image-4.9.0-3-amd64 is not configured yet.

dpkg: error processing package linux-image-amd64 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-headers-4.9.0-3-amd64
 linux-image-4.9.0-3-amd64
 linux-image-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

至于您遇到错误dkms,我建议您首先采取的行动是检查是否确实dkms需要,然后再浪费时间调查错误的核心根源。

通常,dkms用于在安装具有新内核版本的软件包后自动(重新)编译/安装不属于默认内核的附加模块。例如,sysdig模块或 Realtek 驱动程序,或者在旧的 Debian 版本中,VMware vmtools 模块。

正如我们从请求中看到的, ls -la /var/lib/dkms没有额外的模块可以在其中编译(通常是带有源代码的(子)目录)。

因此,我们知道 dkms 在这台机器上没有做任何有用的事情。

ls -la /var/lib/dkms
total 12 
drwxr-xr-x 2  root root 4096 Sep  1 11:53 . 
drwxr-xr-x 46 root root 4096 Aug 30 16:18 .. 
-rw-r--r-- 1  root root    6 Aug 31 2016 dkms_dbversion

因此,建议的操作过程是使用以下命令卸载它:

sudo aptitude purge dkms

相关内容