×


resolvconf error resolv conf must be a symlink - Fix it Now

Are you facing resolvconf error /etc/resolv.conf must be a symlink?

This guide is for you.


Recently we had a customer who came across this error while trying to restart the BIND 9 server under Ubuntu Linux using service bind9 restart or service bind9 start command.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Linux queries.

In this context, we shall look into how to fix this Ubuntu error.


resolvconf error /etc/resolv.conf must be a symlink

Generally, we use resolvconf to manage nameserver information. It comprises a simple database for run-time nameserver information and a simple framework for notifying applications of changes in that information.

Resolvconf acts as the intermediary between programs that supply nameserver information and applications that use that information.

We can add to or remove information from the database using the resolvconf program.

The resolvconf -u command only updates resolv.conf from resolvconf’s own database. The database should be updated.

For that, we have to call resolvconf with the -a or -d option.

Usually, this error occurs when we try to restart the BIND 9 server under Ubuntu Linux.

# service bind9 restart

OR

# service bind9 start

resolvconf: Error: /etc/resolv.conf must be a symlink


How to solve resolv.conf error /etc/resolv.conf must be a symlink error?

You can apply the tips given below to resolve this error.

To begin, you can log in as root and perform the following commands:

$ sudo -i
# cd /etc
# rm resolv.conf
# ln -s /etc/resolvconf/run/resolv.conf .
# service bind9 restart

Also, if you are getting a Postfix Error, then,

the postfix error message might look like this:

* Stopping domain name service… bind9 [ OK ]
* Starting domain name service… bind9
/usr/sbin/postconf: fatal: open /etc/postfix/main.cf: No such file or directory
cp: `/etc/resolv.conf’ and `/etc/resolv.conf’ are the same file
run-parts: /etc/resolvconf/update-libc.d/postfix exited with return code 1
run-parts: /etc/resolvconf/update.d/libc exited with return code 1

Then, run the below commands:

$ sudo -i
# cd /etc
# mkdir postfix
# touch postfix/main.cf
# rm resolv.conf
# ln -s /etc/resolvconf/run/resolv.conf .
# service bind9 restart

In Ubuntu 12.04, resolvconf is part of the base system. To recreate the symlink we need, we run:

$ dpkg-reconfigure resolvconf

Alternatively, you can execute the following command in a terminal:

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

In Ubuntu 12.10, resolvconf no longer aborts if /etc/resolv.conf is not a symlink.

Instead, it prints a warning that can be silenced by adding the line:

REPORT_ABSENT_SYMLINK=no

in /etc/default/resolvconf.


[Couldn't resolve Ubuntu Linux System error? We'd be happy to assist. ]


Conclusion

This article covers how to fix resolv.conf error which happens when we try to restart the BIND 9 server under Ubuntu Linux.


To fix Resolvconf error "resolvconf: Error: /etc/resolv.conf must be a symlink":

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


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.