Having issues with this DPKG thing.. Very new to programming in general so I can't figure it out.

September 15, 2017 1.5k views
Java
root@DiscordBot:~# sudo apt-get purge --auto-remove openjdk-8-jdk:amd64
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  default-jdk* default-jdk-headless* libice-dev* libice6*
  libpthread-stubs0-dev* libsm-dev* libsm6* libx11-dev* libx11-doc*
  libxau-dev* libxcb1-dev* libxdmcp-dev* libxt-dev* libxt6* openjdk-8-jdk*
  openjdk-8-jdk-headless* x11proto-core-dev* x11proto-input-dev*
  x11proto-kb-dev* xorg-sgml-doctools* xtrans-dev*
0 upgraded, 0 newly installed, 21 to remove and 4 not upgraded.
19 not fully installed or removed.
After this operation, 59.0 MB disk space will be freed.
Do you want to continue? [Y/n] y
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
(Reading database ... 68685 files and directories currently installed.)
Removing default-jdk (2:1.8-56ubuntu2) ...
Removing default-jdk-headless (2:1.8-56ubuntu2) ...
Removing libxt-dev:amd64 (1:1.1.5-0ubuntu1) ...
Removing libsm-dev:amd64 (2:1.2.2-1) ...
Removing libice-dev:amd64 (2:1.0.9-1) ...
Removing libxt6:amd64 (1:1.1.5-0ubuntu1) ...
Purging configuration files for libxt6:amd64 (1:1.1.5-0ubuntu1) ...
Removing libsm6:amd64 (2:1.2.2-1) ...
Purging configuration files for libsm6:amd64 (2:1.2.2-1) ...
Removing libice6:amd64 (2:1.0.9-1) ...
Purging configuration files for libice6:amd64 (2:1.0.9-1) ...
Removing openjdk-8-jdk:amd64 (8u131-b11-2ubuntu1.16.04.3) ...
Removing openjdk-8-jdk-headless:amd64 (8u131-b11-2ubuntu1.16.04.3) ...
Removing libx11-dev:amd64 (2:1.6.3-1ubuntu2) ...
Removing libxcb1-dev:amd64 (1.11.1-1ubuntu1) ...
Removing libpthread-stubs0-dev:amd64 (0.3-4) ...
Removing libx11-doc (2:1.6.3-1ubuntu2) ...
Removing libxau-dev:amd64 (1:1.0.8-1) ...
Removing libxdmcp-dev:amd64 (1:1.1.2-1.1) ...
Removing x11proto-input-dev (2.3.1-1) ...
Removing x11proto-core-dev (7.0.31-1~ubuntu16.04.1) ...
Removing x11proto-kb-dev (1.0.7-0ubuntu1) ...
Removing xorg-sgml-doctools (1:1.11-1) ...
Removing xtrans-dev (1.3.5-1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Setting up x11-common (1:7.7+13ubuntu3) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package x11-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of libxtst6:amd64:
 libxtst6:amd64 depends on x11-common; however:
  Package x11-common is not configured yet.

dpkg: error processing package libxtst6:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of openjdk-8-jre-headless:amd64:
 openjdk-8-jre-headless:amd64 depends on libxtst6; however:
  Package libxtst6:amd64 is not configured yet.

dpkg: error processing package openjdk-8-jre-headless:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jre-headless:
 default-jre-headless depends on openjdk-8-jre-headless; however:
  Package openjdk-8-jre-headless:amd64 is not configured yet.

dpkg: error processing package default-jre-headless (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of openjdk-9-jre-headless:amd64:
 openjdk-9-jre-headless:amd64 depends on libxtst6; however:
  Package libxtst6:amd64 is not configuredNo apport report written because the error message indicates its a followup error from a previous failure.
                                                                    No apport report written because the error message indicates its a followup error from a previous failure.
              No apport report written because MaxReports is reached already
                                                                            No apport report written because MaxReports is reached already
                                                          No apport report written because MaxReports is reached already
                                        No apport report written because MaxReports is reached already
                       yet.

dpkg: error processing package openjdk-9-jre-headless:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of openjdk-8-jre:amd64:
 openjdk-8-jre:amd64 depends on openjdk-8-jre-headless (= 8u131-b11-2ubuntu1.16.04.3); however:
  Package openjdk-8-jre-headless:amd64 is not configured yet.

dpkg: error processing package openjdk-8-jre:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jre:
 default-jre depends on default-jre-headless (= 2:1.8-56ubuntu2); however:
  Package default-jre-headless is not configured yet.
 default-jre depends on openjdk-8-jre; however:
  Package openjdk-8-jre:amd64 is not configured yet.

dpkg: error processing package default-jre (--configure):
 dependency problems - leaving unconfigured
Setting up grub-legacy-ec2 (0.7.9-233-ge586fe35-0ubuntu1~16.04.1) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing package grub-legacy-ec2 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of ca-certificates-java:No apport report written because MaxReports is reached already

 ca-certificates-java depends on openjdk-7-jre-headless (>= 7~u3-2.1.1~pre1-1) | java7-runtime-headless; however:
  Package openjdk-7-jre-headless is not installed.
  Package java7-runtime-headless is not installed.
  Package openjdk-8-jre-headless:amd64 which provides java7-runtime-headless is not configured yet.
  Package default-jre-headless which provides java7-runtime-headless is not configured yet.
  Package openjdk-9-jre-headless:amd64 which provides java7-runtime-headless is not configured yet.

dpkg: error processing package ca-certificates-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 x11-common
 libxtst6:amd64
 openjdk-8-jre-headless:amd64
 default-jre-headless
 openjdk-9-jre-headless:amd64
 openjdk-8-jre:amd64
 default-jre
 grub-legacy-ec2
 ca-certificates-java
E: Sub-process /usr/bin/dpkg returned an error code (1)
1 Answer
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable

If you are getting this error, it means that there is another process running that is locking the file (it can't be accessed by multiple processes at once). To check which process is using it, run:

sudo fuser -v /var/cache/debconf/config.dat

That should print some info about the process, including its PID. You can stop that process by running sudo kill PID if you think it's stuck, or simply waiting a few minutes to see if it finishes.

Have another answer? Share your knowledge.