Operating System - HP-UX
1834206 Members
2127 Online
110066 Solutions
New Discussion

increasing max length of uname

 
Larry Schauer
Occasional Advisor

increasing max length of uname

The default max length for uname is 8 characters. The uname man page says this value if UTSLEN - 1, which is found in sys/utsname.h. I changed the value of "_SYS_NMLN" in this file to 64, recompiled the kernel, and rebooted, but I still cannot set the uname to a length greater than 8.

The underlying problem we are trying to solve is this: Our host naming scheme requires hostnames longer than 8 characters, and we want the hostname and nodename to be the same (as recommended by the man page).

Thanks,
Larry Schaue
Packet is GOOD, TTAs are BAD
5 REPLIES 5
Bill Hassell
Honored Contributor

Re: increasing max length of uname

uname -n is NOT the hostname, it is the UUCP nodename and cannot be larger than 8 characters. The hostname and uname are (by default) set equal equal to each other, but there is a (poorly documented) way to specify a long hostname:

Edit the file: /etc/rc.config.d/netconf and locate the line:

HOSTNAME="goofy"

Add a new line:

NODENAME="goofy"

and change HOSTNAME to:

HOSTNAME="goofythegreat"

or whatever.

Now be sure to edit /etc/hosts to include the short uname and the long hostname (as well as the FQDN or fully qualified domain name) appear in /etc/hosts.

Then to avoid delays and problems with DNS, edit gthe /etc/nsswitch.conf file and change the hosts: line to read

hosts: files[NOTFOUND=continue UNAVAIL=continue] dns

This ensure high reliability (in case of a DNS failure) and low network load for unnecessary DNS requests.

Now your system is ready to reboot, but if you want to verify that all is well, you can make the changes by hand too:

uname -S goofy
hostname goofythegreat


Bill Hassell, sysadmin
Larry Schauer
Occasional Advisor

Re: increasing max length of uname

Bill,
Thanks for the response. I know that uname is the nodename (and not the hostname), but I want the hostname = nodename (since many programs use 'uname -n' instead of 'hostname' to determine the hostname). According to the man page for 'uname', I *should* be able to increase the length of the nodename (UTSLEN - 1). But changing sys/utsname.h and recompiling the kernel doesn't seem to work. What is the proper way to change this?

Thanks, Larry
Packet is GOOD, TTAs are BAD
Larry Schauer
Occasional Advisor

Re: increasing max length of uname

Just following up on my earlier question. Does anyone have an answer or some ideas? Solaris supports nodenames of longer than 8 characters, so I would assume that HP-UX would support it as well. I noticed that HP-UX 11.0 has the same header file entry.

Thanks in advance,
Larry
Packet is GOOD, TTAs are BAD
T. M. Louah
Esteemed Contributor

Re: increasing max length of uname

Here's an interesting discussion about hostname greater than 8 chars:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xeecad06ed8c8d4118fef0090279cd0f9,00.html

g'd luck
t++
Little learning is dangerous!
Larry Schauer
Occasional Advisor

Re: increasing max length of uname

TM,
Thanks for the info. Unfortunately it does not help solve my problem. I know that the hostname can be longer than 8 chars (and have tested it). I want to increase the NODENAME to more than 8 chars. I see two likely scenarios (although others are possible):

1. We must recompile the setuname binary (and maybe uname) for the change in UTSLEN to take effect.

2. The solution is to recompile the kernel, but we did not do this correctly (a possibility, but we used SAM).

3. The man page for uname is incorrect: The nodename is NOT based on UTSLEN-1, but is always '8'.

There are probably other possibilites. I'm just looking for the solution: How to make the nodename longer than 8 chars.

Thanks,
Larr
Packet is GOOD, TTAs are BAD