Operating System - HP-UX
1834936 Members
2226 Online
110071 Solutions
New Discussion

Re: System not configuring hostname

 
Paul McCleary
Honored Contributor

System not configuring hostname

Hi,

We have a system which is failing to retain it's hostname. uname -a reports unknown. Even if you configure it with set_parms or uname -S it will be lost after reboot.

I've noticed the following output from /sbin/init.d/hostname

./hostname[36]: Syntax error at line 2 : `)' is not expected.

Has anyone seen this before?

Cheers, Paul
8 REPLIES 8
Simon Hargrave
Honored Contributor

Re: System not configuring hostname

Line 36 in "hostname" runs /etc/rc.config, which sources all the files in /etc/rc.config.d. Any one of these could be causing that error, but it's most likely the netconf file if you can't get the hostname set.

Try running ". /etc/rc.config.d/netconf" see if you get errors. If you don't then "echo $HOSTNAME", or check the contents of the file for the HOSTNAME= parameter.
Franky_1
Respected Contributor

Re: System not configuring hostname

Hi,

seems that you've wrong chars in the hostname or if the name ist just too long (line 2???)
Names are limited to UTSLEN - 1 characters; UTSLEN is defined in - normally 8 chars
For more details look at uname (2)
What about the hostname entry in /etc/rc.config.d/netconf ?

Regards

Franky
Don't worry be happy
Marcel Boogert_1
Trusted Contributor

Re: System not configuring hostname

What hostname are you trying to set?

MB.
Paul McCleary
Honored Contributor

Re: System not configuring hostname


The hostname is only 8 characters so that should be ok.

I've copied in a new netconf file and added the correct entries. It still gives the same error on starting hostname. Though I haven't been able to reboot the box or even stop and start /sbin/init.d/net

Anyother possibilities in /etc/rc.config.d

Cheers, Paul
Simon Hargrave
Honored Contributor

Re: System not configuring hostname

try executing this: -

cd /etc/rc.config.d
for FILE in *
do
echo "Trying $FILE..."
. ./$FILE
done

This will display the name of each file in turn, followed by the output. If there are any errors you should be able to see which file is causing it.
Paul McCleary
Honored Contributor

Re: System not configuring hostname

Hi Simon & Others,

Thanks for your suggestion. I might be missing something, but these are all configuration files, so how can you execute them to check which one is causing the issue?

Cheers, Paul
Paul McCleary
Honored Contributor

Re: System not configuring hostname


Thankyou all for your help, especially Simon.

I've managed to sort it now. Somebody had put their own script in /etc/rc.config.d and not tested it, so this issue had only surfaced after a power failure this morning. Once the offending script was removed it all appears to be ok again.

Cheers, Paul
Geoff Wild
Honored Contributor

Re: System not configuring hostname

Just a tip, don't put anthying in /etc/rc.config.d except those that need to be there - IE do NOT have a netconf.bak or any other bakup files in that directory - store them somewhere else.


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.