Discussion:
[chrony-users] Configuring chrony debian service - BBB
Joe Smith
2017-11-27 15:16:58 UTC
Permalink
In setting up chrony on a BeagleBone Black, I initially pulled down the
package using apt-get but found that package is not built with PPS support.
That package from apt-get puts the chrony.conf file in /etc/chrony. However
when I built it from source and did the make install, chrony is looking for
chrony.conf in /etc. I think I prefer the file to be in /etc/chrony but
couldn't seem to figure out how to make that happen. I used what appeared
to be the right option in the configure script for specifying the location
of the config file but that didn't appear to have any affect. I ultimately
ended up creating a soft link in /etc in order to get things working.

Anybody have any tips on how to get this to work without creating the soft
link? I realize this may be more of a debian/linux question but I was not
able to determine from online resources how to do it. Since it was specific
to chrony I thought I'd ask in this forum. I'm not exactly a debian expert
or sys-admin so it's a little out of my depth. Thanks in advance.
Miroslav Lichvar
2017-11-27 15:31:41 UTC
Permalink
Post by Joe Smith
In setting up chrony on a BeagleBone Black, I initially pulled down the
package using apt-get but found that package is not built with PPS support.
That package from apt-get puts the chrony.conf file in /etc/chrony. However
when I built it from source and did the make install, chrony is looking for
chrony.conf in /etc. I think I prefer the file to be in /etc/chrony but
couldn't seem to figure out how to make that happen. I used what appeared
to be the right option in the configure script for specifying the location
of the config file but that didn't appear to have any affect. I ultimately
ended up creating a soft link in /etc in order to get things working.
The default location of chrony.conf can be specified before building
with the --sysconfdir option. In your case it should be:

./configure --sysconfdir=/etc/chrony

If that doesn't work, it's a bug.
--
Miroslav Lichvar
--
To unsubscribe email chrony-users-***@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-***@chrony.tuxfamily.org
with "help" in the subject.
Trouble? Email ***@chrony.tuxfamily.org.
Joe Smith
2017-11-27 16:00:17 UTC
Permalink
OK thanks. I believe that was the option I specified but I'll try it again
(I have the source for version 3.2). I recently loaded the latest BBB
debian image and already did an apt-get chrony. I will run the configure
script as follows:

./configure --prefix=/usr --sysconfdir=/etc/chrony

With the expection that this will configure the chrony binaries to get
installed in /usr/sbin (this is what the Installation web page indicates)
and the executable will look for chrony.conf in /etc/chrony. Then I'll run
a make install as root and see how it goes.

Maybe I just misspelled something last time.
Post by Joe Smith
Post by Joe Smith
In setting up chrony on a BeagleBone Black, I initially pulled down the
package using apt-get but found that package is not built with PPS
support.
Post by Joe Smith
That package from apt-get puts the chrony.conf file in /etc/chrony.
However
Post by Joe Smith
when I built it from source and did the make install, chrony is looking
for
Post by Joe Smith
chrony.conf in /etc. I think I prefer the file to be in /etc/chrony but
couldn't seem to figure out how to make that happen. I used what appeared
to be the right option in the configure script for specifying the
location
Post by Joe Smith
of the config file but that didn't appear to have any affect. I
ultimately
Post by Joe Smith
ended up creating a soft link in /etc in order to get things working.
The default location of chrony.conf can be specified before building
./configure --sysconfdir=/etc/chrony
If that doesn't work, it's a bug.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Joe Smith
2017-11-27 16:15:07 UTC
Permalink
Seems to be working now although I do get this warning/error from systemctl
status chrony

Wrong owner of /var/run/chrony (UID != 0)

Not sure that it's significant given that it seems to be running properly.
Post by Joe Smith
OK thanks. I believe that was the option I specified but I'll try it again
(I have the source for version 3.2). I recently loaded the latest BBB
debian image and already did an apt-get chrony. I will run the configure
./configure --prefix=/usr --sysconfdir=/etc/chrony
With the expection that this will configure the chrony binaries to get
installed in /usr/sbin (this is what the Installation web page indicates)
and the executable will look for chrony.conf in /etc/chrony. Then I'll run
a make install as root and see how it goes.
Maybe I just misspelled something last time.
Post by Joe Smith
Post by Joe Smith
In setting up chrony on a BeagleBone Black, I initially pulled down the
package using apt-get but found that package is not built with PPS
support.
Post by Joe Smith
That package from apt-get puts the chrony.conf file in /etc/chrony.
However
Post by Joe Smith
when I built it from source and did the make install, chrony is looking
for
Post by Joe Smith
chrony.conf in /etc. I think I prefer the file to be in /etc/chrony but
couldn't seem to figure out how to make that happen. I used what
appeared
Post by Joe Smith
to be the right option in the configure script for specifying the
location
Post by Joe Smith
of the config file but that didn't appear to have any affect. I
ultimately
Post by Joe Smith
ended up creating a soft link in /etc in order to get things working.
The default location of chrony.conf can be specified before building
./configure --sysconfdir=/etc/chrony
If that doesn't work, it's a bug.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Miroslav Lichvar
2017-11-27 16:44:34 UTC
Permalink
Post by Joe Smith
Seems to be working now although I do get this warning/error from systemctl
status chrony
Wrong owner of /var/run/chrony (UID != 0)
Not sure that it's significant given that it seems to be running properly.
That indicates the previous chronyd dropped root privileges (the owner
of /var/run/chrony is not root), but the new one is keeping them and
refusing to write to the directory. It will not be possible to use
chronyc to make changes in the configuration until you reboot or
remove the directory and restart chronyd.

You should either recompile chrony with the correct user specified by
the --with-user option, or specify the user with the -u option on
the chronyd command line or use the user directive in chrony.conf.
--
Miroslav Lichvar
--
To unsubscribe email chrony-users-***@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-***@chrony.tuxfamily.org
with "help" in the subject.
Trouble? Email ***@chrony.tuxfamily.org.
Joe Smith
2017-11-27 17:04:54 UTC
Permalink
It appears that the apt-get chrony package creates a _chrony user and
_chrony group for the daemon. That is the user that currently owns
/var/run/chrony. When I started chrony after building/installing from
source I did a "sudo systemctl start chrony" and the chronyd.exe process
that is running is owned by root. Given this, it looks like the best
course of action is probably to rebuild with the --with-user=_chrony
option. I'm assuming (possibly wrongly) that the daemon switches the user
to _chrony after it starts up if it's built with that option.
Post by Joe Smith
Post by Joe Smith
Seems to be working now although I do get this warning/error from
systemctl
Post by Joe Smith
status chrony
Wrong owner of /var/run/chrony (UID != 0)
Not sure that it's significant given that it seems to be running
properly.
That indicates the previous chronyd dropped root privileges (the owner
of /var/run/chrony is not root), but the new one is keeping them and
refusing to write to the directory. It will not be possible to use
chronyc to make changes in the configuration until you reboot or
remove the directory and restart chronyd.
You should either recompile chrony with the correct user specified by
the --with-user option, or specify the user with the -u option on
the chronyd command line or use the user directive in chrony.conf.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Joe Smith
2017-11-27 21:30:27 UTC
Permalink
Unfortunately chronyd doesn't appear to like that setting. Upon reboot it
complained that dropping root privileges was not supported. I rebuilt again
without it but now appear to be encountering other problems, more related
to BBB and debian I think. Seems like I can't seem to predict very well
what device gets assigned for PPS and why. When I started the setup process
the PPS was going to /dev/pps0 as I would expect. Then after my last reboot
it was getting assigned /dev/pps1 and it appears that device isn't ready at
the time chronyd is started by systemd so it has to be started up manually
using systemctl which is a no-go for my application. I posted to the
BeagleBone google group to see if anyone has ideas as to why. I'm
relatively sure it has to do with the startup order from systemd but I'm
not expert enough to know how to remedy it.

I want to thank you again for all of the help you've been providing (and
the patience). There are sooooo many deep technical details to all of this
that it's hard to come up to speed.
Post by Joe Smith
It appears that the apt-get chrony package creates a _chrony user and
_chrony group for the daemon. That is the user that currently owns
/var/run/chrony. When I started chrony after building/installing from
source I did a "sudo systemctl start chrony" and the chronyd.exe process
that is running is owned by root. Given this, it looks like the best
course of action is probably to rebuild with the --with-user=_chrony
option. I'm assuming (possibly wrongly) that the daemon switches the user
to _chrony after it starts up if it's built with that option.
Post by Joe Smith
Post by Joe Smith
Seems to be working now although I do get this warning/error from
systemctl
Post by Joe Smith
status chrony
Wrong owner of /var/run/chrony (UID != 0)
Not sure that it's significant given that it seems to be running
properly.
That indicates the previous chronyd dropped root privileges (the owner
of /var/run/chrony is not root), but the new one is keeping them and
refusing to write to the directory. It will not be possible to use
chronyc to make changes in the configuration until you reboot or
remove the directory and restart chronyd.
You should either recompile chrony with the correct user specified by
the --with-user option, or specify the user with the -u option on
the chronyd command line or use the user directive in chrony.conf.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Bill Unruh
2017-11-27 23:47:20 UTC
Permalink
Firstly, your problem was I believe that chrony as delivered by debian did not
support pps. You can make sure that it does by simply installing pps-tools by
debian and then recompiling the Debian chrony. Chrony looks for the file
/usr/include/sys/timepps.h and if it is theere it compiles with PPS support.
So just install pps-tools, and then do whatever you need to on debian to
recompile chrony source. (I use Mageia/rpm, and there a simple
rpmbuild --rebuild <chrony src rpm>
would recompile it with pps support. That might well solve the original
problem you had.
If pps0 is taken by something then the pps support in the kernel would use
pps1.
As you propose a link from /etc/chrony.conf to /etc/chrony/chrony.conf would
solve the problem of the location of chrony.conf.
Ie, since you are having loats of problems with compiling the latest chrony
going with the distribution's chrony is probably the easierst way to get it
disciplining your system.





William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____ ***@physics.ubc.ca
Canada V6T 1Z1 ____|____ and Gravity ______|_ www.theory.physics.ubc.ca/
Unfortunately chronyd doesn't appear to like that setting. Upon reboot it complained that dropping root privileges was not
supported. I rebuilt again without it but now appear to be encountering other problems, more related to BBB and debian I think.
Seems like I can't seem to predict very well what device gets assigned for PPS and why. When I started the setup process the PPS
was going to /dev/pps0 as I would expect. Then after my last reboot it was getting assigned /dev/pps1 and it appears that device
isn't ready at the time chronyd is started by systemd so it has to be started up manually using systemctl which is a no-go for
my application. I posted to the BeagleBone google group to see if anyone has ideas as to why. I'm relatively sure it has to do
with the startup order from systemd but I'm not expert enough to know how to remedy it.
I want to thank you again for all of the help you've been providing (and the patience). There are sooooo many deep technical
details to all of this that it's hard to come up to speed.
It appears that the apt-get chrony package creates a _chrony user and _chrony group for the daemon. That is the user
that currently owns /var/run/chrony. When I started chrony after building/installing from source I did a "sudo
systemctl start chrony" and the chronyd.exe process that is running is owned by root.  Given this, it looks like the
best course of action is probably to rebuild with the --with-user=_chrony option. I'm assuming (possibly wrongly)
that the daemon switches the user to _chrony after it starts up if it's built with that option.
Post by Joe Smith
Seems to be working now although I do get this warning/error from systemctl
status chrony
Wrong owner of /var/run/chrony (UID != 0)
Not sure that it's significant given that it seems to be running properly.
That indicates the previous chronyd dropped root privileges (the owner
of /var/run/chrony is not root), but the new one is keeping them and
refusing to write to the directory. It will not be possible to use
chronyc to make changes in the configuration until you reboot or
remove the directory and restart chronyd.
You should either recompile chrony with the correct user specified by
the --with-user option, or specify the user with the -u option on
the chronyd command line or use the user directive in chrony.conf.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Joe Smith
2017-11-28 03:57:01 UTC
Permalink
Bill,

Thanks for your response. I actually did basically what you suggested prior
to my post.


- Loaded latest BBB debian image onto the BeagleBone eMMC.
- Compiled NF3H-PPS-00A0.dts file into a .dtbo file in /lib/firmware
- Updated /boot/uEnv.txt to pull in NF3H-PPS-00A0.dtbo and
BB-UART4-00A0.dtbo into U-Boot configuration
- Rebooted
- apt-get update
- apt-get upgrade
- apt-get dist-upgrade
- apt-get autoremove
- apt-get autoclean
- apt-get install man-db
- apt-get install pps-tools

At this point I could see I was getting PPS pulses on /dev/pps0 using
ppstest


- apt-get install gpsd
- apt-get install gpsd-clients
- systemctl disable gpsd.socket
- systemctl stop gpsd.service
- Made edits to /etc/default/gpsd and /lib/system/gpsd.service
- systemctl daemon-reload
- systemctl start gpsd.service

At this point I was able to verify PPS pulses on /dev/pps0 and valid NMEA
data coming in on /dev/ttyS4 (using cgps)


- apt-get install chrony
- systemctl stop chrony
- In chrony source directory...
- ./configure --prefix=/usr --sysconfdir=/etc/chrony (this set up
chronyd.exe to point to /etc/chrony/chrony.conf)
- make install

Upon my next reboot I found that chrony didn't start. Complaining about
/dev/pps0
Checked /dev/pps1 and saw that pulses were now coming in there
Changed chrony.conf to use /dev/pps1
Rebooted
Saw using systemctl status chrony that the daemon didn't start because it
couldn't access /dev/pps1
Verified I was getting PPS pulses on /dev/pps1 using ppstest
Started chrony using systemctl start chrony
Saw using systemctl status chrony that the daemon started successfully
Examined dmesg output to verify pps1

I'm not entirely sure what step along the way the PPS switched over to
/dev/pps1. All I can tell right now is that once that happens chrony won't
start during boot due to it not being able to access /dev/pps1 at the time
systemd starts it (or so it seems). My plan is to take this BBB back to the
base BBB debian image again and do reboots after each step (after
installing pps-tools), checking PPS after each reboot to try an isolate
what step seems to cause the switchover. My hope is that once I isolate
that I will be able to figure out what needs to change to get chrony to
start successfully on reboot/power-cycle.
Post by Bill Unruh
Firstly, your problem was I believe that chrony as delivered by debian did not
support pps. You can make sure that it does by simply installing pps-tools by
debian and then recompiling the Debian chrony. Chrony looks for the file
/usr/include/sys/timepps.h and if it is theere it compiles with PPS support.
So just install pps-tools, and then do whatever you need to on debian to
recompile chrony source. (I use Mageia/rpm, and there a simple rpmbuild
--rebuild <chrony src rpm> would recompile it with pps support. That might
well solve the original
problem you had.
If pps0 is taken by something then the pps support in the kernel would use
pps1.
As you propose a link from /etc/chrony.conf to /etc/chrony/chrony.conf would
solve the problem of the location of chrony.conf.
Ie, since you are having loats of problems with compiling the latest chrony
going with the distribution's chrony is probably the easierst way to get it
disciplining your system.
William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
Canada V6T 1Z1 ____|____ and Gravity ______|_ www.theory.physics.ubc.ca/
Unfortunately chronyd doesn't appear to like that setting. Upon reboot it
Post by Joe Smith
complained that dropping root privileges was not
supported. I rebuilt again without it but now appear to be encountering
other problems, more related to BBB and debian I think.
Seems like I can't seem to predict very well what device gets assigned
for PPS and why. When I started the setup process the PPS
was going to /dev/pps0 as I would expect. Then after my last reboot it
was getting assigned /dev/pps1 and it appears that device
isn't ready at the time chronyd is started by systemd so it has to be
started up manually using systemctl which is a no-go for
my application. I posted to the BeagleBone google group to see if anyone
has ideas as to why. I'm relatively sure it has to do
with the startup order from systemd but I'm not expert enough to know how to remedy it.
I want to thank you again for all of the help you've been providing (and
the patience). There are sooooo many deep technical
details to all of this that it's hard to come up to speed.
On Mon, Nov 27, 2017 at 12:04 PM, Joe Smith <
It appears that the apt-get chrony package creates a _chrony user
and _chrony group for the daemon. That is the user
that currently owns /var/run/chrony. When I started chrony after
building/installing from source I did a "sudo
systemctl start chrony" and the chronyd.exe process that is running
is owned by root. Given this, it looks like the
best course of action is probably to rebuild with the
--with-user=_chrony option. I'm assuming (possibly wrongly)
that the daemon switches the user to _chrony after it starts up if
it's built with that option.
Post by Joe Smith
Seems to be working now although I do get this warning/error from
systemctl
Post by Joe Smith
status chrony
Wrong owner of /var/run/chrony (UID != 0)
Not sure that it's significant given that it seems to be running
properly.
That indicates the previous chronyd dropped root privileges (the owner
of /var/run/chrony is not root), but the new one is keeping them and
refusing to write to the directory. It will not be possible to use
chronyc to make changes in the configuration until you reboot or
remove the directory and restart chronyd.
You should either recompile chrony with the correct user specified by
the --with-user option, or specify the user with the -u option on
the chronyd command line or use the user directive in chrony.conf.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Bill Unruh
2017-11-28 09:21:44 UTC
Permalink
Not sure why you use gpsd. If you are using the serial port, just doing (or
setting up a script in /etc/init.d and /etc/rc?.d to do an
ldattach 18 /dev/ttyS0
should work to set up /dev/pps0 and chrony can then use that.

(Or is your pps attached elsewhere).
And then put
refclock PPS /dev/pps0
into chrony.conf.




William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____ ***@physics.ubc.ca
Canada V6T 1Z1 ____|____ and Gravity ______|_ www.theory.physics.ubc.ca/
Bill,
Thanks for your response. I actually did basically what you suggested prior to my post.
* Loaded latest BBB debian image onto the BeagleBone eMMC.
* Compiled NF3H-PPS-00A0.dts file into a .dtbo file in /lib/firmware
* Updated /boot/uEnv.txt to pull in NF3H-PPS-00A0.dtbo and BB-UART4-00A0.dtbo into U-Boot configuration
* Rebooted
* apt-get update
* apt-get upgrade
* apt-get dist-upgrade
* apt-get autoremove
* apt-get autoclean
* apt-get install man-db
* apt-get install pps-tools
That should be installed before you try to recompile chrony. In particular,
you need the /usr/include/sys/timepps.h for chorny to compile in pps.

You can also use gpsd to handle the pps, and it will feed the pps times into
a shared memory.
At this point I could see I was getting PPS pulses on /dev/pps0 using ppstest
* apt-get install gpsd
Why?
* apt-get install gpsd-clients
* systemctl disable gpsd.socket
* systemctl stop gpsd.service
* Made edits to /etc/default/gpsd and /lib/system/gpsd.service
* systemctl daemon-reload
* systemctl start gpsd.service
At this point I was able to verify PPS pulses on /dev/pps0 and valid NMEA data coming in on /dev/ttyS4 (using cgps)
* apt-get install chrony
* systemctl stop chrony
* In chrony source directory...
+  ./configure --prefix=/usr --sysconfdir=/etc/chrony  (this set up chronyd.exe to point to /etc/chrony/chrony.conf)
+ make install
Upon my next reboot I found that chrony didn't start. Complaining about /dev/pps0
I think gpsd may be grabbing pps0.
Checked /dev/pps1 and saw that pulses were now coming in there
Changed chrony.conf to use /dev/pps1
Rebooted
Saw using systemctl status chrony that the daemon didn't start because it couldn't access /dev/pps1
Verified I was getting PPS pulses on /dev/pps1 using ppstest
Started chrony using systemctl start chrony
Saw using systemctl status chrony that the daemon started successfully
Examined dmesg output to verify pps1
I'm not entirely sure what step along the way the PPS switched over to /dev/pps1. All I can tell right now is that once that
happens chrony won't start during boot due to it not being able to access /dev/pps1 at the time systemd starts it (or so it
seems). My plan is to take this BBB back to the base BBB debian image again and do reboots after each step (after installing
pps-tools), checking PPS after each reboot to try an isolate what step seems to cause the switchover. My hope is that once I
isolate that I will be able to figure out what needs to change to get chrony to start successfully on reboot/power-cycle.
TRy not starting gpsd.
Firstly, your problem was I believe that chrony as delivered by debian did not
support pps. You can make sure that it does by simply installing pps-tools by
debian and then recompiling the Debian chrony. Chrony looks for the file
/usr/include/sys/timepps.h and if it is theere it compiles with PPS support.
So just install pps-tools, and then do whatever you need to on debian to
recompile chrony source. (I use Mageia/rpm, and there a simple rpmbuild --rebuild <chrony src rpm> would recompile
it with pps support. That might well solve the original
problem you had.
If pps0 is taken by something then the pps support in the kernel would use
pps1.
As you propose a link from /etc/chrony.conf to /etc/chrony/chrony.conf would
solve the problem of the location of chrony.conf.
Ie, since you are having loats of problems with compiling the latest chrony
going with the distribution's chrony is probably the easierst way to get it
disciplining your system.
William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
Canada V6T 1Z1 ____|____ and Gravity ______|_ www.theory.physics.ubc.ca/
Unfortunately chronyd doesn't appear to like that setting. Upon reboot it complained that dropping root
privileges was not
supported. I rebuilt again without it but now appear to be encountering other problems, more related to
BBB and debian I think.
Seems like I can't seem to predict very well what device gets assigned for PPS and why. When I started
the setup process the PPS
was going to /dev/pps0 as I would expect. Then after my last reboot it was getting assigned /dev/pps1
and it appears that device
isn't ready at the time chronyd is started by systemd so it has to be started up manually using
systemctl which is a no-go for
my application. I posted to the BeagleBone google group to see if anyone has ideas as to why. I'm
relatively sure it has to do
with the startup order from systemd but I'm not expert enough to know how to remedy it.
I want to thank you again for all of the help you've been providing (and the patience). There are sooooo
many deep technical
details to all of this that it's hard to come up to speed.
      It appears that the apt-get chrony package creates a _chrony user and _chrony group for the
daemon. That is the user
      that currently owns /var/run/chrony. When I started chrony after building/installing from source I
did a "sudo
      systemctl start chrony" and the chronyd.exe process that is running is owned by root.  Given this,
it looks like the
      best course of action is probably to rebuild with the --with-user=_chrony option. I'm assuming
(possibly wrongly)
      that the daemon switches the user to _chrony after it starts up if it's built with that option.
      > Seems to be working now although I do get this warning/error from systemctl
      > status chrony
      >
      > Wrong owner of /var/run/chrony (UID != 0)
      >
      > Not sure that it's significant given that it seems to be running properly.
      That indicates the previous chronyd dropped root privileges (the owner
      of /var/run/chrony is not root), but the new one is keeping them and
      refusing to write to the directory. It will not be possible to use
      chronyc to make changes in the configuration until you reboot or
      remove the directory and restart chronyd.
      You should either recompile chrony with the correct user specified by
      the --with-user option, or specify the user with the -u option on
      the chronyd command line or use the user directive in chrony.conf.
      --
      Miroslav Lichvar
      --
      with "unsubscribe" in the subject.
      with "help" in the subject.
Joe Smith
2017-11-28 14:33:45 UTC
Permalink
All of the online resources that I found for building a GPS NTP server
indicated to install and use gpsd. I have the UART4 (/dev/ttyS4) mapped via
a U-Boot overlay. I believe using gpsd and gpsd-clients allows me to easily
verify that I'm getting good GPS data, 3D Fix, etc.

My PPS signal comes from the AdaFruit Ultimate GPS Breakout board that I
have connected to my BeagleBone Black. That board has Tx/Rx pins and a PPS
output.

My /etc/default/gpsd file contains the following. It seems like it should
be just using /dev/ttyS4 for the serial NMEA data but you may very well be
right that it's assigning /dev/ttyS4 as a source for pps0 given what I see
in the dmesg output. Maybe just something I have wrong/missing in
/etc/default/gpsd

# Default settings for the gpsd init script and the hotplug wrapper.

# Start the gpsd daemon automatically at boot time
START_DAEMON="true"

# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="false"

# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyS4"

# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"
Post by Bill Unruh
Not sure why you use gpsd. If you are using the serial port, just doing (or
setting up a script in /etc/init.d and /etc/rc?.d to do an ldattach 18
/dev/ttyS0 should work to set up /dev/pps0 and chrony can then use that.
(Or is your pps attached elsewhere).
And then put
refclock PPS /dev/pps0
into chrony.conf.
William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
Canada V6T 1Z1 ____|____ and Gravity ______|_ www.theory.physics.ubc.ca/
Bill,
Thanks for your response. I actually did basically what you suggested prior to my post.
* Loaded latest BBB debian image onto the BeagleBone eMMC.
* Compiled NF3H-PPS-00A0.dts file into a .dtbo file in /lib/firmware
* Updated /boot/uEnv.txt to pull in NF3H-PPS-00A0.dtbo and
BB-UART4-00A0.dtbo into U-Boot configuration
* Rebooted
* apt-get update
* apt-get upgrade
* apt-get dist-upgrade
* apt-get autoremove
* apt-get autoclean
* apt-get install man-db
* apt-get install pps-tools
That should be installed before you try to recompile chrony. In particular,
you need the /usr/include/sys/timepps.h for chorny to compile in pps.
You can also use gpsd to handle the pps, and it will feed the pps times into
a shared memory.
At this point I could see I was getting PPS pulses on /dev/pps0 using
ppstest
* apt-get install gpsd
Why?
* apt-get install gpsd-clients
* systemctl disable gpsd.socket
* systemctl stop gpsd.service
* Made edits to /etc/default/gpsd and /lib/system/gpsd.service
* systemctl daemon-reload
* systemctl start gpsd.service
At this point I was able to verify PPS pulses on /dev/pps0 and valid NMEA
data coming in on /dev/ttyS4 (using cgps)
* apt-get install chrony
* systemctl stop chrony
* In chrony source directory...
+ ./configure --prefix=/usr --sysconfdir=/etc/chrony (this set up
chronyd.exe to point to /etc/chrony/chrony.conf)
+ make install
Upon my next reboot I found that chrony didn't start. Complaining about /dev/pps0
I think gpsd may be grabbing pps0.
Checked /dev/pps1 and saw that pulses were now coming in there
Changed chrony.conf to use /dev/pps1
Rebooted
Saw using systemctl status chrony that the daemon didn't start because it
couldn't access /dev/pps1
Verified I was getting PPS pulses on /dev/pps1 using ppstest
Started chrony using systemctl start chrony
Saw using systemctl status chrony that the daemon started successfully
Examined dmesg output to verify pps1
I'm not entirely sure what step along the way the PPS switched over to
/dev/pps1. All I can tell right now is that once that
happens chrony won't start during boot due to it not being able to access
/dev/pps1 at the time systemd starts it (or so it
seems). My plan is to take this BBB back to the base BBB debian image
again and do reboots after each step (after installing
pps-tools), checking PPS after each reboot to try an isolate what step
seems to cause the switchover. My hope is that once I
isolate that I will be able to figure out what needs to change to get
chrony to start successfully on reboot/power-cycle.
TRy not starting gpsd.
Firstly, your problem was I believe that chrony as delivered by debian did not
support pps. You can make sure that it does by simply installing pps-tools by
debian and then recompiling the Debian chrony. Chrony looks for the file
/usr/include/sys/timepps.h and if it is theere it compiles with PPS support.
So just install pps-tools, and then do whatever you need to on debian to
recompile chrony source. (I use Mageia/rpm, and there a simple
rpmbuild --rebuild <chrony src rpm> would recompile
it with pps support. That might well solve the original
problem you had.
If pps0 is taken by something then the pps support in the kernel would use
pps1.
As you propose a link from /etc/chrony.conf to
/etc/chrony/chrony.conf would
solve the problem of the location of chrony.conf.
Ie, since you are having loats of problems with compiling the latest chrony
going with the distribution's chrony is probably the easierst way to get it
disciplining your system.
+1(604)822-3273
+1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____
Canada V6T 1Z1 ____|____ and Gravity ______|_
www.theory.physics.ubc.ca/
Unfortunately chronyd doesn't appear to like that setting.
Upon reboot it complained that dropping root
privileges was not
supported. I rebuilt again without it but now appear to be
encountering other problems, more related to
BBB and debian I think.
Seems like I can't seem to predict very well what device gets
assigned for PPS and why. When I started
the setup process the PPS
was going to /dev/pps0 as I would expect. Then after my last
reboot it was getting assigned /dev/pps1
and it appears that device
isn't ready at the time chronyd is started by systemd so it
has to be started up manually using
systemctl which is a no-go for
my application. I posted to the BeagleBone google group to
see if anyone has ideas as to why. I'm
relatively sure it has to do
with the startup order from systemd but I'm not expert enough
to know how to remedy it.
I want to thank you again for all of the help you've been
providing (and the patience). There are sooooo
many deep technical
details to all of this that it's hard to come up to speed.
On Mon, Nov 27, 2017 at 12:04 PM, Joe Smith <
It appears that the apt-get chrony package creates a
_chrony user and _chrony group for the
daemon. That is the user
that currently owns /var/run/chrony. When I started
chrony after building/installing from source I
did a "sudo
systemctl start chrony" and the chronyd.exe process
that is running is owned by root. Given this,
it looks like the
best course of action is probably to rebuild with the
--with-user=_chrony option. I'm assuming
(possibly wrongly)
that the daemon switches the user to _chrony after it
starts up if it's built with that option.
On Mon, Nov 27, 2017 at 11:44 AM, Miroslav Lichvar <
Post by Joe Smith
Seems to be working now although I do get this
warning/error from systemctl
Post by Joe Smith
status chrony
Wrong owner of /var/run/chrony (UID != 0)
Not sure that it's significant given that it seems to
be running properly.
That indicates the previous chronyd dropped root privileges (the owner
of /var/run/chrony is not root), but the new one is keeping them and
refusing to write to the directory. It will not be possible to use
chronyc to make changes in the configuration until you reboot or
remove the directory and restart chronyd.
You should either recompile chrony with the correct user specified by
the --with-user option, or specify the user with the -u option on
the chronyd command line or use the user directive in chrony.conf.
--
Miroslav Lichvar
--
xfamily.org
with "unsubscribe" in the subject.
xfamily.org
with "help" in the subject.
Bill Unruh
2017-11-29 01:23:59 UTC
Permalink
All of the online resources that I found for building a GPS NTP server indicated to install and use gpsd. I have the UART4
(/dev/ttyS4) mapped via a U-Boot overlay. I believe using gpsd and gpsd-clients allows me to easily verify that I'm getting good
GPS data, 3D Fix, etc.
My PPS signal comes from the AdaFruit Ultimate GPS Breakout board that I have connected to my BeagleBone Black. That board has
Tx/Rx pins and a PPS output.
My /etc/default/gpsd file contains the following. It seems like it should be just using /dev/ttyS4 for the serial NMEA data but
you may very well be right that it's assigning /dev/ttyS4 as a source for pps0 given what I see in the dmesg output. Maybe just
something I have wrong/missing in /etc/default/gpsd
The assignment of the /dev/pps? numbers has nothing to do with chrony or gpsd,
or any other user space program. It is assigned by the kernel depending on
what order the drivers request a device number from the kernel. Ie, it is long
before anything else happens. But I have no idea why you have two devices. You
have one pps signal I thought, and if you have two pps drivers they will fight
each other and make your timing much worse. soetimes one, sometimes the other
will get the interrupt first.

So I ask again, why are you using two interrupts?

Furthermore, chrony has the ability to driectly use the pps signal. It does
not need gpsd. I do not run gpsd, and chrony disciplnes my clock to of the
order of 1 microsecond.
# Default settings for the gpsd init script and the hotplug wrapper.
It does not matter.
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"
# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="false"
# Devices gpsd should collect to at boot time.
^^^^^^^^ I assume that should be "coonnect"
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttyS4"
# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"
Not sure why you use gpsd. If you are using the serial port, just doing (or
setting up a script in /etc/init.d and /etc/rc?.d to do an ldattach 18 /dev/ttyS0 should work to set up /dev/pps0
and chrony can then use that.
(Or is your pps attached elsewhere).
And then put
refclock PPS /dev/pps0
into chrony.conf.
William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
Canada V6T 1Z1 ____|____ and Gravity ______|_ www.theory.physics.ubc.ca/
Bill,
Thanks for your response. I actually did basically what you suggested prior to my post.
 *  Loaded latest BBB debian image onto the BeagleBone eMMC.
 *  Compiled NF3H-PPS-00A0.dts file into a .dtbo file in /lib/firmware
 *  Updated /boot/uEnv.txt to pull in NF3H-PPS-00A0.dtbo and BB-UART4-00A0.dtbo into U-Boot
configuration
 *  Rebooted
 *  apt-get update
 *  apt-get upgrade
 *  apt-get dist-upgrade
 *  apt-get autoremove
 *  apt-get autoclean
 *  apt-get install man-db
 *  apt-get install pps-tools
That should be installed before you try to recompile chrony. In particular,
you need the /usr/include/sys/timepps.h for chorny to compile in pps.
You can also use gpsd to handle the pps, and it will feed the pps times into
a shared memory.
At this point I could see I was getting PPS pulses on /dev/pps0 using ppstest
 *  apt-get install gpsd
Why?
 *  apt-get install gpsd-clients
 *  systemctl disable gpsd.socket
 *  systemctl stop gpsd.service
 *  Made edits to /etc/default/gpsd and /lib/system/gpsd.service
 *  systemctl daemon-reload
 *  systemctl start gpsd.service
At this point I was able to verify PPS pulses on /dev/pps0 and valid NMEA data coming in on /dev/ttyS4
(using cgps)
 *  apt-get install chrony
 *  systemctl stop chrony
 *  In chrony source directory...
     +   ./configure --prefix=/usr --sysconfdir=/etc/chrony  (this set up chronyd.exe to point to
/etc/chrony/chrony.conf)
     +  make install
Upon my next reboot I found that chrony didn't start. Complaining about /dev/pps0
I think gpsd may be grabbing pps0.
Checked /dev/pps1 and saw that pulses were now coming in there
Changed chrony.conf to use /dev/pps1
Rebooted
Saw using systemctl status chrony that the daemon didn't start because it couldn't access /dev/pps1
Verified I was getting PPS pulses on /dev/pps1 using ppstest
Started chrony using systemctl start chrony
Saw using systemctl status chrony that the daemon started successfully
Examined dmesg output to verify pps1
I'm not entirely sure what step along the way the PPS switched over to /dev/pps1. All I can tell right
now is that once that
happens chrony won't start during boot due to it not being able to access /dev/pps1 at the time systemd
starts it (or so it
seems). My plan is to take this BBB back to the base BBB debian image again and do reboots after each
step (after installing
pps-tools), checking PPS after each reboot to try an isolate what step seems to cause the switchover. My
hope is that once I
isolate that I will be able to figure out what needs to change to get chrony to start successfully on
reboot/power-cycle.
TRy not starting gpsd.
      Firstly, your problem was I believe that chrony as delivered by debian did not
      support pps. You can make sure that it does by simply installing pps-tools by
      debian and then recompiling the Debian chrony. Chrony looks for the file
      /usr/include/sys/timepps.h and if it is theere it compiles with PPS support.
      So just install pps-tools, and then do whatever you need to on debian to
      recompile chrony source. (I use Mageia/rpm, and there a simple rpmbuild --rebuild <chrony src rpm>
would recompile
      it with pps support. That might well solve the original
      problem you had.
      If pps0 is taken by something then the pps support in the kernel would use
      pps1.
      As you propose a link from /etc/chrony.conf to /etc/chrony/chrony.conf would
      solve the problem of the location of chrony.conf.
      Ie, since you are having loats of problems with compiling the latest chrony
      going with the distribution's chrony is probably the easierst way to get it
      disciplining your system.
      William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
      Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
      Canada V6T 1Z1 ____|____ and Gravity ______|_ www.theory.physics.ubc.ca/
            Unfortunately chronyd doesn't appear to like that setting. Upon reboot it complained that
dropping root
            privileges was not
            supported. I rebuilt again without it but now appear to be encountering other problems, more
related to
            BBB and debian I think.
            Seems like I can't seem to predict very well what device gets assigned for PPS and why. When
I started
            the setup process the PPS
            was going to /dev/pps0 as I would expect. Then after my last reboot it was getting assigned
/dev/pps1
            and it appears that device
            isn't ready at the time chronyd is started by systemd so it has to be started up manually
using
            systemctl which is a no-go for
            my application. I posted to the BeagleBone google group to see if anyone has ideas as to
why. I'm
            relatively sure it has to do
            with the startup order from systemd but I'm not expert enough to know how to remedy it.
            I want to thank you again for all of the help you've been providing (and the patience).
There are sooooo
            many deep technical
            details to all of this that it's hard to come up to speed.
                  It appears that the apt-get chrony package creates a _chrony user and _chrony group
for the
            daemon. That is the user
                  that currently owns /var/run/chrony. When I started chrony after building/installing
from source I
            did a "sudo
                  systemctl start chrony" and the chronyd.exe process that is running is owned by root. 
Given this,
            it looks like the
                  best course of action is probably to rebuild with the --with-user=_chrony option. I'm
assuming
            (possibly wrongly)
                  that the daemon switches the user to _chrony after it starts up if it's built with
that option.
                  > Seems to be working now although I do get this warning/error from systemctl
                  > status chrony
                  >
                  > Wrong owner of /var/run/chrony (UID != 0)
                  >
                  > Not sure that it's significant given that it seems to be running properly.
                  That indicates the previous chronyd dropped root privileges (the owner
                  of /var/run/chrony is not root), but the new one is keeping them and
                  refusing to write to the directory. It will not be possible to use
                  chronyc to make changes in the configuration until you reboot or
                  remove the directory and restart chronyd.
                  You should either recompile chrony with the correct user specified by
                  the --with-user option, or specify the user with the -u option on
                  the chronyd command line or use the user directive in chrony.conf.
                  --
                  Miroslav Lichvar
                  --
                  with "unsubscribe" in the subject.
                  with "help" in the subject.
Joe Smith
2017-11-29 13:51:33 UTC
Permalink
I wasn't deliberately trying to use two interrupts, but perhaps something I
did along the way introduced that.

I'm OK with not using gpsd if that's what's getting in my way here. The use
of gpsd was really just driven by online examples that were doing exactly
what I'm trying to do (create a compact, GPS driven NTP server using a
BeagleBone Black with an AdaFruit Ultimate GPS breakout board). Having the
ability to check the GPS data using cgps is convenient. That way I don't
have to visually inspect the NMEA data coming in on the serial port.
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.
Post by Joe Smith
All of the online resources that I found for building a GPS NTP server
Post by Joe Smith
indicated to install and use gpsd. I have the UART4
(/dev/ttyS4) mapped via a U-Boot overlay. I believe using gpsd and
gpsd-clients allows me to easily verify that I'm getting good
GPS data, 3D Fix, etc.
My PPS signal comes from the AdaFruit Ultimate GPS Breakout board that I
have connected to my BeagleBone Black. That board has
Tx/Rx pins and a PPS output.
My /etc/default/gpsd file contains the following. It seems like it should
be just using /dev/ttyS4 for the serial NMEA data but
you may very well be right that it's assigning /dev/ttyS4 as a source for
pps0 given what I see in the dmesg output. Maybe just
something I have wrong/missing in /etc/default/gpsd
The assignment of the /dev/pps? numbers has nothing to do with chrony or gpsd,
or any other user space program. It is assigned by the kernel depending on
what order the drivers request a device number from the kernel. Ie, it is long
before anything else happens. But I have no idea why you have two devices. You
have one pps signal I thought, and if you have two pps drivers they will fight
each other and make your timing much worse. soetimes one, sometimes the other
will get the interrupt first.
So I ask again, why are you using two interrupts?
Furthermore, chrony has the ability to driectly use the pps signal. It does
not need gpsd. I do not run gpsd, and chrony disciplnes my clock to of the
order of 1 microsecond.
Post by Joe Smith
# Default settings for the gpsd init script and the hotplug wrapper.
It does not matter.
Post by Joe Smith
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"
# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="false"
# Devices gpsd should collect to at boot time.
^^^^^^^^ I assume that should be "coonnect"
# They need to be read/writeable, either by user gpsd or the group dialout.
Post by Joe Smith
DEVICES="/dev/ttyS4"
# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"
Not sure why you use gpsd. If you are using the serial port, just doing (or
setting up a script in /etc/init.d and /etc/rc?.d to do an ldattach
18 /dev/ttyS0 should work to set up /dev/pps0
and chrony can then use that.
(Or is your pps attached elsewhere).
And then put
refclock PPS /dev/pps0
into chrony.conf.
+1(604)822-3273
+1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____
Canada V6T 1Z1 ____|____ and Gravity ______|_
www.theory.physics.ubc.ca/
Bill,
Thanks for your response. I actually did basically what you
suggested prior to my post.
* Loaded latest BBB debian image onto the BeagleBone eMMC.
* Compiled NF3H-PPS-00A0.dts file into a .dtbo file in /lib/firmware
* Updated /boot/uEnv.txt to pull in NF3H-PPS-00A0.dtbo and
BB-UART4-00A0.dtbo into U-Boot
configuration
* Rebooted
* apt-get update
* apt-get upgrade
* apt-get dist-upgrade
* apt-get autoremove
* apt-get autoclean
* apt-get install man-db
* apt-get install pps-tools
That should be installed before you try to recompile chrony. In particular,
you need the /usr/include/sys/timepps.h for chorny to compile in pps.
You can also use gpsd to handle the pps, and it will feed the pps times into
a shared memory.
At this point I could see I was getting PPS pulses on /dev/pps0 using ppstest
* apt-get install gpsd
Why?
* apt-get install gpsd-clients
* systemctl disable gpsd.socket
* systemctl stop gpsd.service
* Made edits to /etc/default/gpsd and
/lib/system/gpsd.service
* systemctl daemon-reload
* systemctl start gpsd.service
At this point I was able to verify PPS pulses on /dev/pps0
and valid NMEA data coming in on /dev/ttyS4
(using cgps)
* apt-get install chrony
* systemctl stop chrony
* In chrony source directory...
+ ./configure --prefix=/usr --sysconfdir=/etc/chrony
(this set up chronyd.exe to point to
/etc/chrony/chrony.conf)
+ make install
Upon my next reboot I found that chrony didn't start.
Complaining about /dev/pps0
I think gpsd may be grabbing pps0.
Checked /dev/pps1 and saw that pulses were now coming in there
Changed chrony.conf to use /dev/pps1
Rebooted
Saw using systemctl status chrony that the daemon didn't
start because it couldn't access /dev/pps1
Verified I was getting PPS pulses on /dev/pps1 using ppstest
Started chrony using systemctl start chrony
Saw using systemctl status chrony that the daemon started successfully
Examined dmesg output to verify pps1
I'm not entirely sure what step along the way the PPS
switched over to /dev/pps1. All I can tell right
now is that once that
happens chrony won't start during boot due to it not being
able to access /dev/pps1 at the time systemd
starts it (or so it
seems). My plan is to take this BBB back to the base BBB
debian image again and do reboots after each
step (after installing
pps-tools), checking PPS after each reboot to try an isolate
what step seems to cause the switchover. My
hope is that once I
isolate that I will be able to figure out what needs to
change to get chrony to start successfully on
reboot/power-cycle.
TRy not starting gpsd.
On Mon, Nov 27, 2017 at 6:47 PM, Bill Unruh <
Firstly, your problem was I believe that chrony as
delivered by debian did not
support pps. You can make sure that it does by simply
installing pps-tools by
debian and then recompiling the Debian chrony. Chrony
looks for the file
/usr/include/sys/timepps.h and if it is theere it
compiles with PPS support.
So just install pps-tools, and then do whatever you
need to on debian to
recompile chrony source. (I use Mageia/rpm, and there a
simple rpmbuild --rebuild <chrony src rpm>
would recompile
it with pps support. That might well solve the original
problem you had.
If pps0 is taken by something then the pps support in
the kernel would use
pps1.
As you propose a link from /etc/chrony.conf to
/etc/chrony/chrony.conf would
solve the problem of the location of chrony.conf.
Ie, since you are having loats of problems with
compiling the latest chrony
going with the distribution's chrony is probably the
easierst way to get it
disciplining your system.
William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
Canada V6T 1Z1 ____|____ and Gravity ______|_
www.theory.physics.ubc.ca/
Unfortunately chronyd doesn't appear to like that
setting. Upon reboot it complained that
dropping root
privileges was not
supported. I rebuilt again without it but now
appear to be encountering other problems, more
related to
BBB and debian I think.
Seems like I can't seem to predict very well what
device gets assigned for PPS and why. When
I started
the setup process the PPS
was going to /dev/pps0 as I would expect. Then
after my last reboot it was getting assigned
/dev/pps1
and it appears that device
isn't ready at the time chronyd is started by
systemd so it has to be started up manually
using
systemctl which is a no-go for
my application. I posted to the BeagleBone google
group to see if anyone has ideas as to
why. I'm
relatively sure it has to do
with the startup order from systemd but I'm not
expert enough to know how to remedy it.
I want to thank you again for all of the help
you've been providing (and the patience).
There are sooooo
many deep technical
details to all of this that it's hard to come up to speed.
On Mon, Nov 27, 2017 at 12:04 PM, Joe Smith <
It appears that the apt-get chrony package
creates a _chrony user and _chrony group
for the
daemon. That is the user
that currently owns /var/run/chrony. When I
started chrony after building/installing
from source I
did a "sudo
systemctl start chrony" and the chronyd.exe
process that is running is owned by root.
Given this,
it looks like the
best course of action is probably to
rebuild with the --with-user=_chrony option. I'm
assuming
(possibly wrongly)
that the daemon switches the user to
_chrony after it starts up if it's built with
that option.
On Mon, Nov 27, 2017 at 11:44 AM, Miroslav
Post by Joe Smith
Seems to be working now although I do get
this warning/error from systemctl
Post by Joe Smith
status chrony
Wrong owner of /var/run/chrony (UID != 0)
Not sure that it's significant given that
it seems to be running properly.
That indicates the previous chronyd dropped
root privileges (the owner
of /var/run/chrony is not root), but the
new one is keeping them and
refusing to write to the directory. It will
not be possible to use
chronyc to make changes in the
configuration until you reboot or
remove the directory and restart chronyd.
You should either recompile chrony with the
correct user specified by
the --with-user option, or specify the user
with the -u option on
the chronyd command line or use the user
directive in chrony.conf.
--
Miroslav Lichvar
--
To unsubscribe email
with "unsubscribe" in the subject.
For help email
with "help" in the subject.
Trouble? Email
Miroslav Lichvar
2017-11-29 14:39:06 UTC
Permalink
Post by Joe Smith
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-***@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-***@chrony.tuxfamily.org
with "help" in the subject.
Trouble? Email ***@chrony.tuxfamily.org.
Joe Smith
2017-11-29 15:47:53 UTC
Permalink
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 <***@linux.it>
[ 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

***@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

***@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)
Post by Miroslav Lichvar
Post by Joe Smith
However, if gpsd is really what's giving me my problems then I'll ditch
it
Post by Joe Smith
and configure chrony to read the NMEA serial port directly. I'll just
need
Post by Joe Smith
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
--
with "unsubscribe" in the subject.
with "help" in the subject.
Joe Smith
2017-11-29 19:33:35 UTC
Permalink
This post might be inappropriate. Click to display it.
Joe Smith
2017-11-29 21:08:19 UTC
Permalink
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.
Post by Joe Smith
I've rebuilt gpsd without pps support. Now I have only one pps device
getting created at startup.
[ 1.538059] pps_core: LinuxPPS API ver. 1 registered
[ 1.538067] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo
[ 26.130179] pps pps0: new PPS source ocp:bs_pinmode_P9_12_0x27_pinm
[ 26.130306] pps pps0: Registered IRQ 88 as PPS source
● 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
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
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?
Post by Joe Smith
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
[ 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
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
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)
Post by Joe Smith
Post by Joe Smith
However, if gpsd is really what's giving me my problems then I'll
ditch it
Post by Joe Smith
and configure chrony to read the NMEA serial port directly. I'll just
need
Post by Joe Smith
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
--
with "unsubscribe" in the subject.
with "help" in the subject.
Joe Smith
2017-11-29 22:11:06 UTC
Permalink
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
Post by Joe Smith
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.
Post by Joe Smith
I've rebuilt gpsd without pps support. Now I have only one pps device
getting created at startup.
[ 1.538059] pps_core: LinuxPPS API ver. 1 registered
[ 1.538067] pps_core: Software ver. 5.3.6 - Copyright 2005-2007
[ 26.130179] pps pps0: new PPS source ocp:bs_pinmode_P9_12_0x27_pinm
[ 26.130306] pps pps0: Registered IRQ 88 as PPS source
● 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
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
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 <
Post by Joe Smith
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
[ 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
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
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)
Post by Joe Smith
Post by Joe Smith
However, if gpsd is really what's giving me my problems then I'll
ditch it
Post by Joe Smith
and configure chrony to read the NMEA serial port directly. I'll just
need
Post by Joe Smith
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
--
with "unsubscribe" in the subject.
with "help" in the subject.
Miroslav Lichvar
2017-11-30 09:09:59 UTC
Permalink
Post by Joe Smith
I fiddled around with chronyd.service gpsd.service and I think I have
something that works. Both gpsd and chronyd start successfully on boot.
Great.
Post by Joe Smith
** 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
The change that fixed it is the line above?

There is apparently a way to add an ordering dependency on the PPS
device itself using a device unit, which can be created automatically
if there is a udev rule with "TAG+=systemd".

https://unix.stackexchange.com/questions/186899/how-to-wait-for-a-dev-video0-before-starting-a-service
https://www.freedesktop.org/software/systemd/man/systemd.device.html
--
Miroslav Lichvar
--
To unsubscribe email chrony-users-***@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-***@chrony.tuxfamily.org
with "help" in the subject.
Trouble? Email ***@chrony.tuxfamily.org.
Bill Unruh
2017-11-30 03:19:49 UTC
Permalink
GEt rid of the commandkey line in chrony.conf
Post by Joe Smith
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
Does /dev/pps0 exist when chrony starts? Chrony will not load the pps-ldisc
module itself. You have to make sure it is loaded before chrony starts

I do it by putting a script into /etc/init.d with the appropriate pointer in
the /etc/rc.d/rc?.d directories. (NOt sure what the Debian numbering is of
the rc?.d )

--------------------------
#! /bin/sh
#
# gps Support for NTP i gps clock.
#
# chkconfig: 345 70 15
# description: gps is a module to read the PPS
# Get config.
. /etc/sysconfig/network

# Get functions
. /etc/rc.d/init.d/functions

module="gps"
device="gps"
mode="664"
group=wheel

case "$1" in
start)
gprintf "Starting gps pps service"
modprobe pps-ldisc
ldattach 18 /dev/ttyS0
;;

stop)
killall ldattach

echo
;;
status)
status ldattach
;;
restart)
$0 stop
$0 start
;;
*)
gprintf "Usage: gps {start|stop|status|restart}\n "
exit 1
esac

--------------------------------------------
Post by Joe Smith
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
So it looks like /dev/pps0 was eventually started. It is a timing problem --
pps0 needs to be created before chrony starts
Post by Joe Smith
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
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?
Yup, that is what I think.
Joe Smith
2017-11-30 11:52:52 UTC
Permalink
Got rid of commandkey. I had planned to do that for a while but hadn't
because it didn't seem to be causing any serious problem.

That was precisely it. /dev/pps0 wasn't getting created by the kernel until
later in the bootup process. I had to make some changes to chronyd.service
and gpsd.service to ensure that both come up properly on boot. Main thing
was to delay chronyd startup.

I had to make a change to the chrony.conf to add makestep. For reasons I'm
not yet sure of, the system clock on this BeagleBone always comes up
waaaaaay off (like 26 days) at boot time. It would take an eternity for
chronyd to get in sync with that big of a delta. The only purpose in life
for this little server is to provide NTP so I'm not worried about any other
applications being sensitive to the clock step. Just seems like the kernel
would persist the system clock periodically so that when it boots up it's
at least in the ballpark. I thought I read that it does that somewhere but
can't remember where. I'll need to go back and research that. I may end up
having to add some sort of battery backed RTC to this design to address it.
Post by Bill Unruh
GEt rid of the commandkey line in chrony.conf
Nov 03 17:16:53 beaglebone chronyd[590]: commandkey directive is no longer
Post by Joe Smith
supported
Nov 03 17:16:53 beaglebone chronyd[572]: open() failed on /dev/pps0
Does /dev/pps0 exist when chrony starts? Chrony will not load the pps-ldisc
module itself. You have to make sure it is loaded before chrony starts
I do it by putting a script into /etc/init.d with the appropriate pointer in
the /etc/rc.d/rc?.d directories. (NOt sure what the Debian numbering is of
the rc?.d )
--------------------------
#! /bin/sh
#
# gps Support for NTP i gps clock. #
# chkconfig: 345 70 15
# description: gps is a module to read the PPS
# Get config.
. /etc/sysconfig/network
# Get functions
. /etc/rc.d/init.d/functions
module="gps"
device="gps"
mode="664"
group=wheel
case "$1" in
start)
gprintf "Starting gps pps service"
modprobe pps-ldisc
ldattach 18 /dev/ttyS0
;;
stop)
killall ldattach
echo
;;
status)
status ldattach
;;
restart)
$0 stop
$0 start
;;
*)
gprintf "Usage: gps {start|stop|status|restart}\n "
exit 1
esac
--------------------------------------------
Nov 03 17:16:53 beaglebone systemd[1]: chrony.service: Control process
Post by Joe Smith
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
So it looks like /dev/pps0 was eventually started. It is a timing problem --
pps0 needs to be created before chrony starts
trying PPS source "/dev/pps0"
Post by Joe Smith
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
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?
Yup, that is what I think.
Joe Smith
2017-11-30 11:57:27 UTC
Permalink
Oops. Didn't see your other response. Yes, that "After" directive is mainly
what did the trick. I also removed "After=chronyd.service" from
gpsd.service as it seemed to be causing problems with gpsd startup.

Thanks for the links! I'll take a look at those to see if that's a better
way to have this work the way I want.
Post by Joe Smith
Got rid of commandkey. I had planned to do that for a while but hadn't
because it didn't seem to be causing any serious problem.
That was precisely it. /dev/pps0 wasn't getting created by the kernel
until later in the bootup process. I had to make some changes to
chronyd.service and gpsd.service to ensure that both come up properly on
boot. Main thing was to delay chronyd startup.
I had to make a change to the chrony.conf to add makestep. For reasons I'm
not yet sure of, the system clock on this BeagleBone always comes up
waaaaaay off (like 26 days) at boot time. It would take an eternity for
chronyd to get in sync with that big of a delta. The only purpose in life
for this little server is to provide NTP so I'm not worried about any other
applications being sensitive to the clock step. Just seems like the kernel
would persist the system clock periodically so that when it boots up it's
at least in the ballpark. I thought I read that it does that somewhere but
can't remember where. I'll need to go back and research that. I may end up
having to add some sort of battery backed RTC to this design to address it.
Post by Bill Unruh
GEt rid of the commandkey line in chrony.conf
Nov 03 17:16:53 beaglebone chronyd[590]: commandkey directive is no longer
Post by Joe Smith
supported
Nov 03 17:16:53 beaglebone chronyd[572]: open() failed on /dev/pps0
Does /dev/pps0 exist when chrony starts? Chrony will not load the pps-ldisc
module itself. You have to make sure it is loaded before chrony starts
I do it by putting a script into /etc/init.d with the appropriate pointer in
the /etc/rc.d/rc?.d directories. (NOt sure what the Debian numbering is of
the rc?.d )
--------------------------
#! /bin/sh
#
# gps Support for NTP i gps clock. #
# chkconfig: 345 70 15
# description: gps is a module to read the PPS
# Get config.
. /etc/sysconfig/network
# Get functions
. /etc/rc.d/init.d/functions
module="gps"
device="gps"
mode="664"
group=wheel
case "$1" in
start)
gprintf "Starting gps pps service"
modprobe pps-ldisc
ldattach 18 /dev/ttyS0
;;
stop)
killall ldattach
echo
;;
status)
status ldattach
;;
restart)
$0 stop
$0 start
;;
*)
gprintf "Usage: gps {start|stop|status|restart}\n "
exit 1
esac
--------------------------------------------
Nov 03 17:16:53 beaglebone systemd[1]: chrony.service: Control process
Post by Joe Smith
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
So it looks like /dev/pps0 was eventually started. It is a timing problem --
pps0 needs to be created before chrony starts
trying PPS source "/dev/pps0"
Post by Joe Smith
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
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?
Yup, that is what I think.
Bill Unruh
2017-11-29 14:51:12 UTC
Permalink
I wasn't deliberately trying to use two interrupts, but perhaps something I did along the way
introduced that.
Yes. Lichvar seems to feel that it was gpsd that was doing that. Somewhere
perhaps you have a configureation for gpsd which tells it to use /dev/ttyS4.

I do not know how to use chrony to directly read the nmea. I only use the PPS
on ttyS1, and launch pps-ldisc 18 /dev/ttyS1 from a script which systemd runs
on bootup. I use network ntp to get the seconds for chrony and pps, not nmea.
I'm OK with not using gpsd if that's what's getting in my way here. The use of gpsd was really
just driven by online examples that were doing exactly what I'm trying to do (create a
compact, GPS driven NTP server using a BeagleBone Black with an AdaFruit Ultimate GPS breakout
board). Having the ability to check the GPS data using cgps is convenient. That way I don't
have to visually inspect the NMEA data coming in on the serial port. However, if gpsd is
Is it a serial port or is it a usb input?
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.
Sorry I cannot help there.
All of the online resources that I found for building a GPS NTP server
indicated to install and use gpsd. I have the UART4
(/dev/ttyS4) mapped via a U-Boot overlay. I believe using gpsd and
gpsd-clients allows me to easily verify that I'm getting good
GPS data, 3D Fix, etc.
My PPS signal comes from the AdaFruit Ultimate GPS Breakout board that
I have connected to my BeagleBone Black. That board has
Tx/Rx pins and a PPS output.
My /etc/default/gpsd file contains the following. It seems like it
should be just using /dev/ttyS4 for the serial NMEA data but
you may very well be right that it's assigning /dev/ttyS4 as a source
for pps0 given what I see in the dmesg output. Maybe just
something I have wrong/missing in /etc/default/gpsd
The assignment of the /dev/pps? numbers has nothing to do with chrony or gpsd,
or any other user space program. It is assigned by the kernel depending on
what order the drivers request a device number from the kernel. Ie, it is long
before anything else happens. But I have no idea why you have two devices. You
have one pps signal I thought, and if you have two pps drivers they will fight
each other and make your timing much worse. soetimes one, sometimes the other
will get the interrupt first.
So I ask again, why are you using two interrupts?
Furthermore, chrony has the ability to driectly use the pps signal. It does
not need gpsd. I do not run gpsd, and chrony disciplnes my clock to of the
order of 1 microsecond.
# Default settings for the gpsd init script and the hotplug wrapper.
It does not matter.
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"
# Use USB hotplugging to add new USB devices automatically to the
daemon
USBAUTO="false"
# Devices gpsd should collect to at boot time.
                        ^^^^^^^^ I assume that should be "coonnect"
# They need to be read/writeable, either by user gpsd or the group
dialout.
DEVICES="/dev/ttyS4"
# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"
      Not sure why you use gpsd. If you are using the serial port,
just doing (or
      setting up a script in /etc/init.d and /etc/rc?.d to do an
ldattach 18 /dev/ttyS0 should work to set up /dev/pps0
      and chrony can then use that.
      (Or is your pps attached elsewhere).
      And then put
      refclock PPS /dev/pps0
      into chrony.conf.
+1(604)822-3273
+1(604)822-5324
      UBC, Vancouver,BC _|_ Program in Cosmology |____
      Canada V6T 1Z1 ____|____ and Gravity ______|_
www.theory.physics.ubc.ca/
            Bill,
            Thanks for your response. I actually did basically what
you suggested prior to my post.
             *  Loaded latest BBB debian image onto the BeagleBone
eMMC.
             *  Compiled NF3H-PPS-00A0.dts file into a .dtbo file in
/lib/firmware
             *  Updated /boot/uEnv.txt to pull in NF3H-PPS-00A0.dtbo
and BB-UART4-00A0.dtbo into U-Boot
            configuration
             *  Rebooted
             *  apt-get update
             *  apt-get upgrade
             *  apt-get dist-upgrade
             *  apt-get autoremove
             *  apt-get autoclean
             *  apt-get install man-db
             *  apt-get install pps-tools
      That should be installed before you try to recompile chrony. In
particular,
      you need the /usr/include/sys/timepps.h for chorny to compile in
pps.
      You can also use gpsd to handle the pps, and it will feed the
pps times into
      a shared memory.
            At this point I could see I was getting PPS pulses on
/dev/pps0 using ppstest
             *  apt-get install gpsd
      Why?
             *  apt-get install gpsd-clients
             *  systemctl disable gpsd.socket
             *  systemctl stop gpsd.service
             *  Made edits to /etc/default/gpsd and
/lib/system/gpsd.service
             *  systemctl daemon-reload
             *  systemctl start gpsd.service
            At this point I was able to verify PPS pulses on /dev/pps0
and valid NMEA data coming in on /dev/ttyS4
            (using cgps)
             *  apt-get install chrony
             *  systemctl stop chrony
             *  In chrony source directory...
                 +   ./configure --prefix=/usr
--sysconfdir=/etc/chrony  (this set up chronyd.exe to point to
            /etc/chrony/chrony.conf)
                 +  make install
            Upon my next reboot I found that chrony didn't start.
Complaining about /dev/pps0
      I think gpsd may be grabbing pps0.
            Checked /dev/pps1 and saw that pulses were now coming in
there
            Changed chrony.conf to use /dev/pps1
            Rebooted
            Saw using systemctl status chrony that the daemon didn't
start because it couldn't access /dev/pps1
            Verified I was getting PPS pulses on /dev/pps1 using
ppstest
            Started chrony using systemctl start chrony
            Saw using systemctl status chrony that the daemon started
successfully
            Examined dmesg output to verify pps1
            I'm not entirely sure what step along the way the PPS
switched over to /dev/pps1. All I can tell right
            now is that once that
            happens chrony won't start during boot due to it not being
able to access /dev/pps1 at the time systemd
            starts it (or so it
            seems). My plan is to take this BBB back to the base BBB
debian image again and do reboots after each
            step (after installing
            pps-tools), checking PPS after each reboot to try an
isolate what step seems to cause the switchover. My
            hope is that once I
            isolate that I will be able to figure out what needs to
change to get chrony to start successfully on
            reboot/power-cycle.
      TRy not starting gpsd.
            On Mon, Nov 27, 2017 at 6:47 PM, Bill Unruh
                  Firstly, your problem was I believe that chrony as
delivered by debian did not
                  support pps. You can make sure that it does by
simply installing pps-tools by
                  debian and then recompiling the Debian chrony.
Chrony looks for the file
                  /usr/include/sys/timepps.h and if it is theere it
compiles with PPS support.
                  So just install pps-tools, and then do whatever you
need to on debian to
                  recompile chrony source. (I use Mageia/rpm, and
there a simple rpmbuild --rebuild <chrony src rpm>
            would recompile
                  it with pps support. That might well solve the
original
                  problem you had.
                  If pps0 is taken by something then the pps support
in the kernel would use
                  pps1.
                  As you propose a link from /etc/chrony.conf to
/etc/chrony/chrony.conf would
                  solve the problem of the location of chrony.conf.
                  Ie, since you are having loats of problems with
compiling the latest chrony
                  going with the distribution's chrony is probably the
easierst way to get it
                  disciplining your system.
                  William G. Unruh __| Canadian Institute for|____
Tel: +1(604)822-3273
                  Physics&Astronomy _|___ Advanced Research _|____
Fax: +1(604)822-5324
                  UBC, Vancouver,BC _|_ Program in Cosmology |____
                  Canada V6T 1Z1 ____|____ and Gravity ______|_
www.theory.physics.ubc.ca/
                        Unfortunately chronyd doesn't appear to like
that setting. Upon reboot it complained that
            dropping root
                        privileges was not
                        supported. I rebuilt again without it but now
appear to be encountering other problems, more
            related to
                        BBB and debian I think.
                        Seems like I can't seem to predict very well
what device gets assigned for PPS and why. When
            I started
                        the setup process the PPS
                        was going to /dev/pps0 as I would expect. Then
after my last reboot it was getting assigned
            /dev/pps1
                        and it appears that device
                        isn't ready at the time chronyd is started by
systemd so it has to be started up manually
            using
                        systemctl which is a no-go for
                        my application. I posted to the BeagleBone
google group to see if anyone has ideas as to
            why. I'm
                        relatively sure it has to do
                        with the startup order from systemd but I'm
not expert enough to know how to remedy it.
                        I want to thank you again for all of the help
you've been providing (and the patience).
            There are sooooo
                        many deep technical
                        details to all of this that it's hard to come
up to speed.
                        On Mon, Nov 27, 2017 at 12:04 PM, Joe Smith
                              It appears that the apt-get chrony
package creates a _chrony user and _chrony group
            for the
                        daemon. That is the user
                              that currently owns /var/run/chrony.
When I started chrony after building/installing
            from source I
                        did a "sudo
                              systemctl start chrony" and the
chronyd.exe process that is running is owned by root. 
            Given this,
                        it looks like the
                              best course of action is probably to
rebuild with the --with-user=_chrony option. I'm
            assuming
                        (possibly wrongly)
                              that the daemon switches the user to
_chrony after it starts up if it's built with
            that option.
                        On Mon, Nov 27, 2017 at 11:44 AM, Miroslav
                              On Mon, Nov 27, 2017 at 11:15:07AM
                              > Seems to be working now although I do
get this warning/error from systemctl
                              > status chrony
                              >
                              > Wrong owner of /var/run/chrony (UID !=
0)
                              >
                              > Not sure that it's significant given
that it seems to be running properly.
                              That indicates the previous chronyd
dropped root privileges (the owner
                              of /var/run/chrony is not root), but the
new one is keeping them and
                              refusing to write to the directory. It
will not be possible to use
                              chronyc to make changes in the
configuration until you reboot or
                              remove the directory and restart
chronyd.
                              You should either recompile chrony with
the correct user specified by
                              the --with-user option, or specify the
user with the -u option on
                              the chronyd command line or use the user
directive in chrony.conf.
                              --
                              Miroslav Lichvar
                              --
                              To unsubscribe email
                              with "unsubscribe" in the subject.
                              For help email
                              with "help" in the subject.
                              Trouble?  Email
Joe Smith
2017-11-29 15:10:11 UTC
Permalink
I believe Lichvar was correct given that I don't see any PPS for /dev/ttyS4
in dmesg output when gpsd is disabled. I see now that there isn't any way
to configure chrony to read the NMEA sentences directly from the serial
port. I may try feeding my PPS signal into the CTS pin for UART4 instead of
that GPIO pin and see if that gets me anywhere. It certainly seems like
gpsd is trying to get its PPS data from the same serial port that the NMEA
data is coming in on. Maybe that will get me somewhere. For my particular
application, getting NTP over the network isn't really an option. This NTP
server device will be deployed on an isolated network with no internet
connectivity so getting time from GPS is really my only option.

The NMEA sentences come in on serial port /dev/ttyS4. USB is not being used.
Post by Joe Smith
I wasn't deliberately trying to use two interrupts, but perhaps something
I did along the way
introduced that.
Yes. Lichvar seems to feel that it was gpsd that was doing that. Somewhere
perhaps you have a configureation for gpsd which tells it to use /dev/ttyS4.
I do not know how to use chrony to directly read the nmea. I only use the PPS
on ttyS1, and launch pps-ldisc 18 /dev/ttyS1 from a script which systemd runs
on bootup. I use network ntp to get the seconds for chrony and pps, not nmea.
I'm OK with not using gpsd if that's what's getting in my way here. The
use of gpsd was really
just driven by online examples that were doing exactly what I'm trying to do (create a
compact, GPS driven NTP server using a BeagleBone Black with an AdaFruit
Ultimate GPS breakout
board). Having the ability to check the GPS data using cgps is
convenient. That way I don't
have to visually inspect the NMEA data coming in on the serial port. However, if gpsd is
Is it a serial port or is it a usb input?
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.
Sorry I cannot help there.
All of the online resources that I found for building a GPS NTP server
indicated to install and use gpsd. I have the UART4
(/dev/ttyS4) mapped via a U-Boot overlay. I believe using gpsd and
gpsd-clients allows me to easily verify that I'm getting good
GPS data, 3D Fix, etc.
My PPS signal comes from the AdaFruit Ultimate GPS Breakout board that
I have connected to my BeagleBone Black. That board has
Tx/Rx pins and a PPS output.
My /etc/default/gpsd file contains the following. It seems like it
should be just using /dev/ttyS4 for the serial NMEA data but
you may very well be right that it's assigning /dev/ttyS4 as a source
for pps0 given what I see in the dmesg output. Maybe just
something I have wrong/missing in /etc/default/gpsd
The assignment of the /dev/pps? numbers has nothing to do with chrony or gpsd,
or any other user space program. It is assigned by the kernel depending on
what order the drivers request a device number from the kernel. Ie, it is long
before anything else happens. But I have no idea why you have two devices. You
have one pps signal I thought, and if you have two pps drivers they will fight
each other and make your timing much worse. soetimes one, sometimes the other
will get the interrupt first.
So I ask again, why are you using two interrupts?
Furthermore, chrony has the ability to driectly use the pps signal. It does
not need gpsd. I do not run gpsd, and chrony disciplnes my clock to of the
order of 1 microsecond.
# Default settings for the gpsd init script and the hotplug wrapper.
It does not matter.
# Start the gpsd daemon automatically at boot time
START_DAEMON="true"
# Use USB hotplugging to add new USB devices automatically to the
daemon
USBAUTO="false"
# Devices gpsd should collect to at boot time.
^^^^^^^^ I assume that should be "coonnect"
# They need to be read/writeable, either by user gpsd or the group
dialout.
DEVICES="/dev/ttyS4"
# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"
On Tue, Nov 28, 2017 at 4:21 AM, Bill Unruh <
Not sure why you use gpsd. If you are using the serial
port,
just doing (or
setting up a script in /etc/init.d and /etc/rc?.d to do an
ldattach 18 /dev/ttyS0 should work to set up /dev/pps0
and chrony can then use that.
(Or is your pps attached elsewhere).
And then put
refclock PPS /dev/pps0
into chrony.conf.
+1(604)822-3273
+1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____
Canada V6T 1Z1 ____|____ and Gravity ______|_
www.theory.physics.ubc.ca/
Bill,
Thanks for your response. I actually did
basically what
you suggested prior to my post.
* Loaded latest BBB debian image onto the
BeagleBone
eMMC.
* Compiled NF3H-PPS-00A0.dts file into a .dtbo
file in
/lib/firmware
* Updated /boot/uEnv.txt to pull in
NF3H-PPS-00A0.dtbo
and BB-UART4-00A0.dtbo into U-Boot
configuration
* Rebooted
* apt-get update
* apt-get upgrade
* apt-get dist-upgrade
* apt-get autoremove
* apt-get autoclean
* apt-get install man-db
* apt-get install pps-tools
That should be installed before you try to recompile
chrony. In
particular,
you need the /usr/include/sys/timepps.h for chorny to
compile in
pps.
You can also use gpsd to handle the pps, and it will
feed the
pps times into
a shared memory.
At this point I could see I was getting PPS
pulses on
/dev/pps0 using ppstest
* apt-get install gpsd
Why?
* apt-get install gpsd-clients
* systemctl disable gpsd.socket
* systemctl stop gpsd.service
* Made edits to /etc/default/gpsd and
/lib/system/gpsd.service
* systemctl daemon-reload
* systemctl start gpsd.service
At this point I was able to verify PPS pulses on /dev/pps0
and valid NMEA data coming in on /dev/ttyS4
(using cgps)
* apt-get install chrony
* systemctl stop chrony
* In chrony source directory...
+ ./configure --prefix=/usr
--sysconfdir=/etc/chrony (this set up chronyd.exe to point to
/etc/chrony/chrony.conf)
+ make install
Upon my next reboot I found that chrony didn't start.
Complaining about /dev/pps0
I think gpsd may be grabbing pps0.
Checked /dev/pps1 and saw that pulses were now
coming in
there
Changed chrony.conf to use /dev/pps1
Rebooted
Saw using systemctl status chrony that the daemon didn't
start because it couldn't access /dev/pps1
Verified I was getting PPS pulses on /dev/pps1
using
ppstest
Started chrony using systemctl start chrony
Saw using systemctl status chrony that the daemon
started
successfully
Examined dmesg output to verify pps1
I'm not entirely sure what step along the way the PPS
switched over to /dev/pps1. All I can tell right
now is that once that
happens chrony won't start during boot due to it not being
able to access /dev/pps1 at the time systemd
starts it (or so it
seems). My plan is to take this BBB back to the base BBB
debian image again and do reboots after each
step (after installing
pps-tools), checking PPS after each reboot to try
an
isolate what step seems to cause the switchover. My
hope is that once I
isolate that I will be able to figure out what needs to
change to get chrony to start successfully on
reboot/power-cycle.
TRy not starting gpsd.
On Mon, Nov 27, 2017 at 6:47 PM, Bill Unruh
Firstly, your problem was I believe that chrony as
delivered by debian did not
support pps. You can make sure that it does
by
simply installing pps-tools by
debian and then recompiling the Debian
chrony.
Chrony looks for the file
/usr/include/sys/timepps.h and if it is theere it
compiles with PPS support.
So just install pps-tools, and then do whatever you
need to on debian to
recompile chrony source. (I use Mageia/rpm,
and
there a simple rpmbuild --rebuild <chrony src rpm>
would recompile
it with pps support. That might well solve
the
original
problem you had.
If pps0 is taken by something then the pps
support
in the kernel would use
pps1.
As you propose a link from /etc/chrony.conf to
/etc/chrony/chrony.conf would
solve the problem of the location of chrony.conf.
Ie, since you are having loats of problems with
compiling the latest chrony
going with the distribution's chrony is probably the
easierst way to get it
disciplining your system.
William G. Unruh __| Canadian Institute
for|____
Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research
_|____
Fax: +1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____
Canada V6T 1Z1 ____|____ and Gravity ______|_
www.theory.physics.ubc.ca/
Unfortunately chronyd doesn't appear
to like
that setting. Upon reboot it complained that
dropping root
privileges was not
supported. I rebuilt again without it but now
appear to be encountering other problems, more
related to
BBB and debian I think.
Seems like I can't seem to predict
very well
what device gets assigned for PPS and why. When
I started
the setup process the PPS
was going to /dev/pps0 as I would expect. Then
after my last reboot it was getting assigned
/dev/pps1
and it appears that device
isn't ready at the time chronyd is started by
systemd so it has to be started up manually
using
systemctl which is a no-go for
my application. I posted to the
BeagleBone
google group to see if anyone has ideas as to
why. I'm
relatively sure it has to do
with the startup order from systemd
but I'm
not expert enough to know how to remedy it.
I want to thank you again for all of the help
you've been providing (and the patience).
There are sooooo
many deep technical
details to all of this that it's hard
to come
up to speed.
On Mon, Nov 27, 2017 at 12:04 PM, Joe
Smith
It appears that the apt-get
chrony
package creates a _chrony user and _chrony group
for the
daemon. That is the user
that currently owns
/var/run/chrony.
When I started chrony after building/installing
from source I
did a "sudo
systemctl start chrony" and the
chronyd.exe process that is running is owned by root.
Given this,
it looks like the
best course of action is probably to
rebuild with the --with-user=_chrony option. I'm
assuming
(possibly wrongly)
that the daemon switches the user to
_chrony after it starts up if it's built with
that option.
On Mon, Nov 27, 2017 at 11:44 AM, Miroslav
On Mon, Nov 27, 2017 at
11:15:07AM
Post by Joe Smith
Seems to be working now
although I do
get this warning/error from systemctl
Post by Joe Smith
status chrony
Wrong owner of
/var/run/chrony (UID !=
0)
Post by Joe Smith
Not sure that it's
significant given
that it seems to be running properly.
That indicates the previous
chronyd
dropped root privileges (the owner
of /var/run/chrony is not root), but the
new one is keeping them and
refusing to write to the
directory. It
will not be possible to use
chronyc to make changes in the
configuration until you reboot or
remove the directory and restart
chronyd.
You should either recompile
chrony with
the correct user specified by
the --with-user option, or
specify the
user with the -u option on
the chronyd command line or use the user
directive in chrony.conf.
--
Miroslav Lichvar
--
To unsubscribe email
with "unsubscribe" in the subject.
For help email
with "help" in the subject.
Trouble? Email
Miroslav Lichvar
2017-11-28 08:45:39 UTC
Permalink
Post by Joe Smith
Unfortunately chronyd doesn't appear to like that setting. Upon reboot it
complained that dropping root privileges was not supported.
That suggests the development files for libcap were missing when
chronyd was built. The configure script should print:

Checking for libcap : Yes
Post by Joe Smith
I rebuilt again
without it but now appear to be encountering other problems, more related
to BBB and debian I think. Seems like I can't seem to predict very well
what device gets assigned for PPS and why. When I started the setup process
the PPS was going to /dev/pps0 as I would expect. Then after my last reboot
it was getting assigned /dev/pps1 and it appears that device isn't ready at
the time chronyd is started by systemd so it has to be started up manually
using systemctl which is a no-go for my application. I posted to the
BeagleBone google group to see if anyone has ideas as to why. I'm
relatively sure it has to do with the startup order from systemd but I'm
not expert enough to know how to remedy it.
It might be an ordering issue between starting gpsd and loading of the
pps-gpio module. How is the module loaded?

I think gpsd tries to attach a PPS of the serial port, like "ldattach 18"
would do, and if that happens before the pps-gpio module is loaded,
they would have different numbers assigned. But I'm just guessing
here.
--
Miroslav Lichvar
--
To unsubscribe email chrony-users-***@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-***@chrony.tuxfamily.org
with "help" in the subject.
Trouble? Email ***@chrony.tuxfamily.org.
Joe Smith
2017-11-28 14:10:29 UTC
Permalink
I verified that the configure script does not find libcap. Tried to apt-get
install libcap-dev and configure again but it still doesn't find it. There
appear to be a few debian packages out there for libcap but not sure which
one it needs. I'm not super worried if chronyd has to run as root for my
particular application.

I'm not exactly sure how to determine how gps-gpio is loaded. All I know is
that I configured /boot/uEnv.txt to load overlays for the PPS pin and
UART4. Then it was just doing apt-get install to get the packages I need. I
ran dmesg | grep pps and got the following:

[ 1.538080] pps_core: LinuxPPS API ver. 1 registered
[ 1.538089] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo
Giometti <***@linux.it>
[ 17.288476] pps_ldisc: PPS line discipline registered
[ 17.308702] pps pps0: new PPS source serial4
[ 17.308799] pps pps0: source "/dev/ttyS4" added
[ 26.049624] pps pps1: new PPS source ocp:bs_pinmode_P9_12_0x27_pinm
[ 26.049749] pps pps1: Registered IRQ 88 as PPS source

I'm going to try the slow deliberate approach to loading the packages to
isolate where the problems begin.
Post by Miroslav Lichvar
Post by Joe Smith
Unfortunately chronyd doesn't appear to like that setting. Upon reboot it
complained that dropping root privileges was not supported.
That suggests the development files for libcap were missing when
Checking for libcap : Yes
Post by Joe Smith
I rebuilt again
without it but now appear to be encountering other problems, more related
to BBB and debian I think. Seems like I can't seem to predict very well
what device gets assigned for PPS and why. When I started the setup
process
Post by Joe Smith
the PPS was going to /dev/pps0 as I would expect. Then after my last
reboot
Post by Joe Smith
it was getting assigned /dev/pps1 and it appears that device isn't ready
at
Post by Joe Smith
the time chronyd is started by systemd so it has to be started up
manually
Post by Joe Smith
using systemctl which is a no-go for my application. I posted to the
BeagleBone google group to see if anyone has ideas as to why. I'm
relatively sure it has to do with the startup order from systemd but I'm
not expert enough to know how to remedy it.
It might be an ordering issue between starting gpsd and loading of the
pps-gpio module. How is the module loaded?
I think gpsd tries to attach a PPS of the serial port, like "ldattach 18"
would do, and if that happens before the pps-gpio module is loaded,
they would have different numbers assigned. But I'm just guessing
here.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Bill Unruh
2017-11-28 14:28:47 UTC
Permalink
See below
I verified that the configure script does not find libcap. Tried to apt-get install libcap-dev and configure again but it still
doesn't find it. There appear to be a few debian packages out there for libcap but not sure which one it needs. I'm not super
worried if chronyd has to run as root for my particular application.
I'm not exactly sure how to determine how gps-gpio is loaded. All I know is that I configured /boot/uEnv.txt to load overlays
for the PPS pin and UART4. Then it was just doing apt-get install to get the packages I need. I ran dmesg | grep pps and got the
[    1.538080] pps_core: LinuxPPS API ver. 1 registered
[   17.288476] pps_ldisc: PPS line discipline registered
[   17.308702] pps pps0: new PPS source serial4
[   17.308799] pps pps0: source "/dev/ttyS4" added
[   26.049624] pps pps1: new PPS source ocp:bs_pinmode_P9_12_0x27_pinm
[   26.049749] pps pps1: Registered IRQ 88 as PPS source
OK, things become slightly clearer. Both ttyS4 and your gpio pin are claiming to
deliver pps to the system, one on /dev/pps0 and the other on pps1. You
probably do not want the ttyS4 as a pps source (do you even have a serial port
and is anything plugged into it.
You are running pps_ldisc which is the serial port pps module. You must have
somewhere that you are telling it to run that. I do it in a script, but you
could have a systemd program doing it (grep -r pps_ldisc /usr/lib/systemd) or
do the same for /etc/init.d
I'm going to try the slow deliberate approach to loading the packages to isolate where the problems begin.
Post by Joe Smith
Unfortunately chronyd doesn't appear to like that setting. Upon reboot it
complained that dropping root privileges was not supported.
That suggests the development files for libcap were missing when
Checking for libcap : Yes
Post by Joe Smith
I rebuilt again
without it but now appear to be encountering other problems, more related
to BBB and debian I think. Seems like I can't seem to predict very well
what device gets assigned for PPS and why. When I started the setup process
the PPS was going to /dev/pps0 as I would expect. Then after my last reboot
it was getting assigned /dev/pps1 and it appears that device isn't ready at
the time chronyd is started by systemd so it has to be started up manually
using systemctl which is a no-go for my application. I posted to the
BeagleBone google group to see if anyone has ideas as to why. I'm
relatively sure it has to do with the startup order from systemd but I'm
not expert enough to know how to remedy it.
It might be an ordering issue between starting gpsd and loading of the
pps-gpio module. How is the module loaded?
I think gpsd tries to attach a PPS of the serial port, like "ldattach 18"
would do, and if that happens before the pps-gpio module is loaded,
they would have different numbers assigned. But I'm just guessing
here.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Joe Smith
2017-11-28 15:07:12 UTC
Permalink
I don't know exactly how pps_ldisc is being loaded. Both greps you
suggested yielded zero results. I can only guess that it is part of
pps-tools.

I was going to try specifying both /dev/ttyS4 and /dev/pps0 in the gpsd
config to see if that helps anything.
Post by Bill Unruh
See below
I verified that the configure script does not find libcap. Tried to
apt-get install libcap-dev and configure again but it still
doesn't find it. There appear to be a few debian packages out there for
libcap but not sure which one it needs. I'm not super
worried if chronyd has to run as root for my particular application.
I'm not exactly sure how to determine how gps-gpio is loaded. All I know
is that I configured /boot/uEnv.txt to load overlays
for the PPS pin and UART4. Then it was just doing apt-get install to get
the packages I need. I ran dmesg | grep pps and got the
[ 1.538080] pps_core: LinuxPPS API ver. 1 registered
[ 1.538089] pps_core: Software ver. 5.3.6 - Copyright 2005-2007
[ 17.288476] pps_ldisc: PPS line discipline registered
[ 17.308702] pps pps0: new PPS source serial4
[ 17.308799] pps pps0: source "/dev/ttyS4" added
[ 26.049624] pps pps1: new PPS source ocp:bs_pinmode_P9_12_0x27_pinm
[ 26.049749] pps pps1: Registered IRQ 88 as PPS source
OK, things become slightly clearer. Both ttyS4 and your gpio pin are claiming to
deliver pps to the system, one on /dev/pps0 and the other on pps1. You
probably do not want the ttyS4 as a pps source (do you even have a serial port
and is anything plugged into it. You are running pps_ldisc which is the
serial port pps module. You must have
somewhere that you are telling it to run that. I do it in a script, but you
could have a systemd program doing it (grep -r pps_ldisc /usr/lib/systemd)
or do the same for /etc/init.d
I'm going to try the slow deliberate approach to loading the packages to
isolate where the problems begin.
Post by Joe Smith
Unfortunately chronyd doesn't appear to like that setting. Upon
reboot it
Post by Joe Smith
complained that dropping root privileges was not supported.
That suggests the development files for libcap were missing when
Checking for libcap : Yes
Post by Joe Smith
I rebuilt again
without it but now appear to be encountering other problems, more
related
Post by Joe Smith
to BBB and debian I think. Seems like I can't seem to predict
very well
Post by Joe Smith
what device gets assigned for PPS and why. When I started the
setup process
Post by Joe Smith
the PPS was going to /dev/pps0 as I would expect. Then after my
last reboot
Post by Joe Smith
it was getting assigned /dev/pps1 and it appears that device
isn't ready at
Post by Joe Smith
the time chronyd is started by systemd so it has to be started up
manually
Post by Joe Smith
using systemctl which is a no-go for my application. I posted to
the
Post by Joe Smith
BeagleBone google group to see if anyone has ideas as to why. I'm
relatively sure it has to do with the startup order from systemd
but I'm
Post by Joe Smith
not expert enough to know how to remedy it.
It might be an ordering issue between starting gpsd and loading of the
pps-gpio module. How is the module loaded?
I think gpsd tries to attach a PPS of the serial port, like "ldattach 18"
would do, and if that happens before the pps-gpio module is loaded,
they would have different numbers assigned. But I'm just guessing
here.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Miroslav Lichvar
2017-11-28 15:25:21 UTC
Permalink
Post by Joe Smith
I don't know exactly how pps_ldisc is being loaded. Both greps you
suggested yielded zero results. I can only guess that it is part of
pps-tools.
The pps_ldisc module is loaded becaused gpsd sets the PPS line
discipline (even when there is no PPS signal).
Post by Joe Smith
I was going to try specifying both /dev/ttyS4 and /dev/pps0 in the gpsd
config to see if that helps anything.
That might help. If you can force gpsd to use the GPIO PPS, you won't
need to specify the PPS refclock in chrony.conf and instead you can
use the SHM 1 or SOCK provided by gpsd.
--
Miroslav Lichvar
--
To unsubscribe email chrony-users-***@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-***@chrony.tuxfamily.org
with "help" in the subject.
Trouble? Email ***@chrony.tuxfamily.org.
Joe Smith
2017-11-28 16:16:03 UTC
Permalink
First attempt did not work. I need to dig deeper to see if I can force it
to use /dev/pps0.
Post by Miroslav Lichvar
Post by Joe Smith
I don't know exactly how pps_ldisc is being loaded. Both greps you
suggested yielded zero results. I can only guess that it is part of
pps-tools.
The pps_ldisc module is loaded becaused gpsd sets the PPS line
discipline (even when there is no PPS signal).
Post by Joe Smith
I was going to try specifying both /dev/ttyS4 and /dev/pps0 in the gpsd
config to see if that helps anything.
That might help. If you can force gpsd to use the GPIO PPS, you won't
need to specify the PPS refclock in chrony.conf and instead you can
use the SHM 1 or SOCK provided by gpsd.
--
Miroslav Lichvar
--
with "unsubscribe" in the subject.
with "help" in the subject.
Bill Unruh
2017-11-29 01:47:33 UTC
Permalink
I don't know exactly how pps_ldisc is being loaded. Both greps you suggested yielded zero results. I can only guess that it is
part of pps-tools.
No. pps-tools package has about 5 programs which you can use to test the pps,
and one file, timepps.h, which is needed to compile pps support into chrony,
ntpd and gpsd. pps-ldisc module is being loaded by something.
Sorry I misled you. It is the pps-ldisc module, not pps_ldisk. So grep for the
former.

As far as I know you have your pps line from from your gps receiver attached
to a gpio pin, not to the serial port. I a pretty sure you do not have two
separate pps lines from either one or two gps receivers. It is ONLY the pin
that actually has the pps signal that requires a module to time it.
pps-ldisc is for the cts pin on the serial port connector carrying the
interrupt. But I suspect that you have a usb connection to bring in the nmea
sentences, not a good old fashioned 9 or 25 pin serial port.

Somethng is loading the pps-ldisc module. You need to find what is doing that.
I was going to try specifying both /dev/ttyS4 and /dev/pps0 in the gpsd config to see if that helps anything.
???? My suspicion is that you should get rid of that ttyS4 entirely as far as
pps is concerned.

Note that you might be automatically loading pps-ldisc in one of the module
files
grep -r pps-ldisc /etc/mod*
See below
I verified that the configure script does not find libcap. Tried to apt-get install libcap-dev and
configure again but it still
doesn't find it. There appear to be a few debian packages out there for libcap but not sure which one it
needs. I'm not super
worried if chronyd has to run as root for my particular application.
I'm not exactly sure how to determine how gps-gpio is loaded. All I know is that I configured
/boot/uEnv.txt to load overlays
for the PPS pin and UART4. Then it was just doing apt-get install to get the packages I need. I ran
dmesg | grep pps and got the
[    1.538080] pps_core: LinuxPPS API ver. 1 registered
[   17.288476] pps_ldisc: PPS line discipline registered
[   17.308702] pps pps0: new PPS source serial4
[   17.308799] pps pps0: source "/dev/ttyS4" added
[   26.049624] pps pps1: new PPS source ocp:bs_pinmode_P9_12_0x27_pinm
[   26.049749] pps pps1: Registered IRQ 88 as PPS source
OK, things become slightly clearer. Both ttyS4 and your gpio pin are claiming to
deliver pps to the system, one on /dev/pps0 and the other on pps1. You
probably do not want the ttyS4 as a pps source (do you even have a serial port
and is anything plugged into it. You are running pps_ldisc which is the serial port pps module. You must have
somewhere that you are telling it to run that. I do it in a script, but you
could have a systemd program doing it (grep -r pps_ldisc /usr/lib/systemd) or do the same for /etc/init.d
I'm going to try the slow deliberate approach to loading the packages to isolate where the problems
begin.
      > Unfortunately chronyd doesn't appear to like that setting. Upon reboot it
      > complained that dropping root privileges was not supported.
      That suggests the development files for libcap were missing when
      Checking for libcap : Yes
      > I rebuilt again
      > without it but now appear to be encountering other problems, more related
      > to BBB and debian I think. Seems like I can't seem to predict very well
      > what device gets assigned for PPS and why. When I started the setup process
      > the PPS was going to /dev/pps0 as I would expect. Then after my last reboot
      > it was getting assigned /dev/pps1 and it appears that device isn't ready at
      > the time chronyd is started by systemd so it has to be started up manually
      > using systemctl which is a no-go for my application. I posted to the
      > BeagleBone google group to see if anyone has ideas as to why. I'm
      > relatively sure it has to do with the startup order from systemd but I'm
      > not expert enough to know how to remedy it.
      It might be an ordering issue between starting gpsd and loading of the
      pps-gpio module. How is the module loaded?
      I think gpsd tries to attach a PPS of the serial port, like "ldattach 18"
      would do, and if that happens before the pps-gpio module is loaded,
      they would have different numbers assigned. But I'm just guessing
      here.
      --
      Miroslav Lichvar
      --
      with "unsubscribe" in the subject.
      with "help" in the subject.
Joe Smith
2017-11-29 14:21:35 UTC
Permalink
The PPS line from the AdaFruit Ultimate GPS breakout board does go into a
GPIO pin on the BeagleBone Black. The serial Tx/Rx lines from that breakout
board go to the UART4 pins on the BeagleBone. There is no 9 or 25 pin
connector, just wires. The NMEA sentences come in on /dev/ttyS4 and I have
an overlay loaded on the BeagleBone for configuring the GPIO pin used for
the PPS. I attached a photo of the setup.

As an experiment I did a systemctl disable gpsd and rebooted. After reboot
I did a dmesg | grep pps Here's what I see:

***@beaglebone:~$ dmesg | grep pps
[ 1.538021] pps_core: LinuxPPS API ver. 1 registered
[ 1.538029] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo
Giometti <***@linux.it>
[ 25.429435] pps pps0: new PPS source ocp:bs_pinmode_P9_12_0x27_pinm
[ 25.429551] pps pps0: Registered IRQ 88 as PPS source

So I no longer see pps0 getting assigned to /dev/ttyS4, as it was when I
had gpsd enabled. This makes me relatively confident that gpsd at least in
part was getting in the way here. Using ppstest shows I am getting the PPS
pulses on /dev/pps0. I am going to try to configure chrony to read
/dev/ttyS4 directly and see where that takes me.

Thanks again for all the help you have been providing and your patience.
I'm by no stretch an NTP/Chrony expert and my Linux/Unix skills are pretty
rusty. I know just enough to get myself into trouble.
Post by Joe Smith
I don't know exactly how pps_ldisc is being loaded. Both greps you
Post by Joe Smith
suggested yielded zero results. I can only guess that it is
part of pps-tools.
No. pps-tools package has about 5 programs which you can use to test the pps,
and one file, timepps.h, which is needed to compile pps support into chrony,
ntpd and gpsd. pps-ldisc module is being loaded by something.
Sorry I misled you. It is the pps-ldisc module, not pps_ldisk. So grep for the
former.
As far as I know you have your pps line from from your gps receiver attached
to a gpio pin, not to the serial port. I a pretty sure you do not have two
separate pps lines from either one or two gps receivers. It is ONLY the pin
that actually has the pps signal that requires a module to time it.
pps-ldisc is for the cts pin on the serial port connector carrying the
interrupt. But I suspect that you have a usb connection to bring in the nmea
sentences, not a good old fashioned 9 or 25 pin serial port.
Somethng is loading the pps-ldisc module. You need to find what is doing that.
I was going to try specifying both /dev/ttyS4 and /dev/pps0 in the gpsd
Post by Joe Smith
config to see if that helps anything.
???? My suspicion is that you should get rid of that ttyS4 entirely as far as
pps is concerned.
Note that you might be automatically loading pps-ldisc in one of the module
files
grep -r pps-ldisc /etc/mod*
Post by Joe Smith
See below
I verified that the configure script does not find libcap.
Tried to apt-get install libcap-dev and
configure again but it still
doesn't find it. There appear to be a few debian packages out
there for libcap but not sure which one it
needs. I'm not super
worried if chronyd has to run as root for my particular application.
I'm not exactly sure how to determine how gps-gpio is loaded.
All I know is that I configured
/boot/uEnv.txt to load overlays
for the PPS pin and UART4. Then it was just doing apt-get
install to get the packages I need. I ran
dmesg | grep pps and got the
[ 1.538080] pps_core: LinuxPPS API ver. 1 registered
[ 1.538089] pps_core: Software ver. 5.3.6 - Copyright
[ 17.288476] pps_ldisc: PPS line discipline registered
[ 17.308702] pps pps0: new PPS source serial4
[ 17.308799] pps pps0: source "/dev/ttyS4" added
[ 26.049624] pps pps1: new PPS source
ocp:bs_pinmode_P9_12_0x27_pinm
[ 26.049749] pps pps1: Registered IRQ 88 as PPS source
OK, things become slightly clearer. Both ttyS4 and your gpio pin are claiming to
deliver pps to the system, one on /dev/pps0 and the other on pps1. You
probably do not want the ttyS4 as a pps source (do you even have a serial port
and is anything plugged into it. You are running pps_ldisc which is
the serial port pps module. You must have
somewhere that you are telling it to run that. I do it in a script, but you
could have a systemd program doing it (grep -r pps_ldisc
/usr/lib/systemd) or do the same for /etc/init.d
I'm going to try the slow deliberate approach to loading the
packages to isolate where the problems
begin.
On Tue, Nov 28, 2017 at 3:45 AM, Miroslav Lichvar <
Post by Joe Smith
Unfortunately chronyd doesn't appear to like that
setting. Upon reboot it
Post by Joe Smith
complained that dropping root privileges was not
supported.
That suggests the development files for libcap were missing when
Checking for libcap : Yes
Post by Joe Smith
I rebuilt again
without it but now appear to be encountering other
problems, more related
Post by Joe Smith
to BBB and debian I think. Seems like I can't seem to
predict very well
Post by Joe Smith
what device gets assigned for PPS and why. When I
started the setup process
Post by Joe Smith
the PPS was going to /dev/pps0 as I would expect.
Then after my last reboot
Post by Joe Smith
it was getting assigned /dev/pps1 and it appears that
device isn't ready at
Post by Joe Smith
the time chronyd is started by systemd so it has to
be started up manually
Post by Joe Smith
using systemctl which is a no-go for my application.
I posted to the
Post by Joe Smith
BeagleBone google group to see if anyone has ideas as
to why. I'm
Post by Joe Smith
relatively sure it has to do with the startup order
from systemd but I'm
Post by Joe Smith
not expert enough to know how to remedy it.
It might be an ordering issue between starting gpsd and loading of the
pps-gpio module. How is the module loaded?
I think gpsd tries to attach a PPS of the serial port,
like "ldattach 18"
would do, and if that happens before the pps-gpio module is loaded,
they would have different numbers assigned. But I'm just guessing
here.
--
Miroslav Lichvar
--
xfamily.org
with "unsubscribe" in the subject.
xfamily.org
with "help" in the subject.
Loading...