当我尝试任何 APT 命令时,java 相关文件出现“错误:无法打开输入文件”

当我尝试任何 APT 命令时,java 相关文件出现“错误:无法打开输入文件”

由于某种原因,我尝试安装 Hide.Me VPN。不幸的是,每次我都会遇到同样的错误。我正在使用这些说明安装它。下面是我一直遇到的错误。

nate1141@NatesPC:~$ sudo apt-get install openvpn network-manager-openvpn network-manager-openvpn-gnome
[sudo] password for nate1141: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openvpn is already the newest version (2.3.10-1ubuntu2).
network-manager-openvpn is already the newest version (1.1.93-1ubuntu1).
network-manager-openvpn-gnome is already the newest version (1.1.93-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 83 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up jdk1.8.0-111 (1.8.0111-fcs-1) ...
Unpacking JAR files...
    tools.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/lib/tools.pack
    plugin.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/plugin.pack
    javaws.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/javaws.pack
    deploy.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/deploy.pack
    rt.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/rt.pack
    jsse.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/jsse.pack
    charsets.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/charsets.pack
    localedata.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/ext/localedata.pack
/var/lib/dpkg/info/jdk1.8.0-111.postinst: line 641: /usr/sbin/alternatives: No such file or directory
/var/lib/dpkg/info/jdk1.8.0-111.postinst: line 653: /usr/sbin/alternatives: No such file or directory
dpkg: error processing package jdk1.8.0-111 (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 jdk1.8.0-111
E: Sub-process /usr/bin/dpkg returned an error code (1)

我最近安装了 JDK,安装时遇到了一些问题,但不知何故我还是成功安装了它。

笔记:我的系统是 Ubuntu 16.04LTS,我是 Ubuntu 新手。

答案1

您的脚本存在问题/var/lib/dpkg/info/jdk1.8.0-111.postinst(jdk1.8.0-111 包的安装后或配置脚本)

最快的解决方法:

  1. 打开/var/lib/dpkg/info/jdk1.8.0-111.postinst进行编辑并set -e从中删除
  2. 运行sudo apt-get -f install以修复/完成安装。

跟我的问题类似这里。有很多关于不同软件包的问题,​​但解决方案相同。但是,我不知道有哪个问题的答案是标准的,所以我们可以将其他问题标记为重复。即使是这个解决方案,也是一种变通方法,正确的方法是针对每个软件包提交错误报告,以修复脚本本身并使其更强大。

相关内容