Operating System - HP-UX
1830899 Members
2910 Online
110017 Solutions
New Discussion

Problem after hostname change

 
Victoria Leung
Advisor

Problem after hostname change

Hi,

After changing the hostname of the machine (HP-UX11.0), there is an error in /etc/rc.log after reboot.

Configuring all unconfigured software filesets
Output from "/sbin/rc2.d/S120swconfig start":
----------------------------
* Turning off all network based resolving services in
'/etc/nsswitch.conf'
* Setting up temporary hostname in '/etc/hosts'
ERROR: Cannot contact the 'swagentd' daemon because the local hostname
'DNS02' cannot be resolved, therefore no 'swconfig' or 'swremove'
will be executed at this time. The most likely solution is to define
'DNS02' in '/etc/hosts'.
* Restoring '/etc/hosts' to its original contents.
* Removing the temporary '/etc/nsswitch.conf'.
"/sbin/rc2.d/S120swconfig start" FAILED

I changed the hostname in /etc/rc.config.d/netconf, /etc/hosts and all my DNS files, nslookup is ok, swlist is ok, do I miss out anything?

Thanks for your help!

Victoria
19 REPLIES 19
Steven Sim Kok Leong
Honored Contributor

Re: Problem after hostname change

Hi,

To make a thorough change, you should use

# set_parms hostname

Hope this helps. Regards.

Steven Sim Kok Leong
Michael Tully
Honored Contributor

Re: Problem after hostname change

Hi,

Try to utilise the 'set_parms' script.

# set_parms 'hostname' (without quotes)

There is also a man page for this command. The command is basically a script that calls other binary commands.

HTH
~Michael~
Anyone for a Mutiny ?
S.K. Chan
Honored Contributor

Re: Problem after hostname change

You need to do a little bit more to get SD working properly ..
# cd /var/adm/sw
# mv security security.old
# mkdir security
==>make sure the permission and ownership is the same as the previous "security" directory.
# /sbin/init.d/net stop
# /sbin/init.d/swagentd stop
# /sbin/init.d/net start
# /sbin/init.d/swagentd start
Steven Sim Kok Leong
Honored Contributor

Re: Problem after hostname change

Hi,

The command "set_parms hostname" automatically changes your default_realm (hostname settings) in /var/adm/sw/security.

A reboot which is prompted by set_parms is usually the tidiest way to update the change.

Hope this helps. Regards.

Steven Sim Kok Leong
Victoria Leung
Advisor

Re: Problem after hostname change

Hi all,

Thanks for all the information, I have tried using "set_parms", swagentd stop and start, but everytime I give the command "/sbin/init.d/swconfig start" or reboot, there is still the same problem! :(

I am running BIND in the machine, without any /etc/nsswitch.conf files, and I have put the hostname in /etc/hosts already. What else did I miss?

Victoria
Niraj Kumar Verma
Trusted Contributor

Re: Problem after hostname change

Hi,
Can you do the following
======================
# set_parms hostname
# vi /etc/rc.config.d/netconf

Check for the HOSTNAME variable .

if it is right do one more thing.

# vi /sbin/init.d/hostname

insert the following line in seconf or third line

HOSTNAME="newhostname"

# /sbin/init.d/hostname stop
# /sbin/init.d/hostname start

==============================

-Niraj
Niraj.Verma@philips.com
S.K. Chan
Honored Contributor

Re: Problem after hostname change

Lets run through the checklist again ..
1) /etc/hosts
==> Make sure a fully qualify hostname is entered, for example
145.120.14.14 mickey.domain.com mickey
2) /etc/rc.config.d
==> The var HOSTNAME must match "uname -a" command output.
3) /etc/nsswitch.conf
==> You mentioned you did nt use this file. If 1&2 does not work for you, lets create this file and the entry should look like ..
hosts: files [NOTFOND=continue] dns
OR
hosts: dns [NOTFOUND=continue] files

That's all I can think of for now ..
Animesh Chakraborty
Honored Contributor

Re: Problem after hostname change

Hi,
If you are using DNS server for name resolution then make sure that the new host name entry is there in dns database.
Otherwise remove /etc/resolv.conf and /etc/nsswitch.conf then try.
Hope this helps
Did you take a backup?
Victoria Leung
Advisor

Re: Problem after hostname change

Hi,

Thank you very much. But I'm still having problems :(

When I remove /etc/resolv.conf, run /sbin/init.d/named stop, and /etc/nsswitch.conf looks like "hosts: files", I do a nslookup , it still said "No response from server".

It seems that nslookup does not look up the names in the hosts files!

I have tried to remove nsswitch.conf as well but it is the same.

What could be the problem?

Victoria
S.K. Chan
Honored Contributor

Re: Problem after hostname change

Do a trace on nslookup ..

# nslookup -swtrace

to really find out how nslookup searches for its info. That way you know where the hiccup is.
Pete Randall
Outstanding Contributor

Re: Problem after hostname change

I believe that behavior is normal (maybe not correct, but normal) for nslookup - it, as it's name implies, looks up DNS names, regardless of the settings in resolv.conf.

Pete
Mateja Bezjak
Respected Contributor

Re: Problem after hostname change

Hi Victoria,

I know that this was said before... To me it looks like realm and default_realms are not correct. What is the default_realm in /var/adm/sw/security/_OWNER and _ACL file? Have you checked all the files on /var/adm/sw/security if they have correct hostname entry?
Victoria Leung
Advisor

Re: Problem after hostname change

Hi,

I have checked all the files in /var/adm/sw/security/... the realm and default_realm is correct.

Strange! "nslookup -swtrace" didn't work, it said "invalid option".

Actually, I have 2 servers, and both of them have the same problem after changing the hostname... :(

All "swlist", "swinstall" work, why only "swconfig" has errors???

Victoria
Mateja Bezjak
Respected Contributor

Re: Problem after hostname change

Have you tried using /usr/sbin/swconfig ?
Victoria Leung
Advisor

Re: Problem after hostname change

Hi,

"/usr/sbin/swconfig \*" is ok without any errors.

Only "/sbin/init.d/swconfig start" has errors. I think when startup, it runs "/sbin/init.d/swconfig start".

I really thank you very much for all your help.... although the problem is not solved yet!

Victoria
Steven Sim Kok Leong
Honored Contributor

Re: Problem after hostname change

Hi,

Can you show us the contents of the startup script /sbin/init.d/swconfig?

Hope this helps. Regards.

Steven Sim Kok Leong
Victoria Leung
Advisor

Re: Problem after hostname change

Hi,

Please find attached the /sbin/init.d/swconfig file. I think that there is a process called "hack_hostname" which causes the error.

Thanks again.

Victoria
Steven Sim Kok Leong
Honored Contributor

Re: Problem after hostname change

Hi,

What is the output for the following:

# /usr/bin/nslookup `/usr/bin/hostname`

# nslookup
> policy

Hope this helps. Regards.

Steven Sim Kok Leong
Victoria Leung
Advisor

Re: Problem after hostname change

Hi,

/usr/bin/nslookup `/usr/bin/hostname` works when '/etc/resolv.conf' exists, but not works if the file does not exist.

In resolv.conf, I have put in a DNS. So when startup, this server is not yet ready to connect to the DNS. So it returns error in nslookup.

The problem is why the '/etc/nsswitch.conf' does not work. Maybe I am using an old version of nslookup? It seems that I don't have any option like "policy", "reset", "swtrace" in nslookup...

Please find attached a printout....

Victoria