LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 01-20-2013, 07:07 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,155

Rep: Reputation: 46
ntpq -p: Connection refused


Slackware 14.0

Hi: The system time is always lagging by a multiple of one hour. But see this:
Code:
root@darkstar:~# ntpq -p
ntpq: read: Connection refused
root@darkstar:~#
I attach my /etc/ntp.conf, in case the reader can draw some conclusion.
Attached Files
File Type: txt ntp.txt (1.9 KB, 16 views)

Last edited by stf92; 01-20-2013 at 09:38 AM.
 
Old 01-20-2013, 09:29 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,075

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
Sounds like the server isn't running -- do you get something like this:
Code:
fubar-root-/root: ps -ef | grep ntpd
root      8160     1  0 04:40 ?        00:00:00 /usr/sbin/ntpd -g -p /var/run/ntpd.pid
root      8593  8559  0 10:27 pts/0    00:00:00 grep ntpd
(and only one running server).
 
Old 01-20-2013, 09:34 AM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,155

Original Poster
Rep: Reputation: 46
Code:
root@darkstar:~# ps -ef|grep ntp
root     11315 11294  0 09:32 pts/0    00:00:00 grep ntp
root@darkstar:~#
No server running! I had it OK in 12.0 (This is 14.0).
 
Old 01-20-2013, 09:54 AM   #4
kikinovak
Senior Member
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: Slackware, Slackware64
Posts: 1,712

Rep: Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820
http://docs.slackware.com/howtos:network_services:ntp?s[]=ntp
 
Old 01-20-2013, 10:13 AM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,075

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
Quote:
Originally Posted by stf92 View Post
Code:
root@darkstar:~# ps -ef|grep ntp
root     11315 11294  0 09:32 pts/0    00:00:00 grep ntp
root@darkstar:~#
No server running! I had it OK in 12.0 (This is 14.0).
You probably need to take a look at /etc/ntp.conf (make sure you're configured for Argentina and all that) and
Code:
root: chmod 755 /etc/rc.c/rc.ntpd
then start it manually (it will get started at boot when rc.ntpd is executable).
Code:
root: /etc/rc.d/rc.ntpd start
You may want to set the date and time manually before starting NTP -- use ntpdate or just set it with date; you want to get the clock close.

Oop! Forgot. Paste this into your browser: /usr/doc/ntp-4.2.6p5/html/ntpdate.html if you don't already know how to use ntpdate.

Hope this helps some.

Last edited by tronayne; 01-20-2013 at 05:03 PM. Reason: Duh! Buenos Aires is NOT in Brazil, dummy, it's in Argentina. Oh, well.
 
1 members found this post helpful.
Old 01-20-2013, 10:45 AM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,155

Original Poster
Rep: Reputation: 46
Oh yes, dear Sir. I have used ntpdate before, to set the time, but thank you, thank you very much for the link. Now, I think the problem ought to be somewhere else. Because look at this:[quote]
root@darkstar:/etc# ls -l /etc/rc.d/rc.ntpd
-rwxr-xr-x 1 root root 804 2012-07-04 13:38 /etc/rc.d/rc.ntpd*
root@darkstar:/etc#
[/code]
The execute bit is on. On the other hand, I copied rc.ntpd from my 12.0 install to this one (14.0). It's impossible that all of the servers listed there are out of service (I gave a link to it in post #1).
 
Old 01-20-2013, 11:14 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,969

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
Either ntp is not starting at boot time or your local clock is off by more then is acceptable and ntp is just quitting. Have you checked the logs? Have you tried manually starting ntpd?

With the current version of ntp the -g option should force the time to be set first prior to the daemon actually trying to synch with a server. This is the same as running ntpdate first then ntpd.

If ntp is starting and can't find a time server to synch,it will revert back to the local clock. This is the purpose of the fudge server in the ntp.conf file.
 
Old 01-20-2013, 11:32 AM   #8
kikinovak
Senior Member
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: Slackware, Slackware64
Posts: 1,712

Rep: Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820Reputation: 820
1) Proceed to an initial adjustement with 'ntpdate' while 'ntpd' is NOT running.

2) Configure /etc/ntp.conf.

3) Activate and start rc.ntpd.

Everything is explained in the HOWTO (see link above). Here's my original documentation:

http://www.microlinux.fr/slackware/L.../NTP-HOWTO.txt
 
Old 01-20-2013, 12:03 PM   #9
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,155

Original Poster
Rep: Reputation: 46
Quote:
Originally Posted by michaelk View Post
Either ntp is not starting at boot time or your local clock is off by more then is acceptable and ntp is just quitting. Have you checked the logs? Have you tried manually starting ntpd?
I'm sure I did both things but, just in case I'm wrong, I do them again.

This is the last line in /var/log/ntp.log:
Code:
19 Jan 00:34:58 ntpd[1621]: 0.0.0.0 0617 07 panic_stop +10803 s; set clock manually within 1000 s.
What happened at 00:34:58. Was ntpd execution cancelled? Because is not running now. I do
Code:
dmesg -s 32000|grep ntpd
and see that ntpd is not there.

So, sometimes, at startup, it starts and sometimes not?
As it says "set clock manually within 1000 s but the clock lags by double that quantity, I set the clock (date) at 00:34:58 + 1000s (not really now, but in the past).

I'll do this: set the clock with ntpdate at current local time and then start the script and watch for at least 24hs to see what happens.
 
Old 01-20-2013, 12:05 PM   #10
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,075

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
Quote:
Originally Posted by stf92 View Post
The execute bit is on. On the other hand, I copied rc.ntpd from my 12.0 install to this one (14.0). It's impossible that all of the servers listed there are out of service (I gave a link to it in post #1).
Uh, did you mean that you copied /etc/ntp.conf (rather than /etc/rc.d/rc.ntpd)? The linked file from your earlier post looks OK to me.

This might be a silly question, but can you ping the servers you specified in ntp.conf? That would tell you that whatever DNS server you use can resolve the addresses and that those time servers are active (eliminating two potential problems).

I notice in your atachment that you're logging -- does the log show you anything? Oh, yeah, did you manually create the log file (it doesn't exist by default) with something like
Code:
root: touch /var/log/ntp.log
Hope this helps some.
 
Old 01-20-2013, 12:17 PM   #11
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,155

Original Poster
Rep: Reputation: 46
Quote:
Originally Posted by tronayne View Post

This might be a silly question, but can you ping the servers you specified in ntp.conf? That would tell you that whatever DNS server you use can resolve the addresses and that those time servers are active (eliminating two potential problems).
Only if you tell me what "to ping" is.


Quote:
I notice in your atachment that you're logging -- does the log show you anything? Oh, yeah, did you manually create the log file (it doesn't exist by default) with something like
Code:
root: touch /var/log/ntp.log
I never did that.
 
Old 01-20-2013, 12:44 PM   #12
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,075

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
The ping utility sends echo requests to network hosts. For example, I pinged one of your time servers:
Code:
ping -c 5 3.ar.pool.ntp.org
PING 3.ar.pool.ntp.org (170.210.222.2) 56(84) bytes of data.
64 bytes from 170.210.222.2: icmp_req=1 ttl=43 time=1051 ms
64 bytes from 170.210.222.2: icmp_req=2 ttl=40 time=1211 ms
64 bytes from 170.210.222.2: icmp_req=3 ttl=40 time=1139 ms
64 bytes from 170.210.222.2: icmp_req=4 ttl=40 time=1121 ms
64 bytes from 170.210.222.2: icmp_req=5 ttl=40 time=1478 ms

--- 3.ar.pool.ntp.org ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 6702ms
rtt min/avg/max/mdev = 1051.162/1200.628/1478.676/148.132 ms, pipe 2
Bear in mind that I'm a continent away from you and your results should be much faster than shown here. The utility is handy for finding out if a site is running, how long it takes for a transmission to go from you to there and back again, stuff like that; read the manual page if you're interested.

You do need to create that log file.

Hope this helps some.
 
Old 01-20-2013, 01:12 PM   #13
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,155

Original Poster
Rep: Reputation: 46
I'll skim through ping's manual and use it. I do have a log file created, /var/log/ntp.log and I'm watching its contents now, as I have done in the past. I did:
  • ntpdate <server_name>
    where server_name is one of those listed in /etc/ntp.conf. I communicated with the server and the date/time was correctly set (it matched my time).
  • /etc/rc.d/rc.ntpd start
in that order. Now I'm reading /var/log/ntp.log and it follows local time.

In my past tries to fix the problem, I skipped the second step above. I do not say things are OK now. I have to keep an eye on it and see what happens. And of course, to thank you. Cheers.
 
Old 01-20-2013, 02:04 PM   #14
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,075

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
If you give ntpd at least five minutes of run time, it should sync up with one of the servers you have defined in ntp.conf; if you execute
Code:
fubar-trona-/home/trona: /usr/sbin/ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 127.127.1.0     .LOCL.          10 l  10h   64    0    0.000    0.000   0.000
+64.34.171.122   198.60.22.240    2 u  296 1024  377  947.405  -237.04 425.531
*173.255.219.242 23.213.115.25    2 u  440 1024  377  1223.21  123.271 134.556
+66.232.97.8     149.20.64.28     2 u  386 1024  377  1278.66  -94.157 208.588
You use -pn so you won't contact a DNS server to show you the names of the sites and it's faster getting the display (and, basically, you don't care what the names of the sites are anyway).

In the display above, the asterisk indicates the time server ntpd has synchronized with and the other two are candidates for connection if that server goes away for whatever reason.

If you don't see something similar to the above (where a server has synchronized) after 5- to 10 minutes, then you've got a problem to deal with. Once NTP synchronizes, it's going to stay synchronized as long as your network connection remains alive and there are pool servers to connect with. Periodically, NTP will get a batch of new pool servers if the ones it already has start to go bad; it will also occasionally evaluate the connections and drop one that's not good enough and request another from the pool server.

Hope this helps some.
 
Old 01-20-2013, 03:19 PM   #15
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,155

Original Poster
Rep: Reputation: 46
My output to ntpq -pn is quite like yours. Now, I do not understand what happened just after 14.0 installation. All should have worked out of the box, I mean this problem should never have happened.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vsftpd not working: Connection attempt failed with "ECONNREFUSED - Connection refused davidlu766 Linux - Server 7 05-03-2010 08:34 PM
Socket Connection Failed: 111 Connection Refused degraffenried13 Linux - General 3 05-31-2009 01:17 AM
ntpq bsk66 Linux - Newbie 4 04-02-2009 09:10 AM
eth0 going down (connection reset by peer, then connection refused) Astarath Slackware 1 09-05-2007 05:14 AM
Not sure about ntpq -pn output.... r_jensen11 Linux - General 5 07-01-2004 10:35 AM


All times are GMT -5. The time now is 03:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration