Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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
share|improve this answer
    
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
    
Now it's right. :) –  jdthood Dec 7 '12 at 8:04

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

REPORT_ABSENT_SYMLINK=no

in /etc/default/resolvconf.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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