由于 jdk 问题,无法 sudo apt-get -f install

由于 jdk 问题,无法 sudo apt-get -f install

我完全被难住了。问题如下。

user@mycomputer:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
   openjdk-7-jdk
Suggested packages:
  visualvm
The following packages will be upgraded:
  openjdk-7-jdk
1 upgraded, 0 newly installed, 0 to remove and 322 not upgraded.
85 not fully installed or removed.
Need to get 0 B/16.3 MB of archives.
After this operation, 348 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or     without a controlling terminal.)
debconf: falling back to frontend: Readline
Selecting previously unselected package openjdk-7-jdk:i386.
(Reading database ... 258923 files and directories currently installed.)
Preparing to unpack .../openjdk-7-jdk_7u71-2.5.3-0ubuntu0.14.04.1_i386.deb ...
Unpacking openjdk-7-jdk:i386 (7u71-2.5.3-0ubuntu0.14.04.1) over (7u55-2.4.7-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/openjdk-7-jdk_7u71-2.5.3-    0ubuntu0.14.04.1_i386.deb (--unpack):
 trying to overwrite '/usr/lib/jvm/java-7-openjdk-i386/src.zip', which is also in     package openjdk-7-source 7u55-2.4.7-1ubuntu1
Errors were encountered while processing:
 /var/cache/apt/archives/openjdk-7-jdk_7u71-2.5.3-0ubuntu0.14.04.1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我不知道该删除/移除什么。有什么建议吗?提前谢谢。

编辑#1

添加 Charles Green 的建议的输出,因为在评论中无法读取。

user@mycomputer:~$ sudo apt-get remove --purge openjdk-7-source
[sudo] password for user: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 openjdk-7-jdk : Depends: openjdk-7-jre (= 7u55-2.4.7-1ubuntu1) but 7u71-2.5.3-0ubuntu0.14.04.1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

编辑#2

查尔斯·史密斯的第二个建议。

user@mycomputer:~$ sudo dpkg -i --force-overwrite /var/cache/apt/archives/openjdk-7-jdk_7u71-2.5.3-0ubuntu0.14.04.1_i386.deb
(Reading database ... 258923 files and directories currently installed.)
Preparing to unpack .../openjdk-7-jdk_7u71-2.5.3-0ubuntu0.14.04.1_i386.deb ...
Unpacking openjdk-7-jdk:i386 (7u71-2.5.3-0ubuntu0.14.04.1) over (7u55-2.4.7-1ubuntu1) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/lib/jvm/java-7-openjdk-i386/src.zip', which is also in package openjdk-7-source 7u55-2.4.7-1ubuntu1
dpkg: dependency problems prevent configuration of openjdk-7-jdk:i386:
 openjdk-7-jdk:i386 depends on openjdk-7-jre (= 7u71-2.5.3-0ubuntu0.14.04.1); however:
  Package openjdk-7-jre:i386 is not configured yet.

dpkg: error processing package openjdk-7-jdk:i386 (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 openjdk-7-jdk:i386

但是,如果我尝试sudo apt-get -f install,仍然会出现错误。

编辑3

user@mycomputer:~$ sudo dpkg -i /var/cache/apt/archives/openjdk-7-jre_7u71-2.5.3-0ubuntu0.14.04.1_i386.deb
dpkg: error processing archive /var/cache/apt/archives/openjdk-7-jre_7u71-2.5.3-0ubuntu0.14.04.1_i386.deb (--install):
 cannot access archive: No such file or directory
Errors were encountered while processing:
 /var/cache/apt/archives/openjdk-7-jre_7u71-2.5.3-0ubuntu0.14.04.1_i386.deb

编辑4

user@mycomputer:~/Downloads$ sudo dpkg -i openjdk-7-jre_7u71-2.5.3-0ubuntu0.14.04.1_i386.deb 
(Reading database ... 258922 files and directories currently installed.)
Preparing to unpack openjdk-7-jre_7u71-2.5.3-0ubuntu0.14.04.1_i386.deb ...
Unpacking openjdk-7-jre:i386 (7u71-2.5.3-0ubuntu0.14.04.1) over (7u71-2.5.3-0ubuntu0.14.04.1) ...
dpkg: dependency problems prevent configuration of openjdk-7-jre:i386:
 openjdk-7-jre:i386 depends on openjdk-7-jre-headless (= 7u71-2.5.3-0ubuntu0.14.04.1); however:
  Package openjdk-7-jre-headless:i386 is not configured yet.

dpkg: error processing package openjdk-7-jre:i386 (--install):
 dependency problems - leaving unconfigured
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
Processing triggers for mime-support (3.54ubuntu1) ...
Errors were encountered while processing:
 openjdk-7-jre:i386

答案1

OpenJDK7 中存在循环依赖错误,需要修补发布在这里。

答案2

安装工具aptitude

sudo apt-get install aptitude

跑步aptitude

sudo aptitude

在下面区域,您会看到一条红线。查看建议并选择一个合适的建议。

相关内容