Jump to content

Photo

/etc/hosts is overwritten

- - - - - hosts

Best Answer sputnik , 29 March 2015 - 03:56 AM

Well that seems to be the magic.  Just cleaned out my hosts file, commented out all those aliases in /etc/conf.d/hostname, reboot, and perfect.  Indeed those warnings in the host were leftover from before, not there on this write.

Hopefully we'll get a new bug feature to keep us entertained soon.

Once again you've helped me so I didn't have to use my brain.  Thank you.

Go to the full post »


6 replies to this topic

#1
gnuisance

gnuisance

    Newbie

  • Members
  • Pip
  • 6 posts

I have been using /etc/hosts to map ip addresses to aliases for as long as I can remember; but lately I've noticed my file has been overwritten.  Also I noticed the following:

# Local Host Database
#
# This AUTOMATICALLY-GENERATED file describes a number of aliases-to-address
# mappings for the local hosts that share this file.
#
# In the presence of the domain name service or NIS, this file may not be
# consulted at all; see /etc/host.conf for the resolution order.
#
# DO NOT EDIT THIS FILE BY HAND; YOUR CHANGES WILL BE OVERWRITTEN
#
# Define alias-to-address mappings in /etc/conf.d/hostname

I've relied on  my hosts file heavy, is there a preferred way to to match ip addresses with names similar to using the hosts file? 



#2
sputnik

sputnik

    Advanced Member

  • Members
  • PipPipPip
  • 117 posts

It's pretty annoying, isn't it?  Especially since without warning it nukes your /etc/hosts file with no backup.

Fear not though, still the same, the aliases just get copied over automatically from your /etc/conf.d/hostname file each startup.  Check that file out, it tells you how to do it.

cat /etc/conf.d/hostname
# Set to the hostname of this machine
hostname="thishearmachine"
#aliases=""
aliases="192.168.1.100       thishearrouter
192.168.1.102                someothermachine"

etc.

And then it was released in stages.  My arm machines a couple of months ago, amd64 a week ago, x86 a couple of days later.  Never a dull moment.

BUT

Once I got used to it on the arms, it works fine.  Today though I noticed that it was repeatedly pasting the aliases in the /etc/hosts file over and over again on my amd64, apparently not rewriting new each time as the arms do, and as is implied.  I don't know what that's about yet, gotta check it out.



#3
666threesixes666

666threesixes666

    Advanced Member

  • Members
  • PipPipPip
  • 129 posts

i wonder how this is going to clash with dnsmasq....  dnsmasq can serve aliases though i have not gone through the program enough to know exactly how to do that.  i haven't had the opportunity to work with a network large enough to warrant learning these things.  i just use it for localhost cache only dns server end point for dnscrypt. my encrypted dns is much slower than 8.8.8.8 && 8.8.4.4.  i wonder what's automatically generating that file?  i kind of like the idea of the aliases in conf.d hostname though....

 

"aliases" floods my hosts files with duplicate entries if i restart /etc/init.d/hostname  its also inserting the 127.0.0.1 alias wonky stacked on top of the hostname line, its appending the first alias to the loopback hostname statement possibly a blank line then aliases would work


Duke: No more of that talk or I'll put the f*cking leeches on you, understand?

 

Paul: [about Percy] The man is mean and careless and stupid, and that's a bad combination in a place like this.


#4
sputnik

sputnik

    Advanced Member

  • Members
  • PipPipPip
  • 117 posts

I thought maybe that was it, having restarted hostname a few times, but no, this morning on start I've got duped entries, cleaned it last night.

Snooped around a little last night, didn't see anything that jumps out & grabs me.  Also noticed the arms are doing it too, watched it closely a couple of months ago after the change, was working right then.  So maybe a funky version?  Hope they fix it.  Maybe a little creativity with the /etc/init.d/hostname file...



#5
gnuisance

gnuisance

    Newbie

  • Members
  • Pip
  • 6 posts

The plot thickens.

+# Add aliases for other hosts to /etc/hosts directly. The networking scripts
+# automatically generate the localhost lines only.

While updating my config files after an update I came across this addition to the /etc/conf.d/hostname file.  It looks like I'm supposed to put aliases for other hosts in /etc/hosts directly.  I look forward to the day my hosts don't have to live in fear of being overwritten.



#6
sputnik

sputnik

    Advanced Member

  • Members
  • PipPipPip
  • 117 posts

That is interesting gnuisance.  Sounds like we go back to the old methods?  Perhaps I missed that last time I did dispatch-conf.

It's still duping like crazy here, so I'm gonna try that.

And yet it still says this in /etc/hosts:

#
# DO NOT EDIT THIS FILE BY HAND; YOUR CHANGES WILL BE OVERWRITTEN
#
# Define alias-to-address mappings in /etc/conf.d/hostname
 
Maybe left over from before


#7
sputnik

sputnik

    Advanced Member

  • Members
  • PipPipPip
  • 117 posts
✓  Best Answer

Well that seems to be the magic.  Just cleaned out my hosts file, commented out all those aliases in /etc/conf.d/hostname, reboot, and perfect.  Indeed those warnings in the host were leftover from before, not there on this write.

Hopefully we'll get a new bug feature to keep us entertained soon.

Once again you've helped me so I didn't have to use my brain.  Thank you.





Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users