[Users] debian hostname confusion

Dietmar Maurer dietmar at proxmox.com
Wed Dec 3 03:28:05 EST 2008


Hi all,

the debian documentation states
(http://www.debian.org/doc/manuals/reference/ch-gateway.en.html)

>  The kernel maintains a system hostname. The initscript
/etc/init.d/hostname.sh sets the 
> system hostname at boot time (using the hostname command) to the name
stored in /etc/hostname. 
> This file should contain only the system hostname, not a fully
qualified domain name. 

So /etc/hostname should not contain the fully qualified domain name.

How can I use vzctl to get a correct /etc/hostname and /etc/hosts file.

I want:

/etc/hostname:
--------------
myname
--------------

/etc/hosts
--------------
127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
192.168.3.104 myname.test.com  myname
--------------

I can do

# vzctl set 777 --hostname myname --searchdoamin test.com

but then /etc/hosts is wrong. And

# vzctl set 777 --hostname myname.test.com

results in a wrong /etc/hostname

any ideas?

- Dietmar






More information about the Users mailing list