dpkg: error: reading package info file '/var/lib/dpkg/available': Is a directory
E: Sub-process dpkg --set-selections returned an error code (2)
E: Couldn't record the approved state changes as dpkg selection states
A package failed to install. Trying to recover:
Setting up openjdk-11-jre-headless:amd64 (11.0.4+11-1ubuntu2~19.04) ...
update-alternatives: error: alternative path /usr/lib/jvm/java-11-openjdk-amd64/bin/rmid doesn't exist
dpkg: error processing package openjdk-11-jre-headless:amd64 (--configure):
installed openjdk-11-jre-headless:amd64 package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of openjdk-11-jre:amd64:
openjdk-11-jre:amd64 depends on openjdk-11-jre-headless (= 11.0.4+11-1ubuntu2~19.04); however:
Package openjdk-11-jre-headless:amd64 is not configured yet.
dpkg: error processing package openjdk-11-jre:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of openjdk-11-jdk-headless:amd64:
openjdk-11-jdk-headless:amd64 depends on openjdk-11-jre-headless (= 11.0.4+11-1ubuntu2~19.04); however:
Package openjdk-11-jre-headless:amd64 is not configured yet.
dpkg: error processing package openjdk-11-jdk-headless:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jre:
default-jre depends on openjdk-11-jre; however:
Package openjdk-11-jre:amd64 is not configured yet.
dpkg: error processing package default-jre (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jdk-headless:
default-jdk-headless depends on openjdk-11-jdk-headless; however:
Package openjdk-11-jdk-headless:amd64 is not configured yet.
dpkg: error processing package default-jdk-headless (--configure):
dependency problems - leaving unconfigured
Setting up openjdk-8-jre-headless:amd64 (8u222-b10-1ubuntu1~19.04.1) ...
update-alternatives: error: alternative path /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmid doesn't exist
dpkg: error processing package openjdk-8-jre-headless:amd64 (--configure):
installed openjdk-8-jre-headless:amd64 package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of openjdk-11-jdk:amd64:
openjdk-11-jdk:amd64 depends on openjdk-11-jre (= 11.0.4+11-1ubuntu2~19.04); however:
Package openjdk-11-jre:amd64 is not configured yet.
openjdk-11-jdk:amd64 depends on openjdk-11-jdk-headless (= 11.0.4+11-1ubuntu2~19.04); however:
Package openjdk-11-jdk-headless:amd64 is not configured yet.
dpkg: error processing package openjdk-11-jdk:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jdk:
default-jdk depends on default-jre (= 2:1.11-71); however:
Package default-jre is not configured yet.
Version of default-jre on system, provided by oracle-java8-installer:all, is <none>.
default-jdk depends on default-jdk-headless (= 2:1.11-71); however:
Package default-jdk-headless is not configured yet.
default-jdk depends on openjdk-11-jdk; however:
Package openjdk-11-jdk:amd64 is not configured yet.
dpkg: error processing package default-jdk (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
openjdk-11-jre-headless:amd64
openjdk-11-jre:amd64
openjdk-11-jdk-headless:amd64
default-jre
default-jdk-headless
openjdk-8-jre-headless:amd64
openjdk-11-jdk:amd64
default-jdk
答案1
我建议使用以下命令删除有问题的目录:
sudo rm -rf /var/lib/dpkg/available
使用以下方式创建空文件
sudo touch /var/lib/dpkg/available
并继续安装包:
sudo apt-get update
sudo apt-get upgrade
sudo dpkg --configure -a