FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 06-16-2011, 06:32 AM
Tapas Mishra
 
Default /etc/hosts in debian resets itself on reboot

I've been having a problem where when our vps provider decides to
restart the server (running Debian 5.0.8), the server fails to
remember changes to /etc/hosts. All I need is an database alias that
is used for the webapps on the server which points to 127.0.0.1
localhost.

I want it to look like this:

# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


127.0.0.1 localhost.localdomain localhost webservice database
# Auto-generated hostname. Please do not remove this comment.
XXX.XX.XXX.XX xxxxxx.net.au xxxxxx www.xxxxxxx.net.au xxxxxxx

Note the word database at the end of above 127.0.0.1

However whenever there is a reboot it resets itself to:

# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


127.0.0.1 localhost.localdomain localhost webservice
# Auto-generated hostname. Please do not remove this comment.
XXX.XX.XXX.XX xxxxxx.net.au xxxxxx www.xxxxxxx.net.au xxxxxxx

Note the word database missing after 127.0.0.1
without the database, and I have to manually change the file to get
things to work. This has been happening for awhile and has become a
nuisance, but I can't seem to find a way to get changes to stick.
Anyone know what to do?

--
------------------------------
http://mightydreams.blogspot.com
Tapas


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: BANLkTimYn4ZNpMBNCDDR1=Vy2R8pyaLMGw@mail.gmail.com ">http://lists.debian.org/BANLkTimYn4ZNpMBNCDDR1=Vy2R8pyaLMGw@mail.gmail.com
 
Old 06-16-2011, 08:11 AM
Claudius Hubig
 
Default /etc/hosts in debian resets itself on reboot

Tapas Mishra <mightydreams@gmail.com> wrote:
>Note the word database missing after 127.0.0.1
>without the database, and I have to manually change the file to get
>things to work. This has been happening for awhile and has become a
>nuisance, but I can't seem to find a way to get changes to stick.
>Anyone know what to do?

Do you happen to have Network Manager or something similiar running?
It does have some strange ideas wrt the 127.0.0.1-line. Otherwise,
I’d suspect your hosts’ script doing strange stuff, as it already
seems to be tampering with your /etc/hosts (# Auto-generated
hostname. Please do not remove this comment.).

Best regards,

Claudius
--
How's the wife? Is she at home enjoying capitalism?
Please use GPG: ECB0C2C7 4A4C4046 446ADF86 C08112E5 D72CDBA4
http://chubig.net/ http://nightfall.org



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110616101151.23890143@ares.home.chubig.net">http ://lists.debian.org/20110616101151.23890143@ares.home.chubig.net
 
Old 06-16-2011, 08:21 AM
Jochen Schulz
 
Default /etc/hosts in debian resets itself on reboot

Tapas Mishra:
>
> I've been having a problem where when our vps provider decides to
> restart the server (running Debian 5.0.8), the server fails to
> remember changes to /etc/hosts. All I need is an database alias that
> is used for the webapps on the server which points to 127.0.0.1
> localhost.

I don't know what keeps overwriting your file, but I assume it actually
just re-writes a single line for localhost. Try adding a new line
pointing to "database" like this and see if that persists:

127.0.0.1 database

J.
--
At night I go to the kitchen; specifically, the knife drawer.
[Agree] [Disagree]
<http://www.slowlydownward.com/NODATA/data_enter2.html>
 
Old 06-16-2011, 10:47 AM
Tom H
 
Default /etc/hosts in debian resets itself on reboot

On Thu, Jun 16, 2011 at 4:21 AM, Jochen Schulz <ml@well-adjusted.de> wrote:
>>
>> I've been having a problem where when our vps provider decides to
>> restart the server (running Debian 5.0.8), the server fails to
>> remember changes to /etc/hosts. All I need is an database alias that
>> is used for the webapps on the server which points to 127.0.0.1
>> localhost.
>
> I don't know what keeps overwriting your file, but I assume it actually
> just re-writes a single line for localhost. Try adding a new line
> pointing to "database" like this and see if that persists:
>
> 127.0.0.1 database

NM adds a line associating the DHCP-assigned address with the box's
hostname. The 127.0.0.1 line doesn't change.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: BANLkTin1NHzqZPu5noj-3x6cGHqB7P3c6Q@mail.gmail.com">http://lists.debian.org/BANLkTin1NHzqZPu5noj-3x6cGHqB7P3c6Q@mail.gmail.com
 
Old 06-16-2011, 11:26 AM
Claudius Hubig
 
Default /etc/hosts in debian resets itself on reboot

Tom H <tomh0665@gmail.com> wrote:
>On Thu, Jun 16, 2011 at 4:21 AM, Jochen Schulz <ml@well-adjusted.de> wrote:
>>>
>>> I've been having a problem where when our vps provider decides to
>>> restart the server (running Debian 5.0.8), the server fails to
>>> remember changes to /etc/hosts. All I need is an database alias that
>>> is used for the webapps on the server which points to 127.0.0.1
>>> localhost.
>>
>> I don't know what keeps overwriting your file, but I assume it actually
>> just re-writes a single line for localhost. Try adding a new line
>> pointing to "database" like this and see if that persists:
>>
>> 127.0.0.1 database
>
>NM adds a line associating the DHCP-assigned address with the box's
>hostname. The 127.0.0.1 line doesn't change.

It also adds the hostname of the machine read from /etc/hosts to
the ::1 and 127.0.0.1 lines, although that is not a FQDN. I placed a
file /etc/hosts.real and rewrite /etc/hosts on every occasion NM had
reason to tamper with it (startup, connection to a new network,
shutdown etc.).

Best regards,

Claudius
--
Power, n.:
The only narcotic regulated by the SEC instead of the FDA.
Please use GPG: ECB0C2C7 4A4C4046 446ADF86 C08112E5 D72CDBA4
http://chubig.net/ http://nightfall.org



--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110616132618.28ef0c0e@ares.home.chubig.net">http ://lists.debian.org/20110616132618.28ef0c0e@ares.home.chubig.net
 
Old 06-16-2011, 11:40 AM
Camaleón
 
Default /etc/hosts in debian resets itself on reboot

On Thu, 16 Jun 2011 10:11:51 +0200, Claudius Hubig wrote:

> Tapas Mishra <mightydreams@gmail.com> wrote:
>>Note the word database missing after 127.0.0.1 without the database, and
>>I have to manually change the file to get things to work. This has been
>>happening for awhile and has become a nuisance, but I can't seem to find
>>a way to get changes to stick. Anyone know what to do?
>
> Do you happen to have Network Manager or something similiar running? It
> does have some strange ideas wrt the 127.0.0.1-line. Otherwise, I’d
> suspect your hosts’ script doing strange stuff, as it already seems to
> be tampering with your /etc/hosts (# Auto-generated hostname. Please do
> not remove this comment.).

And this user agrees with that:

Why is my hosts file reseting on reboot?
http://superuser.com/questions/52973/why-is-my-hosts-file-reseting-on-reboot

So I can only think in a DNS server or an external policy coming from the
provider that is enforcing the content of the "/etc/hosts" file. But I
would better ask them before making any change.

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2011.06.16.11.40.54@gmail.com">http://lists.debian.org/pan.2011.06.16.11.40.54@gmail.com
 
Old 06-16-2011, 12:07 PM
Nico Kadel-Garcia
 
Default /etc/hosts in debian resets itself on reboot

On Thu, Jun 16, 2011 at 2:32 AM, Tapas Mishra <mightydreams@gmail.com> wrote:
> I've been having a problem where when our vps provider decides to
> restart the server (running Debian 5.0.8), the server fails to
> remember changes to /etc/hosts. All I need is an database alias that
> is used for the webapps on the server which points to 127.0.0.1
> localhost.
>
> I want it to look like this:
>
> # The following lines are desirable for IPv6 capable hosts
> # (added automatically by netbase upgrade)
>
> ::1 * * ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
> ff02::3 ip6-allhosts
>
>
> 127.0.0.1 localhost.localdomain localhost webservice database
> # Auto-generated hostname. Please do not remove this comment.
> XXX.XX.XXX.XX xxxxxx.net.au *xxxxxx www.xxxxxxx.net.au xxxxxxx

No. You don't You want this:

127.0.0.1 localhost.localdomain localhost
127.0.0.2 webservice database

Trust me on this: it keeps NetworkManager from mucking with it, and
will continue to focus your "webservice" traffic to the local network
port. The overpopulation and auto-editing of "localhost" and 127.0.0.1
is an old problem. Your editing attempts, and what is probably
NetworkManager's attempts to reset this "correctly", are conflicting

Unfortunately, NetworkManager is, in my experienced and expert
opinion, *crap*. It tries to do way too many things, and gets most of
them wrong because it *does not publish its API*. It just tries to
guess one based on other tool's common practices,and those differ by
convention by distribution and environment and local policy. And it
consistently gets them wrong for locally configured servers, as you
just found out.

Rip it out if possible: disable its init scripts if the dependencies
force you to keep it around.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: BANLkTikZFKjX_YkC22qJsekqYBO6EPBhnQ@mail.gmail.com ">http://lists.debian.org/BANLkTikZFKjX_YkC22qJsekqYBO6EPBhnQ@mail.gmail.com
 

Thread Tools




All times are GMT. The time now is 01:08 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org