System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

NTPQ *** can't find localhost

SOLVED
Go to solution
Jeff Stevko
Occasional Advisor

NTPQ *** can't find localhost

On some of my HP-UX 11.11 boxes, when you call up ntpq, you get a *** can't find host localhost message. You can, from there do
ntpq> host and then proceed. The next time you call up ntpq, you have to re-enter the host again. I've been thru the man pages and a couple of other resources including our local HP CE, any ideas?
I've tried adding a host= statement to the ntp.conf just for drill, no help.
7 REPLIES
Patrick Wallek
Honored Contributor

Re: NTPQ *** can't find localhost

What happens if you do a 'nslookup localhost'?

Is localhost defined in your /etc/hosts file? There should be a line similar to

127.0.0.1 loopback localhost

in the /etc/hosts file.
Bill Hassell
Honored Contributor

Re: NTPQ *** can't find localhost

The standard ntp.conf file is full of confusing comments. There is no host= option for ntp.conf (see man ntp.conf). Replace this file with just the essentials:

server 0.us.pool.ntp.org # US pool 0
server 1.us.pool.ntp.org # US pool 1
server 2.us.pool.ntp.org # US pool 2
fudge 127.127.1.1 stratum 10 # localhost fallback
driftfile /etc/ntp.drift # monitor drift

Replace the server lines with the names of your ntp servers. The fudge is used to define the fallback to the local clock whwen all else fails.

NOTE: if you want all those comments back, the original file is located in n/usr/newconfig/etc/ntp.conf


Bill Hassell, sysadmin
Jeff Stevko
Occasional Advisor

Re: NTPQ *** can't find localhost

localhost is defined in /etc/hosts.
127.0.0.1 localhost loopback

and nslookup finds this.

Also, /etc/ntp.conf is pretty sparse

driftfile /etc/ntp.drift #path for drift file
fudge 127.127.1.1 stratum 10
server 150.235.251.228 version 3
server 150.235.229.57 version 3
Matti_Kurkela
Honored Contributor

Re: NTPQ *** can't find localhost

Are the files /etc/nsswitch.conf, /etc/resolv.conf and /etc/hosts readable by everyone? They should be.

If they have been over-zealously protected, hostname resolving will typically fail for everyone except root.

If the file permissions are in order, the next thing to check is the contents of all three above-mentioned files. You've already shown that /etc/hosts contains a good-looking localhost line, is there anything else that might confuse matters? And are the two other files configured correctly?

MK
MK
Jeff Stevko
Occasional Advisor

Re: NTPQ *** can't find localhost

Hmmm. I have no /etc/nsswitch.conf. This was a clean OEM install of 11.11. Spose that may be it? I'll try looking at some other servers and see what they show. These boxes do not use any name service beyond /etc/hosts. (they are for training)
James R. Ferguson
Acclaimed Contributor
Solution

Re: NTPQ *** can't find localhost

Hi Jeff:

> I have no /etc/nsswitch.conf.

You won't after a cold-install. It is incumbent on you to choose the template you want and copy it as '/etc/nsswitch.conf'.

You choices may be seen with:

# ls -l /etc/nsswitch*

Regards!

...JRF...
Jeff Stevko
Occasional Advisor

Re: NTPQ *** can't find localhost

Ah-HA!
That did it. I copied in the generic nsswitch.files, and now it is working.
I didn't think I needed the nsswitch.conf, because on these boxes it's strictly running off of the /etc/hosts...