Issues with hostnames after reboot

banahosting... you are worng...

man page for hostaname...

NOTES
The address families hostname tries when looking up the FQDN, aliases and network addresses of the host are determined by the configuration of your resolver. For instance, on GNU Libc
systems, the resolver can be instructed to try IPv6 lookups first by using the inet6 option in /etc/resolv.conf.

FILES
/etc/hosts /etc/hostname This file should only contain domain name and not the full FQDN.
 
After reading this thread about hostnames and fqdn i think it is,
i will report to DA.
 
Direactadmin fixed it with there latest update.

Added --fqdn to the hostname call in nightly hostname check for some OS's return just "server" instead of "server.domain.com" with the basic:
/bin/hostname call. This is valid functionality, so we include the --fqdn to get the full output each time.
 
hello,

im no worng.

when you install centos, all other linux version. and you setup hostname, when you restart the machine this when reboot stay whit the hostname and when you type hostname this show you the test.yourdomain.com that you setup in the installation.

so don't come to say now the only are R is proxmox because this in the words only hapen in proxmox.

i install centos in one server you setup hostname when you reboot this stay, and i talking about a clean installation whit no cpanel nothing, when you do this in proxmox this only show test no test.yourdomain.com

is a bug.
 
on all my servers (debian and ubuntu), stand-alone and virtual

# hostname returns "host"

# hostname --fqdn returns "host.domain.tld"

i think this is not wrong, although it is different on some other distros.
 
is a bug.

the manual page says that hostname should not contain a FQDN. Feel contact the authors and clarify that issue.

But the only program which fails is cpannel, so I guess they should fix it.

In the meantime, you can use the workaround I posted?
 
And if you reall want another behavior, you simply edit the openvz scripts (/etc/vz/dists/scripts/redhat-set_hostname.sh)


i think this can be a good solution,

what i need to put here ?

now i have

function set_hostname()
{
local cfgfile="$1"
local var=$2
local val=$3

[ -z "${val}" ] && return 0

val=${val%%.*}

put_param "${cfgfile}" "${var}" "${val}"

hostname "${val}"
}

change_hostname /etc/hosts "${HOSTNM}" "${IP_ADDR}"
set_hostname /etc/sysconfig/network HOSTNAME "${HOSTNM}"

exit 0
 
Sorry to flog a dead horse here, but the issue I have is with proxmox/openvz generating the entry in /etc/hosts

If my server name is 'server1' and my domain is 'example.com', then

/etc/hostname should contain 'server1' and /etc/hosts should contain

x.x.x.x server1.example.com server1

The problem is that the /etc/vz/dists/scripts/*set_hostname.sh only set the hostname in /etc/hosts and not the FQDN & hostname/alias as is the most common/usual setup.

Obviously I can manually update /etc/hosts on the container, but it gets overwritten each time the container is rebooted.

[does more Google searches after writing the above...]

I eventually found http://bugzilla.openvz.org/show_bug.cgi?id=1087 which Dietmar reported as a bug and a subsequent patch.

So, to ensure you have correct /etc/hosts entries you need to define your proxmox/openvz hostname as a FQDN.

To me that seems counter intuitive and confusing. Is that the only way of handling it?
 
yes, I know it sets both /etc/hostname and /etc/hosts. The point was that if you want both files to have correct entries, then you need to set the hostname from proxmox/openvz to be the FQDN rather than the short hostname.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!