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
  • 3
    Amplification: 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
  • This broke my internet, and now I can't fetch any packages from the ubuntu repos. – thouliha Mar 30 '16 at 16:54
  • 1
    This also broke internet, uninstalled, reinstall failed, and now I cant update anything. – CHammond Oct 7 '17 at 0:00
  • 1
    If you find yourself unable to fetch new packages, ping us.archive.ubuntu.com on another computer, grab the straight IP address returned and use that in a wget (ie: wget then install using dkpg (ie: dpkg -i resolvconf_1.78ubuntu4_all.deb) and reboot. Alternative would be to put the IP in your /etc/hosts just to get the update/install to complete. – vandsh Oct 12 '17 at 1:04
  • ln: cannot remove '/etc/resolv.conf': Device or resource busy – 1rq3fea324wre Jul 24 '18 at 21:02

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
  • 2
    This should be the accepted answer! How would you reinstall resolvconf when you can't resolve hostnames?! – Evils Apr 5 '16 at 14:00

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
  • 1
    I 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

Try this:

nano /etc/resolv.conf



nameserver 192.168.x.x (check your ifconfig output for the correct address)


sudo service resolvconf start
sudo systemctl enable resolvconf
  • re-installing resolvconf is probably a better idea – pim Dec 4 '17 at 15:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.