08-06-2013 09:57 AM
Greetings, running hp-ux 11.31 on PA-RISC rp7420. I was shown a way to change the hostname on 11.31 by 1) editing the /etc/hosts file with the new name, 2) editing the /etc/rc.config.d/netconf with the new name then running /sbin/init.d/hostname start. I have done this several times in the past now, but recently, the hostname is not changed doing this. A uname or hostname command shows the original hostname. If I run set_parms hostname though, it indicates the hostname has already changed and I have the option to keep it or change it. Either way - after running set_parms, the name really is changed - as verified by uname and hostname.
More curious - I can revert to the original hostname with the initial procedure (ending with /sbin/init.d/hostname start) and do not need to run set_parms.
Can someone explain this behavior? thanks
08-07-2013 07:01 AM
What is the length of the new hostname? Is it longer than the old one? Longer than 8 characters?
Old versions of HP-UX had a hostname length limit of 8 characters. Then it became possible to extend the hostname beyond 8 characters, but if you did that, you had to also specify a 8-characters-or-less version as a "nodename", to be used by UUCP utilities and possibly other legacy stuff. When the hostname was 8 characters or less, the convention was for the nodename to be automatically set equal to the hostname.
In 11.31, even the nodename can be extended beyond 8 characters, but you must activate certain configuration options to do so. It's possible that set_parms includes the functionality to make the necessary configuration changes automatically, while the other ways to change the hostname do not.
08-13-2013 11:07 AM
If you look at what the /sbin/init.d/hostname script is doing, it is first sourcing the configuration files within the /etc/rc.config.d/ as specified by /etc/rc.config. This will get the HOSTNAME value from the netconf file.
(Do you happen to have multiple 'netconf*' files in the /etc/rc.config.d directories?)
This value is passed to the 'hostname' and 'uname -S' commands to set the name of the host.
Run the following to show what the hostname script is doing:
# sh -x /sbin/init.d/hostname start
Look for the line HOSTNAME=xxxxxxx and then the commands being used.