每次尝试安装任何软件时都会显示这些错误:

每次尝试安装任何软件时都会显示这些错误:

错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  aptitude-common libcwidget3v5
Suggested packages:
  aptitude-doc-en | aptitude-doc apt-xapian-index debtags tasksel
  libcwidget-dev
The following NEW packages will be installed:
  aptitude aptitude-common libcwidget3v5
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
24 not fully installed or removed.
Need to get 2,571 kB of archives.
After this operation, 10.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.ubuntu.com/ubuntu artful/main amd64 aptitude-common all 0.8.3-1ubuntu4 [835 kB]
Get:2 http://archive.ubuntu.com/ubuntu artful/main amd64 libcwidget3v5 amd64 0.5.17-6 [291 kB]
Get:3 http://archive.ubuntu.com/ubuntu artful/main amd64 aptitude amd64 0.8.3-1ubuntu4 [1,446 kB]
Fetched 2,571 kB in 37s (68.1 kB/s)                                            
Selecting previously unselected package aptitude-common.
(Reading database ... 204973 files and directories currently installed.)
Preparing to unpack .../aptitude-common_0.8.3-1ubuntu4_all.deb ...
Unpacking aptitude-common (0.8.3-1ubuntu4) ...
Selecting previously unselected package libcwidget3v5:amd64.
Preparing to unpack .../libcwidget3v5_0.5.17-6_amd64.deb ...
Unpacking libcwidget3v5:amd64 (0.5.17-6) ...
Selecting previously unselected package aptitude.
Preparing to unpack .../aptitude_0.8.3-1ubuntu4_amd64.deb ...
Unpacking aptitude (0.8.3-1ubuntu4) ...
Setting up oracle-java8-installer (8u171-1~webupd8~1) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2018-07-15 21:14:16--  http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 104.108.220.248
Connecting to download.oracle.com (download.oracle.com)|104.108.220.248|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz [following]
--2018-07-15 21:14:20--  https://edelivery.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 104.108.155.19, 2600:1417:2c:1a4::2d3e, 2600:1417:2c:19f::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|104.108.155.19|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz?AuthParam=1531669582_b3ee47aaa0fcebe9ede7165ae628e7e9 [following]
--2018-07-15 21:14:22--  http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz?AuthParam=1531669582_b3ee47aaa0fcebe9ede7165ae628e7e9
Connecting to download.oracle.com (download.oracle.com)|104.108.220.248|: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-8u171-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
Setting up aptitude-common (0.8.3-1ubuntu4) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
dpkg: dependency problems prevent configuration of libgeronimo-jms-1.1-spec-java:
 libgeronimo-jms-1.1-spec-java depends on default-jre-headless | java5-runtime-headless; however:
  Package default-jre-headless is not installed.
  Package oracle-java8-installer which provides default-jre-headless is not configured yet.
  Package java5-runtime-headless is not installed.
  Package oracle-java8-installer which provides java5-runtime-headless is not configured yet.

dpkg: error processing package libgeronimo-jms-1.1-spec-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          dpkg: dependency problems prevent configuration of ant:
 ant depends on default-jre-headless | java5-runtime-headless | java6-runtime-headless | java7-runtime-headless; however:
  Package default-jre-headless is not installed.
  Package oracle-java8-installer which provides default-jre-headless is not configured yet.
  Package java5-runtime-headless is not installed.
  Package oracle-java8-installer which provides java5-runtime-headless is not configured yet.
  Package java6-runtime-headless is not installed.
  Package oracle-java8-installer which provides java6-runtime-headless is not configured yet.
  Package java7-runtime-headless is not installed.
  Package oracle-java8-installer which provides java7-runtime-headless is not configured yet.

dpkg: error processing package ant (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          dpkg: dependency problems prevent configuration of javahelp2:
 javahelp2 depends on default-jre | java2-runtime; however:
  Package default-jre is not installed.
  Package oracle-java8-installer which provides default-jre is not configured yet.
  Package java2-runtime is not installed.
  Package oracle-java8-installer which provides java2-runtime is not configured yet.

dpkg: error processing package javahelp2 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of bnd:
 bnd depends on default-jre-headless | java6-runtime-headless; however:
  Package default-jre-headless is not installed.
  Package oracle-java8-installer which provides default-jre-headless is not configured yet.
  Package java6-runtime-headless is not installed.
  Package oracle-java8-installer which provides java6-runtime-headless is not configured yet.

dpkg: error processing package bnd (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of junit4:
 junit4 depends on default-jre-headless | java5-runtime-headless; however:
  Package default-jre-headless is not installed.
  Package oracle-java8-installer which provides default-jre-headless is not configured yet.
  Package java5-runtime-headless is not installed.
  Package oracle-java8-installer which provides java5-runtime-headless is not configured yet.

dpkg: error processing package junit4 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libistack-commons-java:
 libistack-commons-java depends on ant; however:
  Package ant is not configured yet.

dpkg: error processing package libistack-commons-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libnb-java5-java:
 libnb-java5-java depends on ant; however:
  Package ant is not configured yet.

dpkg: error processing package libnb-java5-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Processing triggers for man-db (2.7.6.1-2) ...
dpkg: dependency problems prevent configuration of aspectj:
 aspectj depends on default-jre-headless | java7-runtime-headless; however:
  Package default-jre-headless is not installed.
  Package oracle-java8-installer which provides default-jre-headless is not configured yet.
  Package java7-runtime-headless is not installed.
  Package oracle-java8-installer which provides java7-runtime-headless is not configured yet.

dpkg: error processing package aspectj (--configure):
 dependency problems - leaving unconfigured
Setting up libcwidget3v5:amd64 (0.5.17-6) ...
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of antlr3:
 antlr3 depends on default-jre-headless | java5-runtime-headless | java6-runtime-headless; however:
  Package default-jre-headless is not installed.
  Package oracle-java8-installer which provides default-jre-headless is not configured yet.
  Package java5-runtime-headless is not installed.
  Package oracle-java8-installer which provides java5-runtime-headless is not configured yet.
  Package java6-runtime-headless is not installed.
  Package oracle-java8-installer which provides java6-runtime-headless is not configured yet.

dpkg: error processing package antlr3 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              No apport report written because MaxReports is reached already
                                            dpkg: dependency problems prevent configuration of netbeans:
 netbeans depends on default-jdk (>= 2:1.8) | java8-sdk; however:
  Package default-jdk is not installed.
  Package java8-sdk is not installed.
  Package oracle-java8-installer which provides java8-sdk is not configured yet.
 netbeans depends on libnb-java5-java (= 8.1+dfsg3-4); however:
  Package libnb-java5-java is not configured yet.

dpkg: error processing package netbeans (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libcodemodel-java:
 libcodemodel-java depends on libistack-commons-java; however:
  Package libistack-commons-java is not configured yet.

dpkg: error processing package libcodemodel-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libnb-platform18-java:
 libnb-platform18-java depends on antlr3 (>= 3.4); however:
  Package antlr3 is not configured yet.
 libnb-platform18-java depends on javahelp2; however:
  Package javahelp2 is not configured yet.
 libnb-platform18-java depends on junit4 (>= 4.6); however:
  Package junit4 is not configured yet.

dpkg: error processing package libnb-platform18-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libsvnkit-java:
 libsvnkit-java depends on antlr3; however:
  Package antlr3 is not configured yet.

dpkg: error processing package libsvnkit-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libnb-apisupport3-java:
 libnb-apisupport3-java depends on libnb-java5-java (= 8.1+dfsg3-4); however:
  Package libnb-java5-java is not configured yet.
 libnb-apisupport3-java depends on libnb-platform18-java (>= 8.1); however:
  Package libnb-platform18-java is not configured yet.

dpkg: error processing package libnb-apisupport3-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libjaxb-java:
 libjaxb-java depends on libcodemodel-java (>= 2.6+jaxb2.3.0-1); however:
  Package libcodemodel-java is not configured yet.
 libjaxb-java depends on libistack-commons-java (>= 2.17); however:
  Package libistack-commons-java is not configured yet.

dpkg: error processing package libjaxb-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              No apport report written because MaxReports is reached already
                                            dpkg: dependency problems prevent configuration of ant-optional:
 ant-optional depends on ant (= 1.9.9-4); however:
  Package ant is not configured yet.

dpkg: error processing package ant-optional (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libbindex-java:
 libbindex-java depends on ant; however:
  Package ant is not configured yet.
 libbindex-java depends on bnd; however:
  Package bnd is not configured yet.
 libbindex-java depends on junit4; however:
  Package junit4 is not configured yet.

dpkg: error processing package libbindex-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libnb-platform-devel-java:
 libnb-platform-devel-java depends on ant; however:
  Package ant is not configured yet.
 libnb-platform-devel-java depends on javahelp2; however:
  Package javahelp2 is not configured yet.
 libnb-platform-devel-java depends on libbindex-java; however:
  Package libbindex-java is not configured yet.
 libnb-platform-devel-java depends on libnb-platform18-java (>= 8.1+dfsg1-6); however:
  Package libnb-platform18-java is not configured yet.

dpkg: error processing package libnb-platform-devel-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libeclipselink-java:
 libeclipselink-java depends on antlr3 (>= 3.2); however:
  Package antlr3 is not configured yet.
 libeclipselink-java depends on libgeronimo-jms-1.1-spec-java; however:
  Package libgeronimo-jms-1.1-spec-java is not configured yet.

dpkg: error processing package libeclipselink-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Setting up aptitude (0.8.3-1ubuntu4) ...
update-alternatives: using /usr/bin/aptitude-curses to provide /usr/bin/aptitude (aptitude) in auto mode
dpkg: dependency problems prevent configuration of libtxw2-java:
 libtxw2-java depends on libcodemodel-java (>= 2.6+jaxb2.3.0-1); however:
  Package libcodemodel-java is not configured yet.

dpkg: error processing package libtxw2-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              No apport report written because MaxReports is reached already
                                            dpkg: dependency problems prevent configuration of libmsv-java:
 libmsv-java depends on ant; however:
  Package ant is not configured yet.

dpkg: error processing package libmsv-java (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libnb-ide14-java:
 libnb-ide14-java depends on antlr3 (>= 3.5.2); however:
  Package antlr3 is not configured yet.
 libnb-ide14-java depends on libjaxb-java; however:
  Package libjaxb-java is not configured yet.
 libnb-ide14-java depends on libnb-platform18-java (>= 8.1); however:
  Package libnb-platform18-java is not configured yet.
 libnb-ide14-java depends on libsvnkit-java; however:
  Package libsvnkit-java is not configured yet.

dpkg: error processing package libnb-ide14-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of libsqljet-java:
 libsqljet-java depends on antlr3; however:
  Package antlr3 is not configured yet.

dpkg: error processing package libsqljet-java (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
Errors were encountered while processing:
 oracle-java8-installer
 libgeronimo-jms-1.1-spec-java
 ant
 javahelp2
 bnd
 junit4
 libistack-commons-java
 libnb-java5-java
 aspectj
 antlr3
 netbeans
 libcodemodel-java
 libnb-platform18-java
 libsvnkit-java
 libnb-apisupport3-java
 libjaxb-java
 ant-optional
 libbindex-java
 libnb-platform-devel-java
 libeclipselink-java
 libtxw2-java
 libmsv-java
 libnb-ide14-java
 libsqljet-java
E: Sub-process /usr/bin/dpkg returned an error code (1)

好吧,我是 Ubuntu 新手,不知道如何解决这些问题。

答案1

第一个值得运行的命令是:

sudo dpkg --configure -a

然后一步一步来:

sudo apt autoclean
sudo apt clean
sudo rm /var/lib/apt/lists/* -vf
sudo apt update
sudo apt upgrade

最后使用 安装您需要的所有内容apt

更新

另外尝试:

sudo rm -rf /var/lib/dpkg/info/oracle-java8-installer*
sudo apt purge oracle-java8-installer*
sudo rm -rf /etc/apt/sources.list.d/*java*
sudo apt update
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer

相关内容