Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

resolv.conf being overwritten at every boot

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
User avatar
infestor
Posts: 175
Joined: 2012-02-07 22:18

resolv.conf being overwritten at every boot

#1 Post by infestor »

my goal is only to change the DNS servers (IP address being assigned by DHCP is OK. since i can't get a static IP adr)

i edited /etc/resolv.conf and the new DNS servers took effect immediately. however when i rebooted debian testing, resolv.conf was reverted to default (192.168.1.1)
Last edited by infestor on 2017-07-04 16:09, edited 1 time in total.
---------------

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: resolv.conf being overwritten at every boot

#2 Post by pylkko »


User avatar
orythem27
Posts: 252
Joined: 2017-05-11 07:59
Location: P.R. China

Re: resolv.conf being overwritten at every boot

#3 Post by orythem27 »

Most likely /etc/resolv.conf is managed by NetworkManager or resolvconf. If you are using NetworkManager you'll have to configure DNS in NetworkManager. Choose "Automatic (DHCP) addressed only": https://i.stack.imgur.com/Cumpo.png

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: resolv.conf being overwritten at every boot

#4 Post by dasein »

infestor wrote:when i rebooted... resolv.conf was reverted to default (192.168.1.1)
Working exactly as designed. The D in DHCP stands for Dynamic.

Network configuration is covered quite extensively in the Wiki: https://wiki.debian.org/NetworkConfiguration
pylkko wrote:That is how it works.
https://wiki.debian.org/resolv.conf
GACK!!! That Wiki page is an abomination. A chmod hack to resolv.conf serves only to break DHCP, which doesn't qualify as a solution to anything. In the immortal words of Wolfgang Pauli, "It is not only not right; it is not even wrong."

User avatar
infestor
Posts: 175
Joined: 2012-02-07 22:18

Re: resolv.conf being overwritten at every boot

#5 Post by infestor »

orythem27 wrote:Most likely /etc/resolv.conf is managed by NetworkManager or resolvconf. If you are using NetworkManager you'll have to configure DNS in NetworkManager. Choose "Automatic (DHCP) addressed only": https://i.stack.imgur.com/Cumpo.png
im using KDE 5. is there a graphical interface for network manager that comes by default?
---------------

Bulkley
Posts: 6383
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: resolv.conf being overwritten at every boot

#6 Post by Bulkley »

infestor wrote:is there a graphical interface for network manager that comes by default?
My memory isn't great on this sort of thing so I put graphical interface network manager into Startpage search and got a couple of pages that answer your question. Take a look.

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: resolv.conf being overwritten at every boot

#7 Post by dasein »

Can't speak to KDE 5, but KDE 4 did indeed include a network manager plasma widget by default. Look for a network widget in your system tray.

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: resolv.conf being overwritten at every boot

#8 Post by pylkko »


GACK!!! That Wiki page is an abomination. A chmod hack to resolv.conf serves only to break DHCP, which doesn't qualify as a solution to anything. In the immortal words of Wolfgang Pauli, "It is not only not right; it is not even wrong."
I believe all Debian installs use resolvconf to overwrite resolv.conf. Either that or there is something at a" higher level" like network manager doing it. I've seen people suggest preventing that from happening, but it has always sounded like a dirty hack and that it would be better to edit configure the files/programs that are overwriting it to do it as wanted. The Debian wiki is quite often wrong or out of date unfortunately. Without knowing better I would guess that while that is possible, in many cases if not all, that should not be done. Maybe if some one really wanted to use resolv.conf manually, then they should uninstall all the other packages and create a custom install.

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: resolv.conf being overwritten at every boot

#9 Post by dasein »

pylkko wrote:I believe all Debian installs use resolvconf to overwrite resolv.conf.
Only if one uses DHCP (which most folks do, because it is so damn handy).
pylkko wrote:I've seen people suggest preventing that from happening, but it has always sounded like a dirty hack and that it would be better to edit configure the files/programs that are overwriting it to do it as wanted.
Exactly. The permissions hack seems to work great, right up until it doesn't. It doesn't solve the problem as much as it just relocates it.

(Same is true of virtually every permissions hack, in my experience. It's hard to think of even one that isn't a total kludge.)
pylkko wrote:Maybe if some one really wanted to use resolv.conf manually, then they should uninstall all the other packages and create a custom install.
Or even more simply: just don't use DHCP. Altering resolv.conf on every boot is exactly how DHCP works.

User avatar
infestor
Posts: 175
Joined: 2012-02-07 22:18

Re: resolv.conf being overwritten at every boot

#10 Post by infestor »

i do want to use DHCP for getting an IP address but i would like my DNS servers (my ISP blocks a looot of websites) stay as i set them.
---------------

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: resolv.conf being overwritten at every boot

#11 Post by dasein »

infestor wrote:i do want to use DHCP for getting an IP address but i would like my DNS servers (my ISP blocks a looot of websites) stay as i set them.
Understood.

I'm not clear why you're repeating your use-case. The pertinent doc--the one I already gave you a link to--explains in considerable detail how to use DHCP correctly to achieve that precise goal.

Post Reply