Re: [chrony-users] Configuring chrony debian service - BBB

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


I fiddled around with chronyd.service gpsd.service and I think I have something that works. Both gpsd and chronyd start successfully on boot.

** chronyd.service **

[Unit]
Description=chrony, an NTP client/server
Documentation=man:chronyd(8) man:chronyc(1) man:chrony.conf(5)
Conflicts=systemd-timesyncd.service openntpd.service
After=multi-user.target
ConditionCapability=CAP_SYS_TIME

[Service]
Type=forking
PIDFile=/run/chronyd.pid
ExecStart=/usr/sbin/chronyd
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full

[Install]
Alias=chronyd.service
#WantedBy=multi-user.target

** gpsd.service **

[Unit]
Description=GPS (Global Positioning System) Daemon
#Requires=gpsd.socket
# Needed with chrony SOCK refclock
#After=chronyd.service

[Service]
EnvironmentFile=-/etc/default/gpsd
ExecStart=/usr/sbin/gpsd -N $GPSD_OPTIONS $DEVICES

[Install]
#Also=gpsd.socket
WantedBy=multi-user.target

On Wed, Nov 29, 2017 at 4:08 PM, Joe Smith <joe.smith@xxxxxxxxxxxxxxxxxxx> wrote:
My suspicions were correct. In looking at /var/log/syslog I can see that systemd is starting chronyd before the kernel has created the PPS device. Not sure how to prevent that.

On Wed, Nov 29, 2017 at 2:33 PM, Joe Smith <joe.smith@xxxxxxxxxxxxxxxxxxx> wrote:
I've rebuilt gpsd without pps support. Now I have only one pps device getting created at startup.

debian@beaglebone:~$ dmesg | grep pps
[    1.538059] pps_core: LinuxPPS API ver. 1 registered
[    1.538067] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@xxxxxxxx>
[   26.130179] pps pps0: new PPS source ocp:bs_pinmode_P9_12_0x27_pinm
[   26.130306] pps pps0: Registered IRQ 88 as PPS source

The issue now is that chronyd will not start up at boot time:

debian@beaglebone:~$ systemctl status chrony
● chrony.service - chrony, an NTP client/server
   Loaded: loaded (/lib/systemd/system/chrony.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2016-11-03 17:16:53 UTC; 2min 59s ago
     Docs: man:chronyd(8)
           man:chronyc(1)
           man:chrony.conf(5)
  Process: 572 ExecStart=/usr/sbin/chronyd (code=exited, status=1/FAILURE)

Nov 03 17:16:52 beaglebone systemd[1]: Starting chrony, an NTP client/server...
Nov 03 17:16:53 beaglebone chronyd[590]: chronyd version 3.2 starting (+CMDMON +NTP +REFCLOCK +RTC -PRIVDROP -SCFILTER -SECHA
Nov 03 17:16:53 beaglebone chronyd[590]: commandkey directive is no longer supported
Nov 03 17:16:53 beaglebone chronyd[572]: open() failed on /dev/pps0
Nov 03 17:16:53 beaglebone systemd[1]: chrony.service: Control process exited, code=exited status=1
Nov 03 17:16:53 beaglebone systemd[1]: Failed to start chrony, an NTP client/server.
Nov 03 17:16:53 beaglebone systemd[1]: chrony.service: Unit entered failed state.
Nov 03 17:16:53 beaglebone systemd[1]: chrony.service: Failed with result 'exit-code'.

I verified PPS with ppstest

debian@beaglebone:~$ sudo ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1478194022.222516784, sequence: 573 - clear  0.000000000, sequence: 0
source 0 - assert 1478194023.305849881, sequence: 574 - clear  0..000000000, sequence: 0
source 0 - assert 1478194024.389182301, sequence: 575 - clear  0.000000000, sequence: 0

If I then start chronyd manually using "sudo systemctl start chrony" it starts successfully and I can see both sources

debian@beaglebone:~$ chronyc sources
210 Number of sources = 2
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
#? NMEA                          0   4   377    11  +3819us[+3819us] +/-  106ms
#* PPS                           0   4   377    12   +417ns[ +732ns] +/- 1042ns

Only reason I can think of is that /dev/pps0 isn't there yet at the time systemd starts chronyd. Thoughts?



On Wed, Nov 29, 2017 at 10:47 AM, Joe Smith <joe.smith@xxxxxxxxxxxxxxxxxxx> wrote:
It's looking like I will need to recompile gpsd with pps=off as Lichvar suggested. I disabled the BeagleBone overlay for the GPIO pin that I was using for PPS and connected the PPS line to the CTS pin for UART4. That caused only one PPS source to be created for /dev/ttyS4

[    1.537951] pps_core: LinuxPPS API ver. 1 registered
[    1.537960] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@xxxxxxxx>
[   17.542045] pps_ldisc: PPS line discipline registered
[   17.543815] pps pps0: new PPS source serial4
[   17.543896] pps pps0: source "/dev/ttyS4" added

However chrony doesn't appear to be getting that PPS based on what I see using chrony sources

debian@beaglebone:~$ chronyc sources
210 Number of sources = 2
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
#? NMEA                          0   4   377    14   -9382h[ -9382h] +/-  107ms
#? PPS                           0   4     0     -     +0ns[   +0ns] +/-    0ns

Also, ppstest /dev/pps0 outputs errors

debian@beaglebone:~$ sudo ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out)



On Wed, Nov 29, 2017 at 9:39 AM, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
On Wed, Nov 29, 2017 at 08:51:33AM -0500, Joe Smith wrote:
> However, if gpsd is really what's giving me my problems then I'll ditch it
> and configure chrony to read the NMEA serial port directly. I'll just need
> to consult the documentation to figure out how to properly update
> chrony.conf for that.

chrony doesn't have an NMEA driver. If gpsd attaching the ldisc is
causing problems and there is no way to tell it to not do that, you
could recompile gpsd with pps=off. That should disable the PPS
support completely.

--
Miroslav Lichvar

--
To unsubscribe email chrony-users-request@xxxxxxxxxxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxfamily.org
with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxg.







Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/