I use resolvconf to have static DNS servers set in /etc/resolv.conf. However, when I run sudo resolvconf -u to update /etc/resolv.conf with new static information, I get the error 'resolvconf: Error: /etc/resolv.conf must be a symlink'. How can I fix this?


It's easy to fix. Just open a terminal and run the following commands:

sudo rm /etc/resolv.conf
sudo ln -s ../run/resolvconf/resolv.conf /etc/resolv.conf
sudo resolvconf -u
  • 1
    This information is obsolete. /etc/resolv.conf must now be symlinked to ../run/resolvconf/resolv.conf.
    – jdthood
    Oct 28 '12 at 19:29
  • The claim that the error message is caused by an interrupted resolvconf run is false.
    – jdthood
    Oct 30 '12 at 8:05
  • 1
    Now it's right. :)
    – jdthood
    Dec 7 '12 at 8:04
  • 3
    @jdthood : why is ../ needed? Why shouldn't we use sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf?
    – Basj
    May 15 '17 at 14:28
  • 2
    @Basj The difference is that it makes the symlink relative: read it as something like "go up a folder, then to 'run', then to 'resolvconf', then to the file 'resolv.conf'". I'm guessing either way works, but why hardcode a path? What if you are working with LXC containers (where the root FS is in a folder)? Then opening the link from the LXC host will take you to the wrong file if you used an absolute path.
    – Azendale
    May 16 '17 at 16:33

As of Ubuntu 12.04 resolvconf is part of the base system. You can recreate the needed symlink by running

dpkg-reconfigure resolvconf

or by doing the following in a terminal.

sudo ln -nsf ../run/resolvconf/resolv.conf /etc/resolv.conf

Note that as of Ubuntu 12.10 resolvconf no longer aborts if /etc/resolv.conf is not a symlink. It does print a warning message, but this can be silenced by putting the line


in /etc/default/resolvconf.

  • I'm assuming doing the dpkg-reconfigure command changes /etc/resolv.conf back to being a symlink, even if a normal file is at /etc/resolv.conf? Also, do you have to remove /etc/resolv.conf before doing ln? I get an error trying it on my system, but then again, I wasn't having the error described in this question when I tried it.
    – Azendale
    Nov 3 '12 at 16:17
  • Yes, running "dpkg-reconfigure resolvconf" changes /etc/resolv.conf back into a symlink and if there was a file there; it saves a copy of the original file at /etc/resolvconf/resolv.conf.d/original. It's a good idea to remove /etc/resolv.conf before putting a symlink there, but if you use "ln -nsf" it's not necessary to do so. I have just changed the answer to say "ln -nsf" instead of "ln -s".
    – jdthood
    Nov 3 '12 at 21:35

rm -r resolv.conf
nano resolv.conf in it do



save it with ctrl+ X.

after that do: sudo apt-get install openresolv

after that: reboot the computer it will work .


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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