"Error: Could not open input file" for java related files when I try any APT command

5,762

You have an issue with /var/lib/dpkg/info/jdk1.8.0-111.postinst script (post installation or configuration script of jdk1.8.0-111 package)

The quickest workaround:

  1. Open /var/lib/dpkg/info/jdk1.8.0-111.postinst for editing and remove set -e from it
  2. Run sudo apt-get -f install to fix/complete installation.

Similar to my question here. There are many questions about different packages but with same solution. However, I'm not aware of any one that have nice answer to be canonical one and so we could flag other questions as duplicate. Even this solution, is a workaround and correct path is to raise bug report against each package to fix the script itself and make it more robust.

Share:
5,762

Related videos on Youtube

Nathan Damtew
Author by

Nathan Damtew

Updated on September 18, 2022

Comments

  • Nathan Damtew
    Nathan Damtew over 1 year

    I was trying to install Hide.Me VPN for some reason. Unfortunately I keep running to the same error every time. I'm using these instructions to install it. Below is the error I keep running into.

    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)
    

    I recently installed JDK, had some troubles while installing it but somehow I managed to install it successfully.

    Note: My system is Ubuntu 16.04LTS and I'm new to Ubuntu.

    • zwets
      zwets over 7 years
      Have you run sudo apt-get update && sudo apt-get -f install yet?
    • Nathan Damtew
      Nathan Damtew over 7 years
      what does that do ? @zwets
    • zwets
      zwets over 7 years
      Your problem isn't with the package you are trying to install (in fact, I suggest you remove Hide.Me VPN from the question title as it is unrelated). The problem is that Apt needs to finish a previous installation & configuration first. That command does just that (or at least tries to).
    • Nathan Damtew
      Nathan Damtew over 7 years
      I guess that did not work , I got the same error. @zwets
    • zwets
      zwets over 7 years
      Looking again at the output: what is that jdk1.8 package? (And what is it trying to do in /usr/java??). The error /usr/sbin/alternatives: No such file or directory seems to imply that the alternatives package isn't installed, or is broken. I suggest uninstalling the JDK package first (and installing the standard Ubuntu package openjdk-8-jdk instead), then proceed.
    • Nathan Damtew
      Nathan Damtew over 7 years
      what is the command to uninstall it ? & How do I know I've uninstalled it successfully?
    • zwets
      zwets over 7 years
      How to uninstall it depends on how you installed it. As it is not a standard Ubuntu package, it probably came with uninstallation instructions when you installed it? If not, you could try sudo apt-get purge jdk1.8.0-111 but there is no guarantee.
    • Nathan Damtew
      Nathan Damtew over 7 years
      Errors were encountered while processing: jdk1.8.0-111 E: Sub-process /usr/bin/dpkg returned an error code (1)
    • Nathan Damtew
      Nathan Damtew over 7 years
      If I can solve this error I can uninstall it . @zwets
    • zwets
      zwets over 7 years
      I can't really help beyond this point. Check the docs that came with the jdk1.8 package, or ask its distributor for help. Also note that there are 10 other questions on AskUbuntu from people who are/were stuck with the same error message (see the "Related" section on the right). There may be useful info there. Since you mention you are new to Ubuntu: try and stick with packages that come with the Ubuntu distribution. They will rarely get you stuck this way. With a deb pulled off the internet, you're essentially "on your own".