/etc/hosts reverting to previous version

This might be an issue with the platform, but thought I’d ask here first.

I’m running 10.4 as a VirtualBox guest. I’ve edited within /etc/hosts the IP for a server I’m trying to connect to. However, every time I reboot it reverts to the previous version showing the old IP. I’ve edited the file manually as well as via YaST. Neither cements the changes.

Before I go running to the VirtualBox forums, has anyone else ever encountered this?

-Mathew

Oops. 11.4, not 10.4.

On 10/04/2011 04:26 PM, theillien wrote:
>
> has anyone else ever encountered this?

i’m confused about what application you are having problems with…do
you think it is YaST, or whatever you used to edit /etc/hosts, or
network manager, or ifup, or what?

but, i’m also kinda confused about what you are trying to do…if you
want to connect to a server from 11.4 running in a VM i don’t understand
why you want to put anything into /etc/hosts…i mean, how are you
intending to connect: http? ftp? ssh? VNC? nfs? samba? telnet? hard wire
via ethernet? wireless? which of those means/methods or protocols
requires one to manually pre-load something into /etc/hosts?

now, let me hasten to add that i’m no networking guru (i’m not even a
breathing guru and i’ve done that for a LONG time) so, if you think
maybe it is not an applications problem then why not post in the
networking forum?


DD
Caveat
openSUSE®, the “German Automobiles” of operating systems

I would say that you’re probaby using NAT (which is VirtualBox default). So the VirtualBox application on the host serves as a dhcp/router to the guest, and you didn’t uncheck Change Hostname via dhcp as you installed the guest … maybe. But you should setup VirtualBox to use bridge if you want a real network connection in both ways. I don’t know how the guest can use network services on the host (except dhcp) without port forwarding… but I never use NAT. A bridge would be easier IMO. It would be indeed a question for the networking forum.

@DenverD: You’re making it far more complicated than it is. A file gets rewritten to a previous state every time I reboot. That’s the issue. Nothing to do with connecting to network services.

@please_try_again: Set to bridge already. I get my IP from our corporate dhcp.

Clarification: It isn’t the local hostname that is being change. The IP for another host is being reverted to a previous entry every time the VM is rebooted. I even took a snapshot of the running VM after the change was made and booting that snapshot still reverted.

On 10/04/2011 06:26 PM, theillien wrote:
>
> @DenverD: You’re making it far more complicated than it is. A file gets
> rewritten to a previous state every time I reboot. That’s the issue.
> Nothing to do with connecting to network services.

there are several files associated with networking that are are affected
by settings in config files…i don’t know enough about networking to
know what is deliberately removing and reverting to previous info…i
think it could be something setup in YaST, or network manager or ifup or
hosts.conf or whatever

OR, it might be other things going on…i do not know… but i think a
networking guru would know…and it was therefore i suggested you ask
in that forum…

but, you are free to stay here and wait . . .


DD
Caveat
openSUSE®, the “German Automobiles” of operating systems

On 2011-10-04 18:26, theillien wrote:

> Clarification: It isn’t the local hostname that is being change. The IP
> for another host is being reverted to a previous entry every time the VM
> is rebooted. I even took a snapshot of the running VM after the change
> was made and booting that snapshot still reverted.

I don’t remember seeing anything like that. There is a setting in config
that makes it reorder the hosts file. Try disabling it, just in case.

Mmm… I’m trying to find the setting, but I can’t. YESS! Found it.

/etc/sysconfig/suseconfig:
BEAUTIFY_ETC_HOSTS=“no”

Other ideas:

Check that the hosts file is really changed when you edit it.

There is a trick to block modification of a file and learn what program is
modifying it: apparmor. I have to find it, wait …] this (from Cristian
Rodríguez @ suse):


Date: Fri, 06 Mar 2009 12:04:21 -0300
From: Cristian Rodríguez <  @suse.de>
To: opensuse@opensuse.org
Subject: Re: [opensuse] Who and why removes permissions to /dev/null ?



try this:

# auditctl -w /dev/null -p a
# auditctl -e 1

and then watch the logs...
if auditctl is not found, when you execute it as root, install package
"audit"


In this case you don’t put /dev/null, you put /etc/hosts. Read the man on
auditctl first, I have never used that trick. Obviously, it only works with
the system running - if it is VB who does the bad thing, I have no idea
what you can do.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Are you running dnsmasq?

sudo service dnsmasq status

You can try to send a dhcp request with the verbose option. Maybe the dhcp server is doing that (?!)

dhclient -v <nic*>
  • for example, eth0

IMO, it has nothing to do with VirtualBox. If you have a bridge, your vm is like any other computer in the lan. But you should check if other computers receiving an IP from this dhcp server also get /etc/hosts rewritten.

Yes, and if it is, send a dhcp request after editing/saving /etc/hosts and check again.

On 2011-10-05 03:16, please try again wrote:
>
> robin_listas;2390443 Wrote:
>>
>> Other ideas:
>>
>> Check that the hosts file is really changed when you edit it.
>>
>
> Yes, and if it is, send a dhcp request after editing/saving /etc/hosts
> and check again.

You think that dhcp can publish /etc/hosts entries? It would be an
interesting feature…


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On 2011-10-05 03:06, please try again wrote:

> IMO, it has nothing to do with VirtualBox.

What about the guest utilities? :-?


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

This may be a silly question, but are you running 11.4 from a LiveCD every time, rather than from an installed instance on a virtual disk? Because obviously there is no persistence of anything you edit in that VM.

Check the boot order of the virtual machine!

On 10/05/2011 03:46 AM, ken yap wrote:
>
> This may be a silly question, but are you running 11.4 from a LiveCD
> every time, rather than from an installed instance on a virtual disk?
> Because obviously there is no persistence of anything you edit in that
> VM.

my guess: Ken nailed it!


DD
openSUSE®, the “German Automobiles” of operating systems

On 2011-10-05 09:47, DenverD wrote:
> On 10/05/2011 03:46 AM, ken yap wrote:
>>
>> This may be a silly question, but are you running 11.4 from a LiveCD
>> every time, rather than from an installed instance on a virtual disk?
>> Because obviously there is no persistence of anything you edit in that
>> VM.
>
> my guess: Ken nailed it!

But in that case, nothing at all could be saved, not only the host file.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Well in the situation I hypothesize you can modify files, but it’s only in the RAM disk. When you reboot, it all evaporates.

On 2011-10-05 10:36, ken yap wrote:
>
> robin_listas;2390567 Wrote:
>> But in that case, nothing at all could be saved, not only the host file.
>
> Well in the situation I hypothesize you can modify files, but it’s only
> in the RAM disk. When you reboot, it all evaporates.

Yes, of course.

Although some lives, like puppy, requests to store an ext3 image file in
the (windows) hard disk, where it stores configurations and home files. It
scans for it during boot from the CD and skips questions.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

On Wed, 05 Oct 2011 08:36:03 +0000, ken yap wrote:

> robin_listas;2390567 Wrote:
>> But in that case, nothing at all could be saved, not only the host
>> file.
>
> Well in the situation I hypothesize you can modify files, but it’s only
> in the RAM disk. When you reboot, it all evaporates.

If it were a USB Live image, IIRC, the root filesystem would be like a
Live CD, but there is persistence in the home directory.

Possibly with a LiveCD as well if a flash drive were plugged in - I don’t
recall if it does that or not (though I recall some Live distributions
do).

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On Tue, 04 Oct 2011 16:26:03 GMT, theillien
<theillien@no-mx.forums.opensuse.org> wrote:

>
>@DenverD: You’re making it far more complicated than it is. A file gets
>rewritten to a previous state every time I reboot. That’s the issue.
>Nothing to do with connecting to network services.
>
>@please_try_again: Set to bridge already. I get my IP from our
>corporate dhcp.
>
>Clarification: It isn’t the local hostname that is being change. The IP
>for another host is being reverted to a previous entry every time the VM
>is rebooted. I even took a snapshot of the running VM after the change
>was made and booting that snapshot still reverted.

A little late to the party but, are you saving the VM before
exiting/rebooting?

?-)

On 10/04/2011 06:26 PM, theillien wrote:
>
> @DenverD: You’re making it far more complicated than it is. A file gets
> rewritten to a previous state every time I reboot. That’s the issue.
> Nothing to do with connecting to network services.
>
> @please_try_again: Set to bridge already. I get my IP from our
> corporate dhcp.
>
> Clarification: It isn’t the local hostname that is being change. The IP
> for another host is being reverted to a previous entry every time the VM
> is rebooted. I even took a snapshot of the running VM after the change
> was made and booting that snapshot still reverted.
>
>

so, @theillien, what is your status?
did you solve the problem or not??

and, what was the solution? please…


DD
openSUSE®, the “German Automobiles” of operating systems