resolv.conf keeps getting reset by something

You can make static additions to /etc/resolv.conf. Those additions could override the things that are being automatically added.

First, install the resolvconf package.

Then, press Alt+F2 and run gksudo nautilus. Open /etc/resolvconf/resolv.conf.d/head if you want to add to the start of the file; open /etc/resolvconf/resolv.conf.d/tail if you want to add to the end. Make your changes, save/close the files, and then run sudo resolvconf -u to apply the changes.

(Sorry that I don't remember if the settings at the start or end of the file have the highest priority.)


(This answer contains ways to investigate what's going on. I may be able to give an actual solution if you use these methods to gather and provide more information.)

A possible trigger for the seemingly spontaneous updates to /etc/resolv.conf is when your DHCP lease is renewed. Check how long you get DHCP leases for (this should appear in the system logs, I think in /var/log/syslog).

You can use auditd Install auditd to find out what modifies the file. Start the daemon (sudo service auditd start) and tell it to watch for modifications to that file:

sudo auditctl -w /etc/resolv.conf -p w

Audit logs are in /var/log/audit/audit.log. You'll see the time the file was modified and the name of the program that modified it.

If you have the resolvconf package installed, Network Manager may be stepping on its toes. Try bringing all network interfaces down, then stop Network Manager (sudo service network-manager stop), then restart it.


I had the exact same problem - resolv.conf would be rewritten every time the server was rebooted.

It was caused by DHCP. To set resolv.conf to what I want it to be, I edited /etc/dhcp/dhclient.conf and added the following:

supersede domain-name "my.domain.com";
prepend domain-search "my.domain.com";

You can actually control quite a bit about your resolv.conf file by making changes to this.

Hope it helps.