主机:文件 mdns4_minimal [NOTFOUND=return] 解析 [!UNAVAIL=return] dns myhostname

主机:文件 mdns4_minimal [NOTFOUND=return] 解析 [!UNAVAIL=return] dns myhostname

你好,我在使用 Ubuntu 18.04,最近我执行了一个致命的git clean命令,这个命令原本是用来清理硬盘缓存的,但它却几乎清除了我硬盘上的所有内容。

现在我无法授权我安装的任何软件...那是因为我无法解析您的机器的主机名:

$ ping hostname
ping: hostname: Nom ou service inconnu # in english : Name or service not known

因为

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat systemd
group:          compat systemd
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

尽管我的主机位于 \etc\hosts

127.0.0.1 localhost
127.0.1.1 blad-Lenovo-ideapad-300-15ISK

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

## Local by Flywheel - Start ##
::1 blad.local #Local Site
.
.
.

我真的不明白哪里出了问题,也不知道如何让一切恢复正常……

任何提示都可能有帮助

提前致谢 ^^

答案1

@ubfan1 当我这样做时ping blad-Lenovo-ideapad-300-15ISK我得到:

$ ping blad-Lenovo-ideapad-300-15ISK
PING blad-Lenovo-ideapad-300-15ISK (127.0.1.1) 56(84) bytes of data.
64 bytes from blad-Lenovo-ideapad-300-15ISK (127.0.1.1): icmp_seq=1 ttl=64 time=0.035 ms
64 bytes from blad-Lenovo-ideapad-300-15ISK (127.0.1.1): icmp_seq=2 ttl=64 time=0.069 ms
64 bytes from blad-Lenovo-ideapad-300-15ISK (127.0.1.1): icmp_seq=3 ttl=64 time=0.064 ms
64 bytes from blad-Lenovo-ideapad-300-15ISK (127.0.1.1): icmp_seq=4 ttl=64 time=0.063 ms
64 bytes from blad-Lenovo-ideapad-300-15ISK (127.0.1.1): icmp_seq=5 ttl=64 time=0.062 ms
64 bytes from blad-Lenovo-ideapad-300-15ISK (127.0.1.1): icmp_seq=6 ttl=64 time=0.063 ms
64 bytes from blad-Lenovo-ideapad-300-15ISK (127.0.1.1): icmp_seq=7 ttl=64 time=0.062 ms
^C
--- blad-Lenovo-ideapad-300-15ISK ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6147ms
rtt min/avg/max/mdev = 0.035/0.059/0.069/0.013 ms

当我这样做时,ping hostname我得到:

$ ping hostname
ping: hostname: Nom ou service inconnu # in english : Name or service not known

实际上整个问题始于安装 Matlab 时,我已经下载了与之前相同的版本,并且在许可步骤中收到了一条错误消息:

$ sudo ./matlab
License checkout failed.
License Manager Error -95
MATLAB is unable to connect to the license server. 
Make sure you can resolve the hostname of your machine. 
If you are unable to resolve the hostname, contact your System Administrator.

Troubleshoot this issue by visiting: 
https://www.mathworks.com/support/lme/R2018a/95

Diagnostic Information:
Feature: MATLAB 
License path: /home/blad/.matlab/R2018a_licenses:/usr/local/MATLAB/R2018a/licenses/license.dat:/usr/local/MATLAB/R
2018a/licenses/network.lic 
Licensing error: -95,378. System Error: 115

但我开始认为这是一个 DNS 问题,因为我没有得到 EDNS:

$ dig blad-Lenovo-ideapad-300-15ISK

; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> blad-Lenovo-ideapad-300-15ISK
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57976
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;blad-Lenovo-ideapad-300-15ISK. IN  A

;; ANSWER SECTION:
blad-Lenovo-ideapad-300-15ISK. 0 IN A   127.0.1.1

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Fri Jul 02 21:06:55 CET 2021
;; MSG SIZE  rcvd: 74

同样,localhost 我实际上还不知道问题是什么,只是知道有些事情出了问题……

相关内容