OpenVZ Forum


Home » General » Support » On boot adjustment for /etc/hosts
On boot adjustment for /etc/hosts [message #28460] Wed, 19 March 2008 10:55 Go to next message
Ideaxis is currently offline  Ideaxis
Messages: 2
Registered: March 2008
Junior Member
We need to adjust the /etc/hosts file during reboot. OpenVZ has default settings, for example:

127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
192.168.0.247 test2

What we want is that this is automatically set to, for example:

127.0.0.1 localhost test2.domain.com test2 localhost.localdomain
# Auto-generated hostname. Please do not remove this comment.
192.168.0.247 test2


Can someone tell me how can do this?

Kind regards,
Jurgen
Re: On boot adjustment for /etc/hosts [message #28561 is a reply to message #28460] Mon, 24 March 2008 11:11 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

I'm afraid it is impossible to do without changing VPS initialization scripts.
We should distinguish between 127.0.0.1 and other IP address.
If you add appropriate record before "# Auto-generated hostname. Please do not remove this comment." string you don't loose it after reboot but that it's not true if you want to save something like that "127.0.0.1 ...".
Briefly speaking, there are some problems with 127.0.0.1 and /etc/hosts file, for example
http://bugzilla.openvz.org/show_bug.cgi?id=776

So, you can fill the bug but please look for similar problem before filling it. I've done that but haven't found the same one.
http://bugzilla.openvz.org/

Thank you very much for the assistance!
Re: On boot adjustment for /etc/hosts [message #28565 is a reply to message #28460] Mon, 24 March 2008 13:56 Go to previous message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

try this workaround.

1. Please take the latest version of vzctl.
2. Start your VPS.
3. Change /etc/hosts with your need.
4. Stop the VPS and then just comment or remove the string "HOSTNAME="test2"" from /etc/vz/conf/VEID.conf file.

After these manipulations /etc/hosts file inside VPS shouldn't be changed.
Previous Topic: Having trouble mounting in a VE
Next Topic: Quota file is gone!
Goto Forum:
  


Current Time: Sat Nov 16 11:21:15 GMT 2024

Total time taken to generate the page: 0.03019 seconds