Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-30 Thread Kerin Millar

On 28/07/2014 16:34, Grand Duet wrote:

2014-07-28 1:00 GMT+03:00 Kerin Millar kerfra...@fastmail.co.uk:

On 27/07/2014 21:38, Grand Duet wrote:


2014-07-27 22:13 GMT+03:00 Neil Bothwick n...@digimed.co.uk:


On Sun, 27 Jul 2014 13:33:47 +0300, Grand Duet wrote:


That's what replaces it when eth0 comes up.
It looks like eth0 is not being brought up fully



It sounds logical. But how can I fix it?



By identifying how far it is getting and why no further.
But it appears that eth0 is being brought up correctly
and then the config is overwritten by the lo config.



I think so.

As I have already reported in another reply to this thread,
it is my first reboot after commenting out the line
   dns_domain_lo=mynetwork
and so far it went good.

Moreover, the file /etc/resolv.conf has not been overwritten.

I still have to check if everything else works fine and
if I will get the same result on the next reboot
but I hope that the problem has been solved.

But it looks like a bug in the net csript.
Why lo configuration should overwrite eth0 configuration at all?



I would consider it be a documentation bug at the very least. Being able to
propagate different settings to resolv.conf depending on whether a given
interface is up may be of value for some esoteric use-case, although I
cannot think of one off-hand. Some other distros use the resolvconf
application to handle these nuances.

In any case, it is inexplicable that the user is invited to define
dns_domain for the lo interface. Why would one want to push settings to
resolv.conf based on the mere fact that the loopback interface has come up?
Also, it would be a great deal less confusing if the option were named
dns_search.

I think that the handbook should refrain from mentioning the option at all,
for the reasons stated in my previous email. Those who know that they need
to define a specific search domain will know why and be capable of figuring
it out.

It's too bad that the handbook is still peddling the notion that this
somehow has something to do with 'setting' the domain name. It is tosh of
the highest order.


I agree with you. But how to put it all in the right ears?



I'm not entirely sure. I'd give it another shot if I thought it was 
worth the effort. My experience up until now is that requests for minor 
documentation changes are dismissed on the basis that, if it does not 
prevent the installation from being concluded, it's not worth bothering 
with [1]. I do not rate the handbook and, at this juncture, my concern 
is slight except for where it causes demonstrable confusion among the 
user community. Indeed, that's why my interest was piqued by this thread.


--Kerin

[1] For example: bugs 304727 and 344753



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-28 Thread Grand Duet
2014-07-28 1:00 GMT+03:00 Kerin Millar kerfra...@fastmail.co.uk:
 On 27/07/2014 21:38, Grand Duet wrote:

 2014-07-27 22:13 GMT+03:00 Neil Bothwick n...@digimed.co.uk:

 On Sun, 27 Jul 2014 13:33:47 +0300, Grand Duet wrote:

 That's what replaces it when eth0 comes up.
 It looks like eth0 is not being brought up fully


 It sounds logical. But how can I fix it?


 By identifying how far it is getting and why no further.
 But it appears that eth0 is being brought up correctly
 and then the config is overwritten by the lo config.


 I think so.

 As I have already reported in another reply to this thread,
 it is my first reboot after commenting out the line
   dns_domain_lo=mynetwork
 and so far it went good.

 Moreover, the file /etc/resolv.conf has not been overwritten.

 I still have to check if everything else works fine and
 if I will get the same result on the next reboot
 but I hope that the problem has been solved.

 But it looks like a bug in the net csript.
 Why lo configuration should overwrite eth0 configuration at all?


 I would consider it be a documentation bug at the very least. Being able to
 propagate different settings to resolv.conf depending on whether a given
 interface is up may be of value for some esoteric use-case, although I
 cannot think of one off-hand. Some other distros use the resolvconf
 application to handle these nuances.

 In any case, it is inexplicable that the user is invited to define
 dns_domain for the lo interface. Why would one want to push settings to
 resolv.conf based on the mere fact that the loopback interface has come up?
 Also, it would be a great deal less confusing if the option were named
 dns_search.

 I think that the handbook should refrain from mentioning the option at all,
 for the reasons stated in my previous email. Those who know that they need
 to define a specific search domain will know why and be capable of figuring
 it out.

 It's too bad that the handbook is still peddling the notion that this
 somehow has something to do with 'setting' the domain name. It is tosh of
 the highest order.

I agree with you. But how to put it all in the right ears?



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Neil Bothwick
On Sun, 27 Jul 2014 12:21:23 +0300, Grand Duet wrote:

 In short: the contents of the file /etc/resolv.conf
 is unpredictably different from one reboot to another.
 It is either
   # Generated by net-scripts for interface lo
   domain mynetwork

That's what you get when lo comes up.

 or
   # Generated by net-scripts for interface eth0
   nameserver My.First.DNS-Server.IP
   nameserver My.Second.DNS-Server.IP
   nameserver 8.8.8.8

That's what replaces it when eth0 comes up. It looks like eth0 is not
being brought up fully, what do your logs say?

It might be worth putting logger commands in preup(), postup() and
failup() in conf.d/net.

 I tried to chmod this file to be unwrittable even for root
 but after a reboot it have been overwritten anyway.

You can't stop root overwriting a file, root laughs in the face of file
permissions.

BTW, I'm not sure if it's still relevant, but I don't think you ever
posted the contents of /etc/resolvconf.conf, if it exists.


-- 
Neil Bothwick

If at first you don't succeed, call in an airstrike.


signature.asc
Description: PGP signature


Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Grand Duet
2014-07-27 12:29 GMT+03:00 Neil Bothwick n...@digimed.co.uk:
 On Sun, 27 Jul 2014 12:21:23 +0300, Grand Duet wrote:

 In short: the contents of the file /etc/resolv.conf
 is unpredictably different from one reboot to another.
 It is either
   # Generated by net-scripts for interface lo
   domain mynetwork

 That's what you get when lo comes up.

 or
   # Generated by net-scripts for interface eth0
   nameserver My.First.DNS-Server.IP
   nameserver My.Second.DNS-Server.IP
   nameserver 8.8.8.8

 That's what replaces it when eth0 comes up.
 It looks like eth0 is not being brought up fully

It sounds logical. But how can I fix it?

Can carrier_timeout_eth0= setting in /etc/conf.d/net file help?
If so, how much seconds should I use?

 what do your logs say?

Could you, please, be more precise where to look for logs.

 It might be worth putting logger commands in preup(),
 postup() and failup() in conf.d/net.

Currently, I have no such functions in my /etc/conf.d/net file.
Shall I copy them there from
  /usr/share/doc/netifrc-0.2.2/net.example

Could you, please, be more specific on these logger commands too.

 I tried to chmod this file to be unwrittable even for root
 but after a reboot it have been overwritten anyway.

 You can't stop root overwriting a file, root laughs in the face of file
 permissions.

 BTW, I'm not sure if it's still relevant, but I don't think you ever
 posted the contents of /etc/resolvconf.conf, if it exists.

I do not have such file. Of course, if you do not mean /etc/resolv.conf
But I have posted its content above.



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Walter Dnes
On Sun, Jul 27, 2014 at 12:21:23PM +0300, Grand Duet wrote
 This is a continuation of the thread:
 Something went wrong with DNS, plz help!
 
 Now, the issue became clearer, so I decided to start
 a new thread with more descriptive Subject.
 
 In short: the contents of the file /etc/resolv.conf
 is unpredictably different from one reboot to another.
 It is either
   # Generated by net-scripts for interface lo
   domain mynetwork
 or
   # Generated by net-scripts for interface eth0
   nameserver My.First.DNS-Server.IP
   nameserver My.Second.DNS-Server.IP
   nameserver 8.8.8.8
 
 I tried to chmod this file to be unwrittable even for root
 but after a reboot it have been overwritten anyway.
 
 

  A similar problem was noted at...
https://forums.gentoo.org/viewtopic-t-816332-start-0.html

  Can you post the contents of your /etc/conf.d/net and also
the output of the rc-update show command?  That should help narrow
down the potential sources of your problem.

-- 
Walter Dnes waltd...@waltdnes.org
I don't run desktop environments; I run useful applications



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Dale
Grand Duet wrote:
 2014-07-27 12:29 GMT+03:00 Neil Bothwick n...@digimed.co.uk:
 It sounds logical. But how can I fix it? Can carrier_timeout_eth0=
 setting in /etc/conf.d/net file help? If so, how much seconds should I
 use?
 what do your logs say?
 Could you, please, be more precise where to look for logs.

Could be /var/log/messages or dmesg.  I'd check both.

Dale

:-)  :-) 



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Grand Duet
2014-07-27 13:39 GMT+03:00 Walter Dnes waltd...@waltdnes.org:
 On Sun, Jul 27, 2014 at 12:21:23PM +0300, Grand Duet wrote
 This is a continuation of the thread:
 Something went wrong with DNS, plz help!

 Now, the issue became clearer, so I decided to start
 a new thread with more descriptive Subject.

 In short: the contents of the file /etc/resolv.conf
 is unpredictably different from one reboot to another.
 It is either
   # Generated by net-scripts for interface lo
   domain mynetwork
 or
   # Generated by net-scripts for interface eth0
   nameserver My.First.DNS-Server.IP
   nameserver My.Second.DNS-Server.IP
   nameserver 8.8.8.8

 I tried to chmod this file to be unwrittable even for root
 but after a reboot it have been overwritten anyway.

 A similar problem was noted at...
 https://forums.gentoo.org/viewtopic-t-816332-start-0.html

Like in the thread above, I also have a line
dns_domain_lo=mynetwork
in my /etc/conf.d/net file. It says nothing to me
and I do not remember how it got there.

But somewhere on Gentoo forum I have found the following
explanation: If you only specify dns_domain_lo=foo and
restart the lo interface it will put domain foo in /etc/resolv.conf
and remove everything else.

So, I guess I should try to remove that line from my /etc/conf.d/net file.

But why the system worked fine for about a year *with* this line then?

   Can you post the contents of your /etc/conf.d/net

hostname=myhostname
dns_domain_lo=mynetwork

config_eth0=My.Local.IP netmask My.Net.Mask broadcast
Broadcast.IPof.My.LocalNetwork
routes_eth0=default via Local.IPof.My.Gateway

dns_servers_eth0=My.First.DNS.IP My.Second.DNS.IP 8.8.8.8

mtu_eth0=1500 # if needed

# The network scripts are now part of net-misc/netifrc
# In order to avoid sys-apps/openrc-0.12.4 from removing this file,
this comment was
# added; you can safely remove this comment.  Please see
# /usr/share/doc/netifrc*/README* for more information.

 and also the output of the rc-update show command?

# rc-update show
 alsasound | boot
   bootmisc | boot
  dbus |  default
 devfs |   sysinit
   dmesg |   sysinit
   fsck | boot
  hostname | boot
 hwclock | boot
keymaps | boot
 killprocs |  shutdown
kmod-static-nodes |   sysinit
   local |  default
localmount | boot
   loopback | boot
metalog |  default
   modules | boot
  mount-ro |  shutdown
 mtab | boot
   net.eth0 |  default
net.lo | boot
 netmount |  default
 privoxy |  default
   procfs | boot
   root | boot
 savecache |  shutdown
  swap | boot
   swapfiles | boot
 sysctl | boot
  sysfs |   sysinit
  termencoding | boot
 tmpfiles.dev |   sysinit
  tmpfiles.setup | boot
  udev |   sysinit
  udev-mount |   sysinit
  urandom | boot

Everywhere above eth0 has been put instead of its udev predictable name.

Do you think that I need
carrier_timeout_eth0=20
somewhere in /etc/conf.d/net ?

Thank you.

 That should help narrow down the potential sources of your problem.



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Matti Nykyri
 On Jul 27, 2014, at 13:33, Grand Duet grand.d...@gmail.com wrote:
 
 2014-07-27 12:29 GMT+03:00 Neil Bothwick n...@digimed.co.uk:
 On Sun, 27 Jul 2014 12:21:23 +0300, Grand Duet wrote:
 
 In short: the contents of the file /etc/resolv.conf
 is unpredictably different from one reboot to another.
 It is either
  # Generated by net-scripts for interface lo
  domain mynetwork
 
 That's what you get when lo comes up.
 
 or
  # Generated by net-scripts for interface eth0
  nameserver My.First.DNS-Server.IP
  nameserver My.Second.DNS-Server.IP
  nameserver 8.8.8.8
 
 That's what replaces it when eth0 comes up.
 It looks like eth0 is not being brought up fully
 
 It sounds logical. But how can I fix it?
 
 Can carrier_timeout_eth0= setting in /etc/conf.d/net file help?
 If so, how much seconds should I use?
 
 what do your logs say?
 
 Could you, please, be more precise where to look for logs.
 
 It might be worth putting logger commands in preup(),
 postup() and failup() in conf.d/net.
 
 Currently, I have no such functions in my /etc/conf.d/net file.
 Shall I copy them there from
  /usr/share/doc/netifrc-0.2.2/net.example
 
 Could you, please, be more specific on these logger commands too.
 
 I tried to chmod this file to be unwrittable even for root
 but after a reboot it have been overwritten anyway.
 
 You can't stop root overwriting a file, root laughs in the face of file
 permissions.
 
 BTW, I'm not sure if it's still relevant, but I don't think you ever
 posted the contents of /etc/resolvconf.conf, if it exists.
 
 I do not have such file. Of course, if you do not mean /etc/resolv.conf
 But I have posted its content above.
 

Depending on your filesystem a temporary solution to your problem is to setup 
/etc/resolv.conf correctly and then:
chattr +i /etc/resolv.conf

After that the content of the file will not change.

-- 
-Matti


Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Grand Duet
2014-07-27 16:10 GMT+03:00 Matti Nykyri matti.nyk...@iki.fi:
 On Jul 27, 2014, at 13:33, Grand Duet grand.d...@gmail.com wrote:

 2014-07-27 12:29 GMT+03:00 Neil Bothwick n...@digimed.co.uk:
 On Sun, 27 Jul 2014 12:21:23 +0300, Grand Duet wrote:

 In short: the contents of the file /etc/resolv.conf
 is unpredictably different from one reboot to another.
 It is either
  # Generated by net-scripts for interface lo
  domain mynetwork

 That's what you get when lo comes up.

 or
  # Generated by net-scripts for interface eth0
  nameserver My.First.DNS-Server.IP
  nameserver My.Second.DNS-Server.IP
  nameserver 8.8.8.8

 That's what replaces it when eth0 comes up.
 It looks like eth0 is not being brought up fully

 It sounds logical. But how can I fix it?

 Can carrier_timeout_eth0= setting in /etc/conf.d/net file help?
 If so, how much seconds should I use?

 what do your logs say?

 Could you, please, be more precise where to look for logs.

 It might be worth putting logger commands in preup(),
 postup() and failup() in conf.d/net.

 Currently, I have no such functions in my /etc/conf.d/net file.
 Shall I copy them there from
  /usr/share/doc/netifrc-0.2.2/net.example

 Could you, please, be more specific on these logger commands too.

 I tried to chmod this file to be unwrittable even for root
 but after a reboot it have been overwritten anyway.

 You can't stop root overwriting a file, root laughs in the face of file
 permissions.

 BTW, I'm not sure if it's still relevant, but I don't think you ever
 posted the contents of /etc/resolvconf.conf, if it exists.

 I do not have such file. Of course, if you do not mean /etc/resolv.conf
 But I have posted its content above.


 Depending on your filesystem a temporary solution to your problem is to setup 
 /etc/resolv.conf correctly and then:
 chattr +i /etc/resolv.conf

 After that the content of the file will not change.

Thank you. I will try it if deleting the line
dns_domain_lo=mynetwork
from my /etc/conf.d/net file will not work.

But does chattr +i differ from chmod a-w ?
(The latter did not work for me. I use ext4 file system.)



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Daniel Frey
On 07/27/2014 04:30 AM, Grand Duet wrote:
 
 and also the output of the rc-update show command?
 
 # rc-update show
  alsasound | boot
bootmisc | boot
   dbus |  default
  devfs |   sysinit
dmesg |   sysinit
fsck | boot
   hostname | boot
  hwclock | boot
 keymaps | boot
  killprocs |  shutdown
 kmod-static-nodes |   sysinit
local |  default
 localmount | boot
loopback | boot
 metalog |  default
modules | boot
   mount-ro |  shutdown
  mtab | boot
net.eth0 |  default
 net.lo | boot
  netmount |  default
  privoxy |  default
procfs | boot
root | boot
  savecache |  shutdown
   swap | boot
swapfiles | boot
  sysctl | boot
   sysfs |   sysinit
   termencoding | boot
  tmpfiles.dev |   sysinit
   tmpfiles.setup | boot
   udev |   sysinit
   udev-mount |   sysinit
   urandom | boot
 
 Everywhere above eth0 has been put instead of its udev predictable name.
 
 Do you think that I need
 carrier_timeout_eth0=20
 somewhere in /etc/conf.d/net ?
 

Have you tried disabling network hotplugging in /etc/rc.conf?

i.e. setting rc_hotplug=!net.*

Sounds like the interfaces are being brought up out of order.

Dan



Re: [gentoo-user] resolv.conf is different after every reboot (Got an idea!)

2014-07-27 Thread Grand Duet
2014-07-27 14:30 GMT+03:00 Grand Duet grand.d...@gmail.com:
 2014-07-27 13:39 GMT+03:00 Walter Dnes waltd...@waltdnes.org:
 On Sun, Jul 27, 2014 at 12:21:23PM +0300, Grand Duet wrote
 This is a continuation of the thread:
 Something went wrong with DNS, plz help!

 Now, the issue became clearer, so I decided to start
 a new thread with more descriptive Subject.

 In short: the contents of the file /etc/resolv.conf
 is unpredictably different from one reboot to another.
 It is either
   # Generated by net-scripts for interface lo
   domain mynetwork
 or
   # Generated by net-scripts for interface eth0
   nameserver My.First.DNS-Server.IP
   nameserver My.Second.DNS-Server.IP
   nameserver 8.8.8.8

 I tried to chmod this file to be unwrittable even for root
 but after a reboot it have been overwritten anyway.

 A similar problem was noted at...
 https://forums.gentoo.org/viewtopic-t-816332-start-0.html

 Like in the thread above, I also have a line
 dns_domain_lo=mynetwork
 in my /etc/conf.d/net file. It says nothing to me
 and I do not remember how it got there.

 But somewhere on Gentoo forum I have found the following
 explanation: If you only specify dns_domain_lo=foo and
 restart the lo interface it will put domain foo in /etc/resolv.conf
 and remove everything else.

 So, I guess I should try to remove that line from my /etc/conf.d/net file.

 But why the system worked fine for about a year *with* this line then?

Well, after finishing my main job, I finally got an idea
why everything went wrong after the last system update.

During my last system update, portage instructed me to add
dev-lang/tk-8.5.15 threads
line to my /etc/portage/package.use file.

Here is the portage message about it:

The following USE changes are necessary to proceed:
 (see package.use in the portage(5) man page for more details)
# required by dev-lang/ruby-1.9.3_p484[tk]
# required by dev-ruby/rake-0.9.6[ruby_targets_ruby19]
# required by dev-lang/ruby-2.0.0_p353
# required by dev-ruby/racc-1.4.9[ruby_targets_ruby20]
# required by dev-ruby/rdoc-4.0.1-r1[ruby_targets_ruby19]
=dev-lang/tk-8.5.15 threads

And in my /etc/portage/package.use file this line has already
been commented. So, I just uncommented it. But I do remember
that it was commented for a reason, though do not remember
exactly why.

May be uncommenting that line allowed bringing up
lo and eth0 interfaces *in parallel*. If it is the case,
then I have an easy explanation why the contents
of /etc/resolv.conf file after boot is unpredictable.

If eth0 starts after lo, then I have the right /etc/resolv.conf
file, however if lo starts after eth0, then the DNS IPs in
resolv.conf file are overwritten with dummy instruction
for lo interface.

What do you think?

   Can you post the contents of your /etc/conf.d/net

 hostname=myhostname
 dns_domain_lo=mynetwork

 config_eth0=My.Local.IP netmask My.Net.Mask broadcast
 Broadcast.IPof.My.LocalNetwork
 routes_eth0=default via Local.IPof.My.Gateway

 dns_servers_eth0=My.First.DNS.IP My.Second.DNS.IP 8.8.8.8

 mtu_eth0=1500 # if needed

 # The network scripts are now part of net-misc/netifrc
 # In order to avoid sys-apps/openrc-0.12.4 from removing this file,
 this comment was
 # added; you can safely remove this comment.  Please see
 # /usr/share/doc/netifrc*/README* for more information.

 and also the output of the rc-update show command?

 # rc-update show
  alsasound | boot
bootmisc | boot
   dbus |  default
  devfs |   sysinit
dmesg |   sysinit
fsck | boot
   hostname | boot
  hwclock | boot
 keymaps | boot
  killprocs |  shutdown
 kmod-static-nodes |   sysinit
local |  default
 localmount | boot
loopback | boot
 metalog |  default
modules | boot
   mount-ro |  shutdown
  mtab | boot
net.eth0 |  default
 net.lo | boot
  netmount |  default
  privoxy |  default
procfs | boot
root | boot
  savecache |  shutdown
   swap | boot
swapfiles | boot
  sysctl | boot
   sysfs |   sysinit
   termencoding | boot
  tmpfiles.dev |   sysinit
   tmpfiles.setup | boot
   udev |   sysinit
   udev-mount |   sysinit
   urandom | boot

 Everywhere above eth0 has been put instead of its udev predictable name.

 Do you think that I need
 carrier_timeout_eth0=20
 somewhere in /etc/conf.d/net ?

 Thank you.

 

Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Grand Duet
2014-07-27 17:50 GMT+03:00 Daniel Frey djqf...@gmail.com:
 On 07/27/2014 04:30 AM, Grand Duet wrote:

 and also the output of the rc-update show command?

 # rc-update show
  alsasound | boot
bootmisc | boot
   dbus |  default
  devfs |   sysinit
dmesg |   sysinit
fsck | boot
   hostname | boot
  hwclock | boot
 keymaps | boot
  killprocs |  shutdown
 kmod-static-nodes |   sysinit
local |  default
 localmount | boot
loopback | boot
 metalog |  default
modules | boot
   mount-ro |  shutdown
  mtab | boot
net.eth0 |  default
 net.lo | boot
  netmount |  default
  privoxy |  default
procfs | boot
root | boot
  savecache |  shutdown
   swap | boot
swapfiles | boot
  sysctl | boot
   sysfs |   sysinit
   termencoding | boot
  tmpfiles.dev |   sysinit
   tmpfiles.setup | boot
   udev |   sysinit
   udev-mount |   sysinit
   urandom | boot

 Everywhere above eth0 has been put instead of its udev predictable name.

 Do you think that I need
 carrier_timeout_eth0=20
 somewhere in /etc/conf.d/net ?


 Have you tried disabling network hotplugging in /etc/rc.conf?
 i.e. setting rc_hotplug=!net.*

No, I have rc_hotplug=* in my /etc/rc.conf file.

I will try it, thank you for the tip.

 Sounds like the interfaces are being brought up out of order.

Yes, I have just written about it the following:

I finally got an idea why everything went wrong after
the last system update.

During my last system update, portage instructed me to add
dev-lang/tk-8.5.15 threads
line to my /etc/portage/package.use file.

Here is the portage message about it:

The following USE changes are necessary to proceed:
 (see package.use in the portage(5) man page for more details)
# required by dev-lang/ruby-1.9.3_p484[tk]
# required by dev-ruby/rake-0.9.6[ruby_targets_ruby19]
# required by dev-lang/ruby-2.0.0_p353
# required by dev-ruby/racc-1.4.9[ruby_targets_ruby20]
# required by dev-ruby/rdoc-4.0.1-r1[ruby_targets_ruby19]
=dev-lang/tk-8.5.15 threads

And in my /etc/portage/package.use file this line has already
been commented. So, I just uncommented it. But I do remember
that it was commented for a reason, though do not remember
exactly why.

May be uncommenting that line allowed bringing up
lo and eth0 interfaces *in parallel*. If it is the case,
then I have an easy explanation why the contents
of /etc/resolv.conf file after boot is unpredictable.

If eth0 starts after lo, then I have the right /etc/resolv.conf
file, however if lo starts after eth0, then the DNS IPs in
resolv.conf file are overwritten with dummy instruction
for lo interface.

But, now, after your suggestion, I have looked into
my /etc/rc.conf file, and have found there the option
rc_parallel=NO
which softens my previous arguments a bit, but not completely:
may be lo and eth0 are brought up not in parallel but in different
order, anyway.



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Matti Nykyri
 On Jul 27, 2014, at 16:39, Grand Duet grand.d...@gmail.com wrote:
 
 2014-07-27 16:10 GMT+03:00 Matti Nykyri matti.nyk...@iki.fi:
 On Jul 27, 2014, at 13:33, Grand Duet grand.d...@gmail.com wrote:
 
 2014-07-27 12:29 GMT+03:00 Neil Bothwick n...@digimed.co.uk:
 On Sun, 27 Jul 2014 12:21:23 +0300, Grand Duet wrote:
 
 In short: the contents of the file /etc/resolv.conf
 is unpredictably different from one reboot to another.
 It is either
 # Generated by net-scripts for interface lo
 domain mynetwork
 
 That's what you get when lo comes up.
 
 or
 # Generated by net-scripts for interface eth0
 nameserver My.First.DNS-Server.IP
 nameserver My.Second.DNS-Server.IP
 nameserver 8.8.8.8
 
 That's what replaces it when eth0 comes up.
 It looks like eth0 is not being brought up fully
 
 It sounds logical. But how can I fix it?
 
 Can carrier_timeout_eth0= setting in /etc/conf.d/net file help?
 If so, how much seconds should I use?
 
 what do your logs say?
 
 Could you, please, be more precise where to look for logs.
 
 It might be worth putting logger commands in preup(),
 postup() and failup() in conf.d/net.
 
 Currently, I have no such functions in my /etc/conf.d/net file.
 Shall I copy them there from
 /usr/share/doc/netifrc-0.2.2/net.example
 
 Could you, please, be more specific on these logger commands too.
 
 I tried to chmod this file to be unwrittable even for root
 but after a reboot it have been overwritten anyway.
 
 You can't stop root overwriting a file, root laughs in the face of file
 permissions.
 
 BTW, I'm not sure if it's still relevant, but I don't think you ever
 posted the contents of /etc/resolvconf.conf, if it exists.
 
 I do not have such file. Of course, if you do not mean /etc/resolv.conf
 But I have posted its content above.
 
 Depending on your filesystem a temporary solution to your problem is to 
 setup /etc/resolv.conf correctly and then:
 chattr +i /etc/resolv.conf
 
 After that the content of the file will not change.
 
 Thank you. I will try it if deleting the line
dns_domain_lo=mynetwork
 from my /etc/conf.d/net file will not work.
 
 But does chattr +i differ from chmod a-w ?
 (The latter did not work for me. I use ext4 file system.)

Yes it does. Ext-filesystem supports immutable bit which is enforced by kernel 
so even root can't modify the file in any way. -i unsets the bit.

-- 
-Matti


Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Kerin Millar

On 27/07/2014 12:30, Grand Duet wrote:

2014-07-27 13:39 GMT+03:00 Walter Dnes waltd...@waltdnes.org:

On Sun, Jul 27, 2014 at 12:21:23PM +0300, Grand Duet wrote

This is a continuation of the thread:
Something went wrong with DNS, plz help!

Now, the issue became clearer, so I decided to start
a new thread with more descriptive Subject.

In short: the contents of the file /etc/resolv.conf
is unpredictably different from one reboot to another.
It is either
   # Generated by net-scripts for interface lo
   domain mynetwork
or
   # Generated by net-scripts for interface eth0
   nameserver My.First.DNS-Server.IP
   nameserver My.Second.DNS-Server.IP
   nameserver 8.8.8.8

I tried to chmod this file to be unwrittable even for root
but after a reboot it have been overwritten anyway.


A similar problem was noted at...
https://forums.gentoo.org/viewtopic-t-816332-start-0.html


Like in the thread above, I also have a line
 dns_domain_lo=mynetwork
in my /etc/conf.d/net file. It says nothing to me
and I do not remember how it got there.

But somewhere on Gentoo forum I have found the following
explanation: If you only specify dns_domain_lo=foo and
restart the lo interface it will put domain foo in /etc/resolv.conf
and remove everything else.


You can specify dns_domain - without an interface suffix - which ought 
to prevent this behaviour. However, you'd be better off getting rid of 
it altogether. All the option does is define the suffix(es) that are 
appended by the resolver under certain conditions. These conditions are 
as follows:


  a) the initial name isn't qualified (contains no dots) [1]
  b) the initial name could not be resolved (NXDOMAIN response)

Making up fake domains for this setting, as many Gentoo users are 
induced into doing, serves no purpose. Let's assume that I have 
fakedomain as a search domain in resolv.conf.


Let's see what happens for a short name:

  $ host -t A -v shorthost | grep -e Trying -e NX
  Trying shorthost.fakedomain
  Trying shorthost
  Host shorthost not found: 3(NXDOMAIN)

Result: two spurious DNS lookups, each resulting in NXDOMAIN. You may 
use tcpdump to confirm that there are indeed two.


Now, let's try looking up a fully qualified hostname that happens not to 
exist:


  $ host -t A -v nonexistent.google.com | grep -e Trying -e NX
  Trying nonexistent.google.com
  Trying nonexistent.google.com.fakedomain
  Host nonexistent.google.com not found: 3(NXDOMAIN)

Result: The first lookup fails and is immediately followed by an another 
lookup that is completely and utterly useless. Had a search domain _not_ 
been defined, then the resolver could have concluded its efforts after 
the first NXDOMAIN response.


The bottom line is that it only makes sense to define search domain(s) 
if the following two conditions hold true.


  1) You want to be able to resolve hostnames in their short form
  2) Records for said names will exist in a known, *valid* domain

Otherwise, don't bother and leave it to the DHCP server to decide [2]. 
While I haven't looked at the handbook lately, it has had a history of 
prescribing dns/domain related options without adequate explanation and, 
in some cases, with outright misleading information [3].


On a related note, some people prefer to manage resolv.conf themselves 
and it is not initially obvious as to how to do this while also using 
DHCP. Trying to make the file immutable is not a proper approach. The 
trick is as follows:


  * Specify dhcpd_eth0=nodns (do this for any dhcp-using interfaces)
  * Do not specify any dns or nameserver related settings in conf.d/net

The netifrc scripts will then leave resolv.conf alone.

--Kerin

[1] Check out the ndots option in the resolv.conf(5) manpage
[2] DHCP servers may specify a search domain for clients with option 15
[3] https://bugs.gentoo.org/show_bug.cgi?id=341349



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Neil Bothwick
On Sun, 27 Jul 2014 13:33:47 +0300, Grand Duet wrote:

  That's what replaces it when eth0 comes up.
  It looks like eth0 is not being brought up fully  
 
 It sounds logical. But how can I fix it?

By identifying how far it is getting and why no further. But it appears
that eth0 is being brought up correctly and then the config is
overwritten by the lo config. I'd suggest going with the suggestion of
disabling hotplugging for net.* interfaces.
 
  what do your logs say?  
 
 Could you, please, be more precise where to look for logs.

/var/log/messages, dmesg, the standard places.

  It might be worth putting logger commands in preup(),
  postup() and failup() in conf.d/net.  
 
 Currently, I have no such functions in my /etc/conf.d/net file.
 Shall I copy them there from
   /usr/share/doc/netifrc-0.2.2/net.example

Yes, they are run are various stages of bringing up the interface.

 Could you, please, be more specific on these logger commands too.

I meant to add a logger call to each function to see how far it gets

logger eth0 going up
logger eth0 up
logger eth0 failed

or something like that. but it appears this is moot and eth0 is up
successfully. 

  BTW, I'm not sure if it's still relevant, but I don't think you ever
  posted the contents of /etc/resolvconf.conf, if it exists.  
 
 I do not have such file. Of course, if you do not mean /etc/resolv.conf
 But I have posted its content above.

I meant /etc/resolvconf.conf, which you were asked for before, but as
you don't have it, the problem isn't there. 


-- 
Neil Bothwick

Vital papers will demonstrate their vitality by moving to where you
can't find them.


signature.asc
Description: PGP signature


Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Grand Duet
2014-07-27 21:14 GMT+03:00 Kerin Millar kerfra...@fastmail.co.uk:
 On 27/07/2014 12:30, Grand Duet wrote:

 2014-07-27 13:39 GMT+03:00 Walter Dnes waltd...@waltdnes.org:

 On Sun, Jul 27, 2014 at 12:21:23PM +0300, Grand Duet wrote

 This is a continuation of the thread:
 Something went wrong with DNS, plz help!

 Now, the issue became clearer, so I decided to start
 a new thread with more descriptive Subject.

 In short: the contents of the file /etc/resolv.conf
 is unpredictably different from one reboot to another.
 It is either
# Generated by net-scripts for interface lo
domain mynetwork
 or
# Generated by net-scripts for interface eth0
nameserver My.First.DNS-Server.IP
nameserver My.Second.DNS-Server.IP
nameserver 8.8.8.8

 I tried to chmod this file to be unwrittable even for root
 but after a reboot it have been overwritten anyway.

 A similar problem was noted at...
 https://forums.gentoo.org/viewtopic-t-816332-start-0.html


 Like in the thread above, I also have a line
  dns_domain_lo=mynetwork
 in my /etc/conf.d/net file. It says nothing to me
 and I do not remember how it got there.

 But somewhere on Gentoo forum I have found the following
 explanation: If you only specify dns_domain_lo=foo and
 restart the lo interface it will put domain foo in /etc/resolv.conf
 and remove everything else.


 You can specify dns_domain - without an interface suffix - which ought to
 prevent this behaviour. However, you'd be better off getting rid of it
 altogether.

It is my first reboot after commenting out the line
 dns_domain_lo=mynetwork
and so far it went good.

Moreover, the file /etc/resolv.conf has not been overwritten.

I still have to check if everything else works fine and
if I will get the same result on the next reboot
but I hope that the problem has been solved.

 All the option does is define the suffix(es) that are appended
 by the resolver under certain conditions. These conditions are as follows:

   a) the initial name isn't qualified (contains no dots) [1]
   b) the initial name could not be resolved (NXDOMAIN response)

 Making up fake domains for this setting, as many Gentoo users are induced
 into doing, serves no purpose. Let's assume that I have fakedomain as a
 search domain in resolv.conf.

 Let's see what happens for a short name:

   $ host -t A -v shorthost | grep -e Trying -e NX
   Trying shorthost.fakedomain
   Trying shorthost
   Host shorthost not found: 3(NXDOMAIN)

 Result: two spurious DNS lookups, each resulting in NXDOMAIN. You may use
 tcpdump to confirm that there are indeed two.

 Now, let's try looking up a fully qualified hostname that happens not to
 exist:

   $ host -t A -v nonexistent.google.com | grep -e Trying -e NX
   Trying nonexistent.google.com
   Trying nonexistent.google.com.fakedomain
   Host nonexistent.google.com not found: 3(NXDOMAIN)

 Result: The first lookup fails and is immediately followed by an another
 lookup that is completely and utterly useless. Had a search domain _not_
 been defined, then the resolver could have concluded its efforts after the
 first NXDOMAIN response.

 The bottom line is that it only makes sense to define search domain(s) if
 the following two conditions hold true.

   1) You want to be able to resolve hostnames in their short form
   2) Records for said names will exist in a known, *valid* domain

 Otherwise, don't bother and leave it to the DHCP server to decide [2]. While
 I haven't looked at the handbook lately, it has had a history of prescribing
 dns/domain related options without adequate explanation and, in some cases,
 with outright misleading information [3].

 On a related note, some people prefer to manage resolv.conf themselves and
 it is not initially obvious as to how to do this while also using DHCP.
 Trying to make the file immutable is not a proper approach. The trick is as
 follows:

   * Specify dhcpd_eth0=nodns (do this for any dhcp-using interfaces)
   * Do not specify any dns or nameserver related settings in conf.d/net

 The netifrc scripts will then leave resolv.conf alone.

Thank you for the nice explanation that convinced me that I do
not need that feature at all.

I do not use DHCP at all but I got the general point.

 [1] Check out the ndots option in the resolv.conf(5) manpage
 [2] DHCP servers may specify a search domain for clients with option 15
 [3] https://bugs.gentoo.org/show_bug.cgi?id=341349



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Daniel Frey
On 07/27/2014 08:08 AM, Grand Duet wrote:
 
 If eth0 starts after lo, then I have the right /etc/resolv.conf
 file, however if lo starts after eth0, then the DNS IPs in
 resolv.conf file are overwritten with dummy instruction
 for lo interface.
 
 But, now, after your suggestion, I have looked into
 my /etc/rc.conf file, and have found there the option
 rc_parallel=NO
 which softens my previous arguments a bit, but not completely:
 may be lo and eth0 are brought up not in parallel but in different
 order, anyway.
 

The first thing I do on any new build is disable network hotplugging in
/etc/rc.conf, as I've run into lots of problems, especially if you have
multiple network devices and need to bring them up in a specific order.
udev processes these items and apparently brings the interfaces up on
its own unless you tell it otherwise (the !net.* in rc.conf). I've just
gotten used to disabling that automagic because I want things to start
in a certain order and udev can mess that up.

During boot, you'll see something like 'processing events' and that's
when udev is automagically doing it's start. From what I recall, this
happens before the boot runlevel. So yes, it can mess things up as
you've seen.

I've never had the issue you have, even though I use a static ip, routes
and dns servers in /etc/conf.d/net, but I would presume that this is
just udev. FYI it doesn't always process things in the same order, as
I've experienced with udev and my TV tuner cards... it can be random.

Dan



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Grand Duet
2014-07-27 22:13 GMT+03:00 Neil Bothwick n...@digimed.co.uk:
 On Sun, 27 Jul 2014 13:33:47 +0300, Grand Duet wrote:

  That's what replaces it when eth0 comes up.
  It looks like eth0 is not being brought up fully

 It sounds logical. But how can I fix it?

 By identifying how far it is getting and why no further.
 But it appears that eth0 is being brought up correctly
 and then the config is overwritten by the lo config.

I think so.

As I have already reported in another reply to this thread,
it is my first reboot after commenting out the line
 dns_domain_lo=mynetwork
and so far it went good.

Moreover, the file /etc/resolv.conf has not been overwritten.

I still have to check if everything else works fine and
if I will get the same result on the next reboot
but I hope that the problem has been solved.

But it looks like a bug in the net csript.
Why lo configuration should overwrite eth0 configuration at all?

 I'd suggest going with the suggestion of disabling hotplugging for net.* 
 interfaces.

Thank you for the advice, I will try this if it appears that the
problem has not been solved yet.

  what do your logs say?

 Could you, please, be more precise where to look for logs.

 /var/log/messages, dmesg, the standard places.

  It might be worth putting logger commands in preup(),
  postup() and failup() in conf.d/net.

 Currently, I have no such functions in my /etc/conf.d/net file.
 Shall I copy them there from
   /usr/share/doc/netifrc-0.2.2/net.example

 Yes, they are run are various stages of bringing up the interface.

 Could you, please, be more specific on these logger commands too.

 I meant to add a logger call to each function to see how far it gets

 logger eth0 going up
 logger eth0 up
 logger eth0 failed

 or something like that. but it appears this is moot and eth0 is up
 successfully.

Thank you for this explanation as well. I will try it a bit later
but I feel that before doing it I should refresh my knowledge
of scripts in general.

  BTW, I'm not sure if it's still relevant, but I don't think you ever
  posted the contents of /etc/resolvconf.conf, if it exists.

 I do not have such file. Of course, if you do not mean /etc/resolv.conf
 But I have posted its content above.

 I meant /etc/resolvconf.conf, which you were asked for before, but as
 you don't have it, the problem isn't there.


 --
 Neil Bothwick

 Vital papers will demonstrate their vitality by moving to where you
 can't find them.



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Grand Duet
2014-07-27 23:28 GMT+03:00 Daniel Frey djqf...@gmail.com:
 On 07/27/2014 08:08 AM, Grand Duet wrote:

 If eth0 starts after lo, then I have the right /etc/resolv.conf
 file, however if lo starts after eth0, then the DNS IPs in
 resolv.conf file are overwritten with dummy instruction
 for lo interface.

 But, now, after your suggestion, I have looked into
 my /etc/rc.conf file, and have found there the option
 rc_parallel=NO
 which softens my previous arguments a bit, but not completely:
 may be lo and eth0 are brought up not in parallel but in different
 order, anyway.


 The first thing I do on any new build is disable network hotplugging in
 /etc/rc.conf, as I've run into lots of problems, especially if you have
 multiple network devices and need to bring them up in a specific order.
 udev processes these items and apparently brings the interfaces up on
 its own unless you tell it otherwise (the !net.* in rc.conf). I've just
 gotten used to disabling that automagic because I want things to start
 in a certain order and udev can mess that up.

Thank you. Now, I will be aware of this issue and disabling hotplugging
in this way will be the next thing I will try if the problem will not be solved
by just removing
   dns_domain_lo=mynetwork
from my /etc/conf.d/net file.

It is not because I am stubborn (though it may be :) but because I want
to do changes step by step to identify the cause of the problem.

P.S. As far as I know, I have only one network interface on this computer,
eth0, not counting lo, of course. :)

 During boot, you'll see something like 'processing events' and that's
 when udev is automagically doing it's start. From what I recall, this
 happens before the boot runlevel. So yes, it can mess things up as
 you've seen.

 I've never had the issue you have, even though I use a static ip, routes
 and dns servers in /etc/conf.d/net, but I would presume that this is
 just udev. FYI it doesn't always process things in the same order, as
 I've experienced with udev and my TV tuner cards... it can be random.

Thank you for your explanations once more.



Re: [gentoo-user] resolv.conf is different after every reboot

2014-07-27 Thread Kerin Millar

On 27/07/2014 21:38, Grand Duet wrote:

2014-07-27 22:13 GMT+03:00 Neil Bothwick n...@digimed.co.uk:

On Sun, 27 Jul 2014 13:33:47 +0300, Grand Duet wrote:


That's what replaces it when eth0 comes up.
It looks like eth0 is not being brought up fully


It sounds logical. But how can I fix it?


By identifying how far it is getting and why no further.
But it appears that eth0 is being brought up correctly
and then the config is overwritten by the lo config.


I think so.

As I have already reported in another reply to this thread,
it is my first reboot after commenting out the line
  dns_domain_lo=mynetwork
and so far it went good.

Moreover, the file /etc/resolv.conf has not been overwritten.

I still have to check if everything else works fine and
if I will get the same result on the next reboot
but I hope that the problem has been solved.

But it looks like a bug in the net csript.
Why lo configuration should overwrite eth0 configuration at all?


I would consider it be a documentation bug at the very least. Being able 
to propagate different settings to resolv.conf depending on whether a 
given interface is up may be of value for some esoteric use-case, 
although I cannot think of one off-hand. Some other distros use the 
resolvconf application to handle these nuances.


In any case, it is inexplicable that the user is invited to define 
dns_domain for the lo interface. Why would one want to push settings to 
resolv.conf based on the mere fact that the loopback interface has come 
up? Also, it would be a great deal less confusing if the option were 
named dns_search.


I think that the handbook should refrain from mentioning the option at 
all, for the reasons stated in my previous email. Those who know that 
they need to define a specific search domain will know why and be 
capable of figuring it out.


It's too bad that the handbook is still peddling the notion that this 
somehow has something to do with 'setting' the domain name. It is tosh 
of the highest order.


--Kerin