2

I built ntpd from source, which process put it in /usr/local/sbin. Of course, the ntp service points to /usr/sbin. So, I thought I could just change the path in the init.d configuration file like this:

### BEGIN INIT INFO
# Provides:        ntp
# Required-Start:  $network $remote_fs $syslog
# Required-Stop:   $network $remote_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:
# Short-Description: Start NTP daemon
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

. /lib/lsb/init-functions

DAEMON=/usr/local/sbin/ntpd
PIDFILE=/var/run/ntpd.pid
...[etc]

I changed the line starting with "DAEMON" to point to the location of the new binary. However, when I try to restart the service I get the error:

[ ok ] Stopping NTP server: ntpd.
[....] Starting NTP server: ntpd/usr/local/sbin/ntpd: The 'user' option has been disabled. -- built without --enable-clockctl or --enable-linuxcaps or --enable-solarisprivs
ntpd - NTP daemon program - Ver. 4.2.7p475
Usage:  ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
                [ <server1> ... <serverN> ]
Try 'ntpd --help' for more information.
 failed!

How can I have the service run from /usr/local/sbin instead of /usr/sbin?

Solution (based on accepted answer):

Apparently when building on Linux you need to use the switch --enable-linuxcaps when building on Linux. Here are the steps necessary on Debian Wheezy:

cd ~/install/ntp-dev-4.2.7p475     # or wherever you have the source unpacked
make clean                         # clean out the previous build
sudo apt-get install libcap-dev    # this library is required by linuxcaps
./configure --enable-linuxcaps     # this is the critical switch
make
sudo make install
sudo /etc/init.d/ntp restart       # restart ntp
ntpq -c "rv 0 version"             # make sure you are running the right version

The only line you have change in /etc/init.d/ntp is the DAEMON line, as said above.

  • What distro are you running? – eyoung100 Sep 12 '14 at 18:26
4

You've built ntpd without the --enable-linuxcaps option. Without this, ntpd won't recognise the user option -u.

Your options are:

  • Recompile with the correct option

  • Remove the -u $UGID from the NTPD_OPTS line in /etc/init.d/ntp

  • That worked. I updated the question. – Tyler Durden Sep 12 '14 at 19:35
  • Congrats on getting to 5k. Keep up the good work! – slm Sep 16 '14 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.