DNS 解析失败,原因未知

DNS 解析失败,原因未知

在 64 位 kali linux 中安装 jdk 8 时出现以下错误。

root@kali:~# apt-get install oracle-java8-installer 
Reading package lists... Done
Building dependency tree        
Reading state information... Done
oracle-java8-installer is already the newest version (8u111+8u111arm-1~webupd8~0).
The following packages were automatically installed and are no longer required:
  aapt android-libaapt android-libandroidfw android-libbacktrace android-libbase
  android-libcutils android-liblog android-libunwind android-libutils android-libziparchive
  fastjar fonts-dejavu-extra jarwrapper java-wrappers junit libadns1 libantlr-java
  libantlr3-runtime-java libapache-pom-java libatinject-jsr330-api-java libatk-wrapper-java
  libatk-wrapper-java-jni libcommons-cli-java libcommons-io-java libcommons-lang3-java
  libcommons-parent-java libcrypto++6 libguava-java libice-dev libjaxp1.3-java libjsr305-java
  libpthread-stubs0-dev libsm-dev libsmali-java libstringtemplate-java libx11-dev libx11-doc
  libxau-dev libxcb1-dev libxdmcp-dev libxmlunit-java libxpp3-java libxt-dev
  libyaml-snake-java python-adns python-easygui python-levenshtein python-metaconfig
  python-pycryptopp python-pysnmp4 python-pysnmp4-apps python-pysnmp4-mibs smitools
  x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1463 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 oracle-java8-installer (8u111+8u111arm-1~webupd8~0) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2016-12-16 21:05:09--  http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
Resolving false (false)... failed: Name or service not known.
wget: unable to resolve host address ‘false’
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

我对此进行了很多搜索,但无法弄清楚是什么原因造成的。

如果我运行wget http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz它工作正常。

并且工作nslookup google.comping google.com不会出现错误。

我还删除了文件中的所有内容,/var/cache/oracle-jdk8-installer/wgetrc但又出现了同样的问题。

请帮忙!

答案1

这是一个特殊的问题。

DNS 并没有因为某种奇怪的原因而失败,您的 DNS 工作正常。但是,您尝试的包似乎带有损坏的安装后脚本,该脚本将“false”作为主机名并将其传递给 wget,而不是预期的主机名。

从输出中可以很明显地看出:

...

--2016-12-16 21:05:09-- http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz

解析错误(假)...失败:名称或服务未知。

wget:无法解析主机地址“假”

如果我想更深入地研究它,我会查看 /var/cache/oracle-jdk8-installer/wgetrc 看看那里是否有损坏的东西,然后apt-get clean重试。

我建议您尝试实现此结果 - 使用替代方法安装 java,例如此处描述的http://www.2daygeek.com/install-oracle-java-using-java-alternatives-method-on-ubuntu-centos-debian-fedora-mint-rhel-opensuse/看看它是否适合你 - 也许这将是最快的。

答案2

在完成安装后脚本后我已经解决了这个问题。问题出在/etc/apt/apt.conf.它被错误配置为Acquire::http::Proxy "false".这有效,apt但其他像这个脚本这样的程序因此无法工作。我删除了这一行,现在问题就消失了。

感谢@Nikolai 关于安装后脚本的建议。

答案3

在 /var/cache/oracle-jdk8-installer/wgetrc 中添加“use_proxy=no”并重新尝试以下命令: apt-get install oracle-java8-installer

对我来说,它有效。

相关内容