我正在尝试将 Ubuntu 服务器上的 Java 更新到 Java 8,但收到一条错误消息,并且 Java 无法更新。
error message: Errors where encountered while processing E: Sub-process /usr/bin/dpkg returned an error code (1)
我用了:
sudo add-apt-repository ppa:webupd8team/java
然后:
sudo apt update
出现错误:
Failed to fetch ......binary-amd64/Packages 404 not found
Failed to fetch ......binary-i386/Packages 404 not found
E: some files failed to download. Thay have been ignored,or old ones used instead.
然后:
sudo apt install oracle-java8-installer
出现错误:
E: Sub-process /usr/bin/dpkg returned an error code (1)
我也尝试过sudo apt-get -f install
并且给出了这个输出:
Debconf : DbDriver "config" : /var/cache/deconf/config.dat is locked by another process: resource temorarily unavalable
Dpkg: error processing pacage openssh-server (--configure):
Subprocess installed post-instalation script returned error exit status 2
Errors were encountered while processing:
openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
我已经有一年没有使用我的 16.10 服务器了,而且它已经两年没有更新了。
我使用sudo apt-get update
并得到了这个输出:
sijmen@dell:~$ sudo apt-get update
[sudo] password for sijmen:
Ign http: //ppa.launchpad.net trusty InRelease
Ign http: //ppa.launchpad.net trusty Release.gpg
Ign http: //ppa.launchpad.net trusty Release
Err http: //ppa.launchpad.net trusty/main amd64 Packages
404 Not Found
Err http: //ppa.launchpad.net trusty/main i386 Packages
404 Not Found
Ign http: //ppa.launchpad.net trusty/main Translation-en
W: Failed to fetch http:
/ppa.launchpad.net/thefrontiergroup/vsftpd/ubuntu/dists/trusty/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http:
/ppa.launchpad.net/thefrontiergroup/vsftpd/ubuntu/dists/trusty/main/binary-i386/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
然后我运行sudo apt-get install oracle-java-8-installer
并给出了以下输出:
sijmen@dell:~$ sijmen@dell:~$ sudo apt-get install oracle-java-8-installer
WARNING:root:could not open file '/etc/apt/sources.list'
sijmen@dell:~$: command not found
sijmen@dell:~$ [sudo] password for sijmen:
WARNING:root:could not open file '/etc/apt/sources.list'
[sudo]: command not found
sijmen@dell:~$ Reading package lists... Done
WARNING:root:could not open file '/etc/apt/sources.list'
Reading: command not found
sijmen@dell:~$ Building dependency tree
WARNING:root:could not open file '/etc/apt/sources.list'
Building: command not found
sijmen@dell:~$ Reading state information... Done
WARNING:root:could not open file '/etc/apt/sources.list'
Reading: command not found
sijmen@dell:~$ E: Unable to locate package oracle-java-8-installer
WARN
E:: command not found
然后我运行sudo apt-add-repository --remove ppa:webupd8team/java
并得到了这个输出。
sijmen@dell:~$ sijmen@dell:~$ sudo apt-get install oracle-java-8-installer
WARNING:root:could not open file '/etc/apt/sources.list'
sijmen@dell:~$: command not found
sijmen@dell:~$ [sudo] password for sijmen:
WARNING:root:could not open file '/etc/apt/sources.list'
[sudo]: command not found
sijmen@dell:~$ Reading package lists... Done
WARNING:root:could not open file '/etc/apt/sources.list'
Reading: command not found
sijmen@dell:~$ Building dependency tree
WARNING:root:could not open file '/etc/apt/sources.list'
Building: command not found
sijmen@dell:~$ Reading state information... Done
WARNING:root:could not open file '/etc/apt/sources.list'
Reading: command not found
sijmen@dell:~$ E: Unable to locate package oracle-java-8-installer
WARNING:root:could not open file '/etc/apt/sources.list'
E:: command not found
sijmen@dell:~$ sudo apt-add-repository --remove ppa:webupd8team/java
WARNING:root:could not open file '/etc/apt/sources.list'
WARNING:root:could not open file '/etc/apt/sources.list'
Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.
Important -> Why Oracle Java 7 And 6 Installers No Longer Work: http://www.webupd8.org/2017/06/why-oracle-java-7-and- 6-installers-no.html
Ubuntu 16.10 Yakkety Yak is no longer supported by Canonical (and thus, Launchpad and this PPA). The PPA supports Ubuntu 17.10, 17.04, 16.04, 14.04 and 12.04.
More info (and Ubuntu installation instructions):
- for Oracle Java 7: http: //www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
- for Oracle Java 8: http: //www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html
Debian installation instructions:
- Oracle Java 7: http: //www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html
- Oracle Java 8: http: //www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html
Oracle Java 9 (for both Ubuntu and Debian): http://www.webupd8.org/2015/02/install-oracle-java-9-in-ubuntu-linux.html
Oracle JDK 9 is now considered stable. There are currently only 64bit builds (no other builds are available for download: http: //www.oracle.com/technetwork/java/javase/downloads/index.html )
More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java
Press [ENTER] to continue or ctrl-c to cancel removing it
WARNING:root:could not open file '/etc/apt/sources.list'
WARNING:root:could not open file '/etc/apt/sources.list'
WARNI NG:root:could not open file '/etc/apt/sources.list'
WARNING:root:could not open file '/etc/apt/sources.list'
WARNING:root:could not open file '/etc/apt/sources.list'
WARNING:root:could not open file '/etc/apt/sources.list'
然后我运行sudo apt-get update
并给出了以下输出:
sijmen@dell:~$ sudo apt-get update
Ign http: //ppa.launchpad.net trusty InRelease
Ign http: //ppa.launchpad.net trusty Release.gpg
Ign http: //ppa.launchpad.net trusty Release
Err http: //ppa.launchpad.net trusty/main amd64 Packages
404 Not Found
Err http: //ppa.launchpad.net trusty/main i386 Packages
404 Not Found
Ign http: //ppa.launchpad.net trusty/main Translation-en
W: Failed to fetch http: //ppa.launchpad.net/thefrontiergroup/vsftpd/ubuntu/dists/trusty/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http: //ppa.launchpad.net/thefrontiergroup/vsftpd/ubuntu/dists/trusty/main/binary-i386/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
然后我运行sudo apt-get install openjdk-8-jdk
并给出了以下输出:
sijmen@dell:~$ sudo apt-get install openjdk-8-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package openjdk-8-jdk
也适用于当前的 Java 版本:
sijmen@dell:~$ java -version
java version "1.7.0_76"
Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
答案1
没有名为oracle-java8-安装程序在 ppa:webupd8team/java 中。包的正确名称是 oracle-java-8-installer。打开终端并输入:
sudo apt update
sudo apt install oracle-java-8-installer
或者,您可以从所有当前支持的 Ubuntu 版本中的默认存储库安装 Java 8。使用 从软件源中删除 ppa:webupd8team/java 存储库sudo apt-add-repository --remove ppa:webupd8team/java
,使用 更新软件包列表sudo apt-get update
并运行以下命令:
sudo apt install openjdk-8-jdk
如果仍然收到Debconf : DbDriver "config" : /var/cache/deconf/config.dat is locked by another process: resource temporarily unavailable
错误消息,请按照以下答案解决安装软件包时出现“debconf:DbDriver“config”:config.dat 被另一个进程锁定:资源暂时不可用”。
答案2
W: Failed to fetch http:
/ppa.launchpad.net/thefrontiergroup/vsftpd/ubuntu/dists/trusty/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http:
/ppa.launchpad.net/thefrontiergroup/vsftpd/ubuntu/dists/trusty/main/binary-i386/Packages 404 Not Found
这些错误表明这两个 ppa 不再存在。将它们从/etc/apt/sources.list
和中删除/etc/apt/sources.list.d
没有理由拥有它们,因为 vsftp 存在于主存储库中。
另外我建议您升级到 17.10,因为 16.10 不再受支持。
一旦存储库被删除,
sudo apt update
应该可以工作,然后您就可以安装 Java 8。