vi /etc/ntp.conf


minpoll 4
maxpoll 9

tos minclock 4 minsane 3 
tos maxclock 8

clock peer sync sys

info events status statistics
logconfig =allall
statsdir /var/lib/ntp/stats
logfile /var/log/ntp

driftfile /var/lib/ntp/drift

pidfile /var/run/

restrict default limited kod nomodify notrap nopeer noquery
restrict -6 default limited kod nomodify notrap nopeer noquery
restrict ::1
restrict source limited kod nomodify notrap noquery
chmod 755 /etc/rc.d/rc.ntpd
/etc/rc.d/rc.ntpd restart


ntpq -n -p

According to Slackware docs:

System services that should wait to start until the clock is stable can be preceded by the ntp-wait command, for example databases. For example, you could conceivably edit the MariaDB section of /etc/rc.d/rc.M to read:

# Start the MariaDB database:
if [ -x /etc/rc.d/rc.mysqld ]; then
  /usr/sbin/ntp-wait -v
  /etc/rc.d/rc.mysqld start

for docker containers under slackware host:

read docker installation on slackware 15 HERE, then:

vi /etc/rc.d/rc.local

# /etc/rc.d/rc.local:  Local system initialization script.
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

if [ -x /etc/rc.d/rc.docker ]; then
  # Start Docker daemon:
  echo "Starting Docker daemon:    /etc/rc.d/rc.docker start"
  echo "Docker: Waiting fo System Time Sync"
  /usr/sbin/ntp-wait -n 10 -s 2 -v
  /etc/rc.d/rc.docker start
  echo "Docker daemon Started"


the line

/usr/sbin/ntp-wait -v

-may cause delay on services start, up to 10 minutes

-the command may fail on Correct Time or Failed time Sync

if you can’t wait, force time sync with:

ntpdate -u

Note: if you are setting a wrong time to test the ntpd, consider this:

ntpd will refuse to set the clock if it’s too far out, and will just exit. I guess it’s to protect against some rogue NTP server giving it bogus time information. If a time server goes wrong and gives you info that is weeks/months/years out, it could cause havok for your server.

for testing purpose set the time to something nearly correct manually.


I’m in mood, so writing this note

having a correct time is important, but its dangerous for modern applications which produces/consumes data or services based on time. time attacks which can change the time on your server withing ntp or somehow you don’t know, will cause wrong data produce/consume/store.

if your are worry about this , consider writing a time travel detector script or program to avoid this attacks.

By: Mehdi Sadighian
TAG: slackware, ntp, ntpd, continuous time sync