Operating System - HP-UX
1748073 Members
4632 Online
108758 Solutions
New Discussion

Re: Hostname change issue on hp-ux 11.31

 
DeepakMalpote
Occasional Advisor

Hostname change issue on hp-ux 11.31

Hi All,

 

Recently on one of our Backup Servers the hostname was changed to "-a".

 

I Suspect it was changed by running a "hostname -a" command.

 

The backups started to fail around 12:30PM but the first entry in syslog is around 2:14PM.

 

Dec  4 14:14:12 ddd0d201 cmclconfd[929]: Unable to resolve local hostname -a to determine the domain name
Dec  4 14:14:12 ddd0d201 cmclconfd[929]: Unable to resolve localhost(-a) IP addresses. Error: host nor service provided, or not known
Dec  4 14:15:31 ddd0d201 cmclconfd[929]: Local node -a claims to be in cluster dds_1, but dds_1 cluster configuration does not include node -a. It contains node(s): ddd0d101 ddd0d201
Dec  4 14:15:31 ddd0d201 cmclconfd[929]: This node's claimed configuration will be ignored by Serviceguard commands and other configuration clients
Dec  4 14:16:04 ddd0d201 cmclconfd[1258]: Unable to resolve local hostname -a to determine the domain name
Dec  4 14:14:12 ddd0d201 cmclconfd[929]: Unable to resolve local hostname -a to determine the domain name
Dec  4 14:16:04 ddd0d201 cmclconfd[1258]: Unable to resolve localhost(-a) IP addresses. Error: host nor service provided, or not known
Dec  4 14:16:04 ddd0d201 cmclconfd[1258]: Local node -a claims to be in cluster dds_1, but dds_1 cluster configuration does not include node -a. It contains node(s): ddd0d101 ddd0d201
Dec  4 14:16:04 ddd0d201 cmclconfd[1258]: This node's claimed configuration will be ignored by Serviceguard commands and other configuration clients

 

The Monitoring of this server stopped @12:30PM.

 

In Syslog or package log there are no entries for custer going down.

 

When we connected to the server around 2:10 pm to check the cluster status we got below message.

 

xadmin@ddd0d201# cn mviewcl
Permission denied to 127.0.0.1
cmviewcl: Cannot view the cluster configuration: Permission denied.
This user doesn't have access to view the cluster configuration.

 

We recovered the server by correcting the hostname & starting the cluster & packages manually.

 

I have following questions -

 

1) Is there any way I can confirm if the hostname was changed by running hostname -a command ? (note : We dont have any command history enabled)

 

2) Why there are no logs available for Cluster going down?

 

3) I tested this on a test server with similar OE Version.

 

On test server after chaning the hostname (with hostname -a command) "hostname" command showed -a as the hostname however "uname -a" still  showed the correct hostname. I am sure here I am not able to understand how the hostname command reports the hostname & the way uname -n command does. Do they refer different files?

 

4) In such situation, when the hostname is changed with hostname -a commanf will syslog report the related logs only if we check cluster status? because there were no logs until we ran cmviewcl command to check cluster status.

 

Your help is highly appreciated as it is really driving me nuts.

 

Thank you in advance for all your help.

 

Regards

Deepak

 

 

Wish the W was as Curvy as U.
9 REPLIES 9
Patrick Wallek
Honored Contributor

Re: Hostname change issue on hp-ux 11.31

Question 1)

Yes, running the 'hostname -a' command will definitely change your hostname to '-a'.  In HP-UX the '-a' is NOT a valid option for the hostname command.  On HP-UX there are NO options available to the hostname command.  ANYTHING you specify after the hostname command will be set as the new hostname.  See 'man hostname' for more information.

 

Likely it was someone that is more familiar with Linux that ran the 'hostname -a' command expecting it to show the hosts alias.

 

Question 2)

Have you checked the package logs on both servers?  I'm not sure why there wouldn't be logs for a cluster failure.

 

Question 3)

Uname prints the NODENAME of the server.  These can be 2 different names.  You can specify a hostname (up to 64 characters) AND a nodename (up to 8 characters) in /etc/rc.config.d/netconf.  By default if the nodename is not specifically set, it uses the hostname that is set in netconf.

 

Question 4)

Not entirely sure...

DeepakMalpote
Occasional Advisor

Re: Hostname change issue on hp-ux 11.31

Hi Patrick,

 

Thanks for your reply.

 

Question 1)

 

Likely it was someone that is more familiar with Linux that ran the 'hostname -a' command expecting it to show the hosts alias.

 

Ans: Yes. It appears to be so.

 

Question 2)

Have you checked the package logs on both servers? I'm not sure why there wouldn't be logs for a cluster failure.

 

Ans: Yes. There is absolutely nothing logged during that time. ( I am referring the logs available under /etc/cmcluster/<packagename>/<packagename>.log)

 

Is there any other location where cluster logs get moved when the cluster halts suddenly? Like in Case of OS Shutdown the syslog for that day is renamed as OLDsyslog.log and the post boot logs are logged to the syslog.log file.

 

Question 3)

Uname prints the NODENAME of the server. These can be 2 different names. You can specify a hostname (up to 64 characters) AND a nodename (up to 8 characters) in /etc/rc.config.d/netconf. By default if the nodename is not specifically set, it uses the hostname that is set in netconf.

 

Thank you very much for the above explanation. However,does it mean when the hostname is changed using the hostname command the netconf file is not updated. Is there any file where this change is updated because even if we change the hostname using hostaname command the uname command still shows the old hostname.

 

 

 

 

 

 

 

 

 

Wish the W was as Curvy as U.
Bill Hassell
Honored Contributor

Re: Hostname change issue on hp-ux 11.31

>> Is there any way I can confirm if the hostname was changed by running hostname -a command ?

There are numerous posts on the Internet with the exact same symptoms.

hostname -a is a Linux feature and a common error by novice administrators. Linux is not HP-UX, AIX or Solaris. And the least compatible features of Unix systems are the system management commands. That's why I consult the man pages on every system before typing.

 

>> (note : We dont have any command history enabled)

 

Bad idea. But knowing that someone typed the command isn't the main reason for history. Someone spent a lot of money buying and setting up Service Guard, so makes alot of sense to track actions what happened to the system. Set up command history for all users (several thousand lines) and archive these history files at least once a month -- they can be reset accidently or on purpose by users.

 

>> Why there are no logs available for Cluster going down?

 

There are several locations for cluster logs, /var/adm/syslog and /etc/cmcluster on BOTH machines. The cluster monitors the network for a heartbeat but the system's hostname is necessarily a critical resource until the application requires it. However, your backups were immediately affected as most commercial backup programs require valid hostnames and IP addresses.

 

>> hostname and uname...

 

They are very different representations of Unix networking. The man pages for each will be of help.

 

>> syslog report the related logs only if we check cluster status?
>> because there were no logs until we ran cmviewcl command to check cluster status

 

The cluster is monitoring the heartbeat not the hostname setting. Once you perform virtually any cluster command, then the network must function correctly. Even your package applications and databases may run for a while with this one error.



Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: Hostname change issue on hp-ux 11.31

>> However,does it mean when the hostname is changed using the hostname command the netconf file is not updated.

 

 

netconf is just like fstab. It is a static file that must be manually edited. hostname just changes the running system information. 

 

>> Is there any file where this change is updated because even if we change the hostname using hostaname command the uname command still shows the old hostname.

 

As mentioned, uname and hostname are completely separate. You can set either one at any time but just like changing the date, it is not recommended without consideration.



Bill Hassell, sysadmin
DeepakMalpote
Occasional Advisor

Re: Hostname change issue on hp-ux 11.31

Hi Bill,

 

Thanks for your reply.

 

Sorry for the late followup.

 

Let me tell you what we are planning to do as a mitigation to get intimation when someone changes the hostname accidently by running a "hostname -a" command.

 

1) By creating a log in syslog when the hostname is changed

 

2) Creating a critical alert based on the log message contents.

 

What I find challenging is which file to monitor to get a log in syslog?

 

I understand there is no change in any file when the hostname is changed using hostname command.

 

Is there any other way I can get an entry in syslog immediately when the hostname is changed like this?

 

Thanks

Deepak

 

 

Wish the W was as Curvy as U.
Bill Hassell
Honored Contributor

Re: Hostname change issue on hp-ux 11.31

>> 1) By creating a log in syslog when the hostname is changed

 >> 2) Creating a critical alert based on the log message contents.

 

This is will not address the underlying problem. The hostname cannot be changed by anyone except the root user. Apparently you have one or more people that know the root password but do not have appropriate skills for this responsibility in HP-UX. There are many differences between Linux, AIX,Solaris and HP-UX and experience in one of the other Unix flavors is a starting point but a good administrator always checks the man pages.

 

Yes, you can write a simple script that performs validity checks on the current hostname. Then use logger to write the message into syslog, then send email to all the HP-UX system administrators about the error along with the output of the command: last -R -20  root to show who was logged in as root when the mistake was made.

 

That's just a start. You'll need to log and email anytime the root user disables a LAN card or runs chmod -R or runs newfs on a production filesystem (the list is very long).

 

But as a long term solution, I would install and configure sudo so that none of your sysadmins have to login as root ever again. By using sudo, each root user command is logged. And more importantly, you can configure a selected list of commands that are allowed for each user.



Bill Hassell, sysadmin
DeepakMalpote
Occasional Advisor

Re: Hostname change issue on hp-ux 11.31

Hi Bill,

 

I appreciate your reply.

 

SUDO Looks like a better solution.

 

Could you please let me know a simple document that will help me configure sudo on this server?

 

Thanks

Deepak

 

 

Wish the W was as Curvy as U.
likid0
Honored Contributor

Re: Hostname change issue on hp-ux 11.31

purushottamaher
Frequent Advisor

Re: Hostname change issue on hp-ux 11.31

Hi DeepakMalpote,

 

 

You can easily change the system hostname in HP-UX by just givin one command, Just see here and changed the hostname :

 

http://expertisenpuru.com/single-command-to-change-the-hostname-in-hp-unix/

 

If anything more help you want from us, please post here, we'll help you.

 

 

Thanks.