dpkg: 错误处理包 oracle-java8-installer (--configure):

2022-09-02 11:05:10

我正在尝试在 Ubuntu 16.04 上安装 sbt。我在运行以下命令时错误地停止了该过程,

sudo apt-get install sbt

现在,当我尝试再次安装时,我收到以下错误,

Downloading Oracle Java 8...
--2017-04-24 17:34:33--  http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 104.80.89.58, 104.80.89.16
Connecting to download.oracle.com (download.oracle.com)|104.80.89.58|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz [following]
--2017-04-24 17:34:35--  https://edelivery.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.200.209.153, 2600:1409:a:183::2d3e, 2600:1409:a:193::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.200.209.153|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz?AuthParam=1493035597_d0396e6a99df9ccfeb3f6d895673df09 [following]
--2017-04-24 17:34:37--  http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz?AuthParam=1493035597_d0396e6a99df9ccfeb3f6d895673df09
Connecting to download.oracle.com (download.oracle.com)|104.80.89.58|:80... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-8u131-linux-x64.tar.gz
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of sbt:
 sbt depends on openjdk-8-jdk; however:
  Package openjdk-8-jdk is not installed.
  Package oracle-java8-installer which provides openjdk-8-jdk is not configured yet.

dpkg: error processing package sbt (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 oracle-java8-installer
 sbt
E: Sub-process /usr/bin/dpkg returned an error code (1)

我该如何解决这个问题?

更新 1:

我已经尝试了这个解决方案。但它仍然没有帮助我解决这个问题,并在下面得到相同的错误?

After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up oracle-java8-installer (8u131-1~webupd8~2) ...
Installing from local file /var/cache/oracle-jdk8-installer/jdk-8u131-linux-x64.tar.gz
Removing outdated cached downloads...
install: cannot stat 'javaws-wrapper.sh': No such file or directory
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of sbt:
 sbt depends on openjdk-8-jdk; however:
  Package openjdk-8-jdk is not installed.
  Package oracle-java8-installer which provides openjdk-8-jdk is not configured yet.

dpkg: error processing package sbt (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 oracle-java8-installer
 sbt
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案 1

你问了很久了。由于这里没有答案,我向您展示我的解决方案,这对我很有用。

问题的根本原因可能来自以前的java安装(它不是来自任何存储库,而是来自手动下载包)。因此,您必须手动删除安装后脚本,请使用以下命令:

sudo rm /var/lib/dpkg/info/oracle-java8-installer.postinst -f
sudo dpkg --configure oracle-java8-installer

希望他们能帮助你。


答案 2

对于 Ubuntu 19.04 和 Oracle JDK 11:

sudo rm /var/lib/dpkg/info/oracle-java11-installer-local.postinst -f
sudo dpkg --configure oracle-java11-installer-local

推荐