Reputation: 10684
I'm getting an error and I cannot see what happens, please see if you can catch what's wrong.
Whenever I use the "host" command, I get this error:
xavi@cobalto:~$ host www.guparty.com
host: parse of /etc/resolv.conf failed
I think the syntax is correct:
xavi@cobalto:~$ cat /etc/resolv.conf
search dsitelecom.com
nameserver 8.8.8.8 8.8.4.4
Also permissions are readable for everybody:
xavi@cobalto:~$ ls -l /etc/resolv.conf
-rw-r--r-- 1 root root 49 2011-10-30 12:02 /etc/resolv.conf
Probably it is a silly thing but I cannot get it. Do you see anything wrong there?
Thanks!
Upvotes: 12
Views: 35176
Reputation: 1
I ran into the same issue:
$ nslookup
nslookup: parse of /etc/resolv.conf failed
But in my case the problem is because the permission of the file is:
-rw------- 1 root root 93 Apr 22 20:22 /etc/resolv.conf
To fix it all I have to do is:
sudo chmod 644 /etc/resolv.conf
And the issue is resolved.
Upvotes: 0
Reputation: 1456
I experienced this issue in WSL2, but my resolv.conf was definitely in the correct format. I even hexdumped it to verify that the line endings were correct. Following the below fixed it:
Find out nameserver with windows powershell using ipconfig.exe
Use sudo nano /etc/wsl.conf
to add:
[network]
generateResolvConf = false
Restart wsl (Windows powershell) using wsl --shutdown
Open WSL and take a backup of /etc/resolv.conf
. Then remove it via rm -f /etc/resolv.conf
Add new file sudo nano /etc/resolv.conf
with:
nameserver X.X.X.X
Restart wsl (Windows powershell) using wsl --shutdown
Open WSL and remove using wget google.com
and test some you corporate domain.
Adapted from https://github.com/microsoft/WSL/issues/1350#issuecomment-1187571290
Upvotes: 0
Reputation: 6794
I saw the same error when by mistake *nix EOLs ("\n") were replaced with windows ones ("\r\n"). Solution: dos2unix filename
Upvotes: 4
Reputation: 21
I had similar problem, but did this and got working:
# mv resolv.conf resolv.conf.old
# cat resolv.conf.old
search example.com
domain example.com
nameserver 11.22.33.44
nameserver 2000::1
# echo "search example.com" >>resolv.conf
# echo "domain example.com" >>resolv.conf
# echo "nameserver 11.22.33.44" >>resolv.conf
# echo "nameserver 2000::1" >>resolv.conf
The addresses are just example, but the result is working. Why copy resolv.conf is that you get a copy of original. Then when you print it out, you dont have to remember everything inside resolv.conf. And when you make the file with echos, you can be sure that there is no extra chars those make troubles. So echo all nameserver lines to there.
Upvotes: 2
Reputation: 19194
Check your syntax, you need to define one nameserver per line in /etc/resolv.conf
search dsitelecom.com
nameserver 8.8.8.8
nameserver 8.8.4.4
Upvotes: 20