在干净的 Debian 10.2 上安装 Docker 会导致 aufs-dkms 包出现错误

在干净的 Debian 10.2 上安装 Docker 会导致 aufs-dkms 包出现错误

在全新更新上安装 Docker 19.03 后,Debian 4.19.67我遇到了依赖项 aufs-dkms 包的一些问题。

我甚至重新安装了 Debian 服务器并从头开始尝试。有趣的是,docker 安装工作正常。这是日志的关键部分/结尾,我得到了以下响应:Error! You must be root to use this command.即使我是 root:

Setting up docker-ce (5:19.03.5~3-0~debian-buster) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Setting up git (1:2.20.1-2+deb10u1) ...
Setting up libgcc-8-dev:amd64 (8.3.0-6) ...
Setting up libc6-dev:amd64 (2.28-10) ...
Setting up libstdc++-8-dev:amd64 (8.3.0-6) ...
Setting up gcc-8 (8.3.0-6) ...
Setting up gcc (4:8.3.0-1) ...
Setting up dkms (2.6.1-4) ...
Setting up g++-8 (8.3.0-6) ...
Setting up aufs-dkms (4.19+20190211-1) ...
Loading new aufs-4.19+20190211 DKMS files...
Building for 4.19.0-6-amd64
Building initial module for 4.19.0-6-amd64
Done.
Error! You must be root to use this command.
dpkg: error processing package aufs-dkms (--configure):
 installed aufs-dkms package post-installation script subprocess returned error exit status 1
Setting up linux-compiler-gcc-8-x86 (4.19.67-2+deb10u2) ...
Setting up linux-headers-4.19.0-6-amd64 (4.19.67-2+deb10u2) ...
/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.19.0-6-amd64.postinst line 11.
dpkg: error processing package linux-headers-4.19.0-6-amd64 (--configure):
 installed linux-headers-4.19.0-6-amd64 package post-installation script subprocess returned error exit status 1
Setting up g++ (4:8.3.0-1) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up build-essential (12.6) ...
dpkg: dependency problems prevent configuration of linux-headers-amd64:
 linux-headers-amd64 depends on linux-headers-4.19.0-6-amd64; however:
  Package linux-headers-4.19.0-6-amd64 is not configured yet.

dpkg: error processing package linux-headers-amd64 (--configure):
 dependency problems - leaving unconfigured
Processing triggers for systemd (241-7~deb10u2) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10) ...
Errors were encountered while processing:
 aufs-dkms
 linux-headers-4.19.0-6-amd64
 linux-headers-amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

似乎 root 权限有问题,但我在 passwd 或 group 中没有发现任何异常。我尝试清除 aufs-dkms,但这也没有任何改变。有没有办法在某个地方检查返回的 dpkg 错误代码?

任何指示都将受到赞赏。

我找到了这个链接:在 Debian 9 中执行升级时出错但我无法清除 dkms。

我尝试过aptitude install -f但没有成功:

root@server01:/home/sdittmar# aptitude install -f
The following packages will be REMOVED:  
  aufs-dkms{p} 
The following partially installed packages will be configured:
  linux-headers-4.19.0-6-amd64 linux-headers-amd64 
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 984 kB will be freed.
Do you want to continue? [Y/n/?] y
(Reading database ... 179889 files and directories currently installed.)
Removing aufs-dkms (4.19+20190211-1) ...
Error! You must be root to use this command.
dpkg: error processing package aufs-dkms (--remove):
 installed aufs-dkms package pre-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 aufs-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
Setting up linux-headers-4.19.0-6-amd64 (4.19.67-2+deb10u2) ...
/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.19.0-6-amd64.postinst line 11.
dpkg: error processing package linux-headers-4.19.0-6-amd64 (--configure):
 installed linux-headers-4.19.0-6-amd64 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-headers-amd64:
 linux-headers-amd64 depends on linux-headers-4.19.0-6-amd64; however:
  Package linux-headers-4.19.0-6-amd64 is not configured yet.

dpkg: error processing package linux-headers-amd64 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-headers-4.19.0-6-amd64
 linux-headers-amd64

当我尝试删除时aufs-dkms出现同样的root错误:

root@server01:/home/sdittmar# apt-get purge aufs-dkms
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  aufs-dkms*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 984 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 179889 files and directories currently installed.)
Removing aufs-dkms (4.19+20190211-1) ...
Error! You must be root to use this command.
dpkg: error processing package aufs-dkms (--remove):
 installed aufs-dkms package pre-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 aufs-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

aufs-dkms我完全重新安装了 Debian 10。以下可能是我之前无法清除软件包的原因。root$PATH的默认设置不包括/sbin/usr/sbin。因此我$PATH暂时更新了:

export PATH=$PATH:/sbin:/usr/sbin

在我的第二次安装中,我能够使用 aptitude 正确地清除 aufs-dkms(我现在学会了更喜欢使用 aptitude 而不是 apt-get):

aptitude purge aufs-dkms

现在 apt 管道干净了,Docker 正在运行。不幸的是,这并不能解释为什么一开始就存在问题。

更新:

缺少的 $PATH 设置不正确,因为我使用的su是普通用户登录(不确定这与 root 登录有何不同)。正确设置 $PATH 不会产生任何影响。

但是,当我以 root 身份直接登录到 tty1 时,我可以运行apt install docker-ce而不会aufs-dkms出现错误!

相关内容