Accidentally deleted /etc/resolv.conf and now can't access any domain
11,218
To fix this you should recreate the link how it was. On 18.04 /etc/resolv.conf
points to ../run/systemd/resolve/stub-resolv.conf
.
So to fix your problem it should be enough to do the following:
sudo rm resolv.conf
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
Related videos on Youtube
Comments
-
आनंद over 1 year
I was getting dns probe finished message in chrome on Ubuntu 18.04 so I looked up on the internet and tried to run the following commands.
sudo rm/etc/resolv.conf sudo ln -s /var/run/resolvconf/resolv.conf /etc/resolv.conf
Above 2 commands executed successfully but the following didn't.
sudo resolvconf -u
It gives an error message that
resolvconf
is not installed.Now, nothing is working and
/etc/resolv.conf
file is empty. I'm not even able to edit it (I tried to a addnameserver 8.8.8.8
).Please help.
Edit: i'm still getting ERR_NAME_NOT_RESOLVE and here's the output of 'service --status-all`.
[ + ] acpid [ - ] alsa-utils [ - ] anacron [ + ] apparmor [ + ] apport [ + ] avahi-daemon [ + ] bluetooth [ - ] console-setup.sh [ + ] cron [ + ] cups [ + ] cups-browsed [ + ] dbus [ - ] dns-clean [ + ] gdm3 [ + ] grub-common [ - ] hwclock.sh [ + ] irqbalance [ + ] kerneloops [ - ] keyboard-setup.sh [ + ] kmod [ + ] network-manager [ + ] networking [ - ] plymouth [ - ] plymouth-log [ - ] pppd-dns [ + ] procps [ - ] rsync [ + ] rsyslog [ - ] saned [ + ] speech-dispatcher [ - ] spice-vdagent [ + ] udev [ + ] ufw [ + ] unattended-upgrades [ - ] uuidd [ + ] whoopsie [ - ] x11-common
-
Admin almost 6 yearsOn 18.04
/etc/resolv.conf
points to../run/systemd/resolve/stub-resolv.conf
-
-
muclux almost 6 yearsIn my native 18.04 I have
/etc/resolv.conf -> ../run/resolvconf/resolv.conf
, in my VirtualBox 18.04 I have the link like you wrote. My native 18.04 is an upgrade from 17.10 but the VB system was a fresh install - perhaps this explains the difference? -
Videonauth almost 6 yearsProbably. This 18.04 I have here was a total fresh install, so I guess too that your different linkage is due to being an upgraded system.
-
आनंद almost 6 years@Videonauth Thanks. But I'm still occasionally getting ERR_NAME_NOT_RESOLVED. What should I do? I googled and found this answer askubuntu.com/questions/1029603/… The output of
sudo service --status-all
is added in question. -
Videonauth almost 6 yearsDid you restart the machine after the repair?
-
आनंद almost 6 yearsYes, I did. But I continue to get the same message of DNS BAD CONFIG