Docker Install on Debian 10.2 – AUFS-DKMS Error Fix

aptaptitudedebiandocker

After installing Docker 19.03 on a clean updated Debian 4.19.67 I am experiencing some problems with the aufs-dkms package that is a dependency.

I even reinstalled the Debian server and tried all from scratch. Interestingly, the docker installation is working fine. This is the critical part/end of the log where I get the following response with: Error! You must be root to use this command. even though I am 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)

There seems to be some problem with the root permission, but I could not find anything unusual in passwd or group. I tried purging aufs-dkms, but that also does not change anything. Is there a way to check the returned dpkg error code in some place?

Any direction would be appreciated.

I found this link: Error when performing an upgrade in Debian 9 but I can't purge dkms.

I tried aptitude install -f without success:

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

When I try to remove aufs-dkms I get the same root error:

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)

Best Answer

I did a complete reinstall of Debian 10. Following might be the reason that I could not purge the aufs-dkms package in an earlier attempt. The default $PATH for root did not include /sbin and /usr/sbin. So I update the $PATH temporarily:

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

In my second installation I was than able to properly purge aufs-dkms using aptitude (I now learned to prefer aptitude over apt-get):

aptitude purge aufs-dkms

Now the apt pipeline is clean and Docker is running. Unfortunately, that does not explain why there was a problem in the first place.

Update:

The missing $PATH was not set correctly because I was using su from a normal user login (not sure why this is different from a root login). Setting $PATH correctly would not make a difference.

But, when I logged in as root directly into tty1, I could run the apt install docker-ce without the aufs-dkms errors!

Related Topic