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?
5 Answers
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

- 960
-
6This should be the accepted answer! How would you reinstall resolvconf when you can't resolve hostnames?! – Evils Apr 05 '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

- 70,465

- 61
-
-
This would only affect things temporarily. The /etc/resolv.conf file would be overwritten since it's managed by the resolvconf package. – TheZeke Nov 04 '20 at 09:28
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.8
to the file.
-
Reinstall the
network-manager
,libnss-resolve
, andresolvconf
packages:apt install --reinstall resolvconf network-manager libnss-resolve

- 51
-
1Good answer. If your dns resolution is broken, this gets you back to working, so you can effect other repairs. – Kevin Buchs Feb 09 '23 at 13:51
Have you emptied your trash, if not, you can restore from trash.

- 1,155
-
1Thanks for reply.I never used delete alone but shift+delete,so not in trash. – beeju May 09 '12 at 00:41
-
1I see. Try to use a recovery program, i.e foremost. Or try to do what @desgua said. – Svetlana Belkin May 09 '12 at 00:43
-
Seriously... Who uses "trash"? If you're going to delete a file like this, you do it from the command line. – Auspex Oct 30 '23 at 01:24
us.archive.ubuntu.com
on 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/hosts
just to get the update/install to complete. – vandsh Oct 12 '17 at 01:04ubuntu/pool/main/r/resolvconf
is not valid, underr
is no resolvconf. – Timo Apr 30 '22 at 13:41