Debian

在乾淨的 Debian 10.2 上安裝 Docker 會導致 aufs-dkms 軟體包出錯

  • January 23, 2020

在乾淨更新上安裝 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)

我完全重新安裝了 Debian 10。以下可能是我無法aufs-dkms在較早的嘗試中清除軟體包的原因。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錯誤!

引用自:https://serverfault.com/questions/999212