tony359
Posts: 33
Joined: Mon Dec 21, 2015 9:59 pm
Location: Swindon, UK

issue compiling and installing latest NTP daemon

Mon Jan 18, 2016 6:40 pm

Hello everybody

I am not a massive Linux expert and I am having trouble installing the latest NTP daemon.
The package I can install via apt-get is 4.2.6 and I wanted to update it to the latest 4.2.8.

I found this link with instructions

http://www.satsignal.eu/ntp/Raspberry-P ... start.html

And I can see an additional option during CONFIGURE to be run with Jessie, which I should be running on my RPi 2.

However I can see some error codes and then the NTP doesn't load anymore.

I was wondering if anybody could help me?

Below my logs from Putty, I have separated the MAKE and MAKE INSTALL sections. I haven't got the CONFIGURE logs but I don't remember errors during that stage. I can re-run it again if needed.

https://www.dropbox.com/s/g36bhcqykndzr7g/pi.txt?dl=0

Any help appreciated!
Thanks
Antonio

User avatar
DougieLawson
Posts: 35790
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: issue compiling and installing latest NTP daemon

Mon Jan 18, 2016 9:08 pm

What's wrong with the stock standard version shipped with Raspbian? What will you gain by compiling from source?
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

tony359
Posts: 33
Joined: Mon Dec 21, 2015 9:59 pm
Location: Swindon, UK

Re: issue compiling and installing latest NTP daemon

Mon Jan 18, 2016 10:49 pm

Hi,

Well, let's say I thought it would have been easy! Also I read on ntp.org of vulnerabilities with some older versions and I thought the latest one would be the most suitable.

I could live with the stock version, let's see this as a sort of training as I am a Windows/DOS guy and I'd really like to improve my skills on Linux.

Can you help me?

Thanks
Tony

User avatar
DougieLawson
Posts: 35790
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: issue compiling and installing latest NTP daemon

Mon Jan 18, 2016 10:59 pm

So you want pulse per second support.

sudo -i
cd /tmp
wget http://archive.ntp.org/ntp4/ntp-4.2.8p3.tar.gz
tar xavf ntp-4.2.8p3.tar.gz
cd ntp*
./configure --enable-linuxcaps
make -j5
make install
reboot
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

tony359
Posts: 33
Joined: Mon Dec 21, 2015 9:59 pm
Location: Swindon, UK

Re: issue compiling and installing latest NTP daemon

Mon Jan 18, 2016 11:42 pm

Thanks for your help.

I think I did that before but I gave it another go. This time I removed the stock NTP first.

The only thing is that after MAKE and MAKE INSTALL I can see some errors which don't look like normal warnings:

Code: Select all

 CC       sntp.o
env CSET=`cat ./scm-rev` ./../scripts/build/mkver sntp
Version <sntp [email protected] Mon Jan 18 23:29:41 UTC 2016 (1)>
env CCACHE_DISABLE=1 gcc -DHAVE_CONFIG_H -I.  -I./../include -I./../lib/isc/incl                                       ude -I./../lib/isc/pthreads/include -I./../lib/isc/unix/include -I./libopts -I./                                       libevent/include -I./libevent/include   -ffunction-sections -fdata-sections -Wal                                       l -Wcast-align -Wcast-qual -Wmissing-prototypes -Wpointer-arith -Wshadow -Winit-                                       self -Wstrict-overflow   -Wstrict-prototypes -g -O2 -c version.c -o version.o
config.status: creating sntp.1+
mv sntp.1+ sntp.1
  CCLD     sntp
/usr/bin/ld: cannot find -lcap
collect2: error: ld returned 1 exit status
Makefile:894: recipe for target 'sntp' failed
make[4]: *** [sntp] Error 1
make[4]: Leaving directory '/home/pi/ntp-4.2.8p5/sntp'
Makefile:1056: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/pi/ntp-4.2.8p5/sntp'
Makefile:684: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/pi/ntp-4.2.8p5/sntp'
Makefile:666: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/pi/ntp-4.2.8p5'
Makefile:598: recipe for target 'all' failed
make: *** [all] Error 2
[email protected]:/home/pi/ntp-4.2.8p5#



make[4]: Leaving directory '/home/pi/ntp-4.2.8p5/sntp/tests'
make[4]: Entering directory '/home/pi/ntp-4.2.8p5/sntp'
  CCLD     sntp
/usr/bin/ld: cannot find -lcap
collect2: error: ld returned 1 exit status
Makefile:894: recipe for target 'sntp' failed
make[4]: *** [sntp] Error 1
make[4]: Leaving directory '/home/pi/ntp-4.2.8p5/sntp'
Makefile:1056: recipe for target 'install-recursive' failed
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory '/home/pi/ntp-4.2.8p5/sntp'
Makefile:1354: recipe for target 'install' failed
make[2]: *** [install] Error 2
make[2]: Leaving directory '/home/pi/ntp-4.2.8p5/sntp'
Makefile:666: recipe for target 'install-recursive' failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory '/home/pi/ntp-4.2.8p5'
Makefile:963: recipe for target 'install' failed
make: *** [install] Error 2
[email protected]:/home/pi/ntp-4.2.8p5#
Anyway I rebooted. But there is no more 'ntp' under /etc/init.d and I don't know how to start the daemon. Maybe something has changed with the latest versions, I'll have a look.

In the meantime if you can point me in the right direction I'd appreciate that! :)

Thanks
Tony

User avatar
DougieLawson
Posts: 35790
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: issue compiling and installing latest NTP daemon

Mon Jan 18, 2016 11:50 pm

sudo apt-get install libcap-dev
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

tony359
Posts: 33
Joined: Mon Dec 21, 2015 9:59 pm
Location: Swindon, UK

Re: issue compiling and installing latest NTP daemon

Tue Jan 19, 2016 12:07 am

I must be asking really basic questions - Thanks!

Errors have gone. I can now manually start the ntpd and I can query the ntpq and I have servers syncing. Which is great!

Only thing, the init file is still missing from /etc/init.d but I'll have a better look tomorrow morning, I understand the latest Raspbian is running systemd, I'll study it and see if I can start/stop the service from there and schedule it so it runs at boot.

Thank YOU very much for your patience! :)

tony359
Posts: 33
Joined: Mon Dec 21, 2015 9:59 pm
Location: Swindon, UK

Re: issue compiling and installing latest NTP daemon

Tue Jan 19, 2016 8:31 am

I may need a little more help here. I cannot find out how to manage the ntp service.
I understand I should be able to start it by typing

Code: Select all

systemctl start ntp.service
but that shows an error

Code: Select all

Failed to start ntpd.service: Unit ntpd.service failed to load: No such file or directory.
I can start ntpd manually by executing it but I can't manage it and all my researches have not helped so far. I'll keep searching but any help appreciated.

Thanks

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: issue compiling and installing latest NTP daemon

Wed Jan 20, 2016 6:34 am

Code: Select all

sudo systemctl start ntp
or

Code: Select all

sudo systemctl start ntpd
Account Inactive

tony359
Posts: 33
Joined: Mon Dec 21, 2015 9:59 pm
Location: Swindon, UK

Re: issue compiling and installing latest NTP daemon

Wed Jan 20, 2016 9:53 am

Hi,

As far as I understand, there is no ntp 'unit' available on my system. I have been searching and searching and I understand I have to create a sort of init file so be placed in /etc/systemd/system, then enable it.

So far I haven't figured out what to put inside that file though.

Here is my file so far.

Code: Select all

[Unit]
Description=Network Synchronisation Time service (NTP)
After=syslog.target network.target

[Service]
Type=forking
User=pi
PAMName=login
ExecStart=/usr/local/sbin/ntpd -g
ExecStop=/usr/local/sbin/ntpd -kill :%i

[Install]
WantedBy=multi-user.target

tony359
Posts: 33
Joined: Mon Dec 21, 2015 9:59 pm
Location: Swindon, UK

Re: issue compiling and installing latest NTP daemon

Wed Jan 20, 2016 4:54 pm

Hi guys

Just to keep the thread updated with my progress.

I have configured another Pi - the first one was my test bench.

What I ended up doing was to keep the 'shipped' NTP where it was. Then I compiled the new version and just overwrote the files (making backups first). I must say that that failed during my early tests last week but it ended up being a library missing, hence the compiler was failing and the file was not running.

Now all works and I am happily running the latest version of all files.

What puzzles me is that now the service is running, systemd is reporting it as available and running, something I couldn't achieve when I completely reinstalled NTP using apt-get.

Anyway the procedure is the following:

- Install Raspbian (update the distro if you like)

- INSTALL libraries
sudo apt-get install libcap-dev

- Download and compile the latest NTP (replace the link with what is available)
sudo wget http://archive.ntp.org/ntp4/ntp-4.2.8p4.tar.gz
tar zxvf ntp-4.2.8p4.tar.gz == OR == tar xavf ntp-4.2.8p3.tar.gz
cd ntp-4.2.8p4
sudo ./configure --enable-linuxcaps
sudo make -j5
sudo make install
sudo service ntp stop
sudo cp /usr/local/bin/ntp* /usr/bin/
sudo cp /usr/local/sbin/ntp* /usr/sbin /

Hope this helps! :)

Thanks for your help
Antonio

Slackware
Posts: 131
Joined: Mon Jan 18, 2016 3:45 pm

Re: issue compiling and installing latest NTP daemon

Thu Feb 04, 2016 4:12 am

Instead of copying all the ntp files you should just make links to them so you don't eat up disk space. Even better is just add your /usr/local/ to your path so it will find it there.

Return to “Raspbian”