I deleted both the resolvconf folder and the resolv.conf file in /etc by mistake, assuming that resolvconf was causing UCK to fail. Now the application has upgraded, fixing the issue, but it says no file named resolv.conf in /etc.
What it says is correct because I deleted those files. Is there any way to recreate the files or restore from another location?
You could reinstall resolvconf to restore the default configuration:
sudo apt-get install --reinstall resolvconf
Another idea would be remove "resolvconf" and then install:
sudo apt-get remove --purge resolvconf && sudo apt-get install resolvconf
-
3Amplification: to ensure that resolvconf is fully restored you have to purge it and install it again, then reboot. If you don't purge it but only remove it then it won't install the symlink at /etc/resolv.conf on reinstall. If you don't reboot then resolvconf's database will generally be missing nameserver information until you do reboot... or reconfigure (down and up) all active interfaces. – jdthood Oct 28 '12 at 20:19
-
1This broke my internet, and now I can't fetch any packages from the ubuntu repos. – thouliha Mar 30 '16 at 16:54
-
1This also broke internet, uninstalled, reinstall failed, and now I cant update anything. – Chris Oct 7 '17 at 0:00
-
4If you find yourself unable to fetch new packages, ping
us.archive.ubuntu.comon another computer, grab the straight IP address returned and use that in awget(ie:wget http://91.189.91.26/ubuntu/pool/main/r/resolvconf/resolvconf_1.78ubuntu4_all.deb) then install usingdkpg(ie:dpkg -i resolvconf_1.78ubuntu4_all.deb) and reboot. Alternative would be to put the IP in your/etc/hostsjust to get the update/install to complete. – vandsh Oct 12 '17 at 1:04 -
If resolvconf -u shows the WARNING that /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf then just backup that resolv.conf and make the symbolic link:
$ cd /etc
$ sudo ln -s /run/resolvconf/resolv.conf
-
3This should be the accepted answer! How would you reinstall resolvconf when you can't resolve hostnames?! – Evils Apr 5 '16 at 14:00
Try this:
nano /etc/resolv.conf
add:
nameserver 8.8.8.8
nameserver 192.168.x.x
(check your ifconfig output for the correct address)
then
sudo service resolvconf start
sudo systemctl enable resolvconf
-
-
This would only affect things temporarily. The /etc/resolv.conf file would be overwritten since it's managed by the resolvconf package. – TheZeke Nov 4 '20 at 9:28
Have you emptied your trash, if not, you can restore from trash.
-
Thanks for reply.I never used delete alone but shift+delete,so not in trash. – beeju May 9 '12 at 0:41
-
1I see. Try to use a recovery program, i.e foremost. Or try to do what @desgua said. – Svetlana Belkin May 9 '12 at 0:43
The accepted answer did not work for me. After reinstalling resolvconf, the system would completely wipe my resolv.conf file after each reboot.
To fix this, I had to reinstall the network-manager and libnss-resolve packages in addition to resolvconf.
Manually add a nameserver to resolve.conf (this is so you can fetch packages from the Ubuntu repos):
-
sudo vi /etc/resolv.conf - Add
nameserver 8.8.8.8to the file.
-
Reinstall the
network-manager,libnss-resolve, andresolvconfpackages:apt install --reinstall resolvconf network-manager libnss-resolve