Re: [chrony-users] Not getting time from gpsd |
[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]
I see gpsd using the socket but I don't see chrony accessing it at all. Can you comment out the shm line and strace chrony again? I think that's where the issue is.
I've attached the strace files. The commands I used were:root@IrishMistII:/tmp# strace -o /tmp/chrony.strace.out chronydroot@IrishMistII:/tmp# strace -o /tmp/gpsd.strace.out gpsd -D 8 -F /var/run/chrony.ttyACM0.sock /dev/ttyACM0On Aug 7, 2016 12:50 AM, "Steve Horton" <stevejhorton@xxxxxxxxx> wrote:We need to see if gpsd is sending and if chrony is rx anything on that socket. I'd start both process in strace to srart. Then maybe start gpsd in debug -D 8 and see if its writing to that chrony socket. Strace will show what's happening underneath.
On Aug 6, 2016 11:37 PM, "Chris Greenman" <chris.m.greenman@xxxxxxxxx> wrote:$ file /var/run/chrony.ttyACM0.sock/var/run/chrony.ttyACM0.sock: socketcat /etc/init.d/gpsd$ cat /etc/init.d/gpsd#!/bin/sh### BEGIN INIT INFO# Provides: gpsd# Required-Start: $remote_fs $syslog $network# Should-Start: bluetooth dbus udev# Required-Stop: $remote_fs $syslog $network# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# X-Start-Before: ntp# Short-Description: GPS (Global Positioning System) daemon# Description: The gpsd service daemon is able to monitor one or# more GPS devices connected to a host computer, making# all data on the location and movements of the sensors# available to be queried on TCP port 2947.### END INIT INFO# Author: Bernd Zeimetz <bzed@xxxxxxxxxx>## Please remove the "Author" lines above and replace them# with your own name if you copy and modify this script.# Do NOT "set -e"# PATH should only include /usr/* if it runs after the mountnfs.sh scriptRUNDIR=/run/gpsdPATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="GPS (Global Positioning System) daemon"NAME=gpsdDAEMON=/usr/sbin/$NAMEPIDFILE=$RUNDIR/$NAME.pidSCRIPTNAME=/etc/init.d/$NAME# Exit if the package is not installed[ -x "$DAEMON" ] || exit 0# Read configuration variable file if it is present[ -r /etc/default/$NAME ] && . /etc/default/$NAMEif [ -z "$GPSD_SOCKET" ] && [ -z "$DEVICES" ]; thenGPSD_SOCKET=/var/run/gpsd.sockfiif [ -n "$GPSD_SOCKET" ]; thenGPSD_OPTIONS="$GPSD_OPTIONS -F $GPSD_SOCKET"fi# Load the VERBOSE setting and other rcS variables. /lib/init/vars.sh# Define LSB log_* functions.# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.. /lib/lsb/init-functions## Function that starts the daemon/service#do_start(){# Return# 0 if daemon has been started# 1 if daemon was already running# 2 if daemon could not be startedmkdir -p $RUNDIR || return 2start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \|| return 1start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \$GPSD_OPTIONS -P $PIDFILE $DEVICES \|| return 2}## Function that stops the daemon/service#do_stop(){# Return# 0 if daemon has been stopped# 1 if daemon was already stopped# 2 if daemon could not be stopped# other if a failure occurredstart-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAMERETVAL="$?"[ "$RETVAL" = 2 ] && return 2# Many daemons don't delete their pidfiles when they exit.rm -f $PIDFILEreturn "$RETVAL"}## Function that sends a SIGHUP to the daemon/service#do_reload() {## If the daemon can reload its configuration without# restarting (for example, when it is sent a SIGHUP),# then implement that here.#start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAMEreturn 0}case "$1" instart)if [ "$START_DAEMON" = "true" ]; then[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"do_startcase "$?" in0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;esacelse[ "$VERBOSE" != no ] && \log_daemon_msg "Not starting $DESC" "$NAME" && \log_end_msg 0fi;;stop)[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"do_stopcase "$?" in0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;esac;;status)status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?;;reload|force-reload)log_daemon_msg "Reloading $DESC" "$NAME"do_reloadlog_end_msg $?;;restart)## If the "reload" option is implemented then remove the# 'force-reload' alias#log_daemon_msg "Restarting $DESC" "$NAME"do_stopcase "$?" in0|1)do_startcase "$?" in0) log_end_msg 0 ;;1) log_end_msg 1 ;; # Old process is still running*) log_end_msg 1 ;; # Failed to startesac;;*)# Failed to stoplog_end_msg 1;;esac;;*)echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 exit 3;;esac:On Sat, Aug 6, 2016 at 11:08 PM, Steve Horton <stevejhorton@xxxxxxxxx> wrote:Sorry..i meant your start script. So do you start gpsd after chrony is allready running and the sock created? Does it get built correctly? Can you do a file on it?
On Aug 6, 2016 10:29 PM, "Chris Greenman" <chris.m.greenman@xxxxxxxxx> wrote:No gpsd.conf. /etc/default/gpsd is :cgps shows 3d fix# Default settings for the gpsd init script and the hotplug wrapper.# Start the gpsd daemon automatically at boot timeSTART_DAEMON="true"# Use USB hotplugging to add new USB devices automatically to the daemonUSBAUTO="true"# Devices gpsd should collect to at boot time.# They need to be read/writeable, either by user gpsd or the group dialout.DEVICES="/dev/ttyACM0"# Other options you want to pass to gpsdGPSD_OPTIONS="-F /var/run/chrony.ttyACM0.sock"$ ps -ef |grep gpsd |grep -v grepgpsd 31426 1 0 13:36 ? 00:00:00 /usr/sbin/gpsd -N -F /var/run/chrony.ttyACM0.sock /dev/ttyACM0On Sat, Aug 6, 2016 at 2:11 PM, Steve Horton <stevejhorton@xxxxxxxxxx> wrote:Ok..can I see your gpsd conf?
On Aug 6, 2016 1:39 PM, "Chris Greenman" <chris.m.greenman@xxxxxxxxx> wrote:I only included the relevant lines. When the socket didn't work either I commented it out and went back to shmHere is my full chrony.conf. Note, I commented out the ntp servers so that I can just concentrate on troubleshooting the GPS clock and uncommented the SOCK line#server 0.us.pool.ntp.org#server 1.us.pool.ntp.org#server 2.us.pool.ntp.org#server 3.us.pool.ntp.orgdriftfile /var/lib/chrony/driftallow# set larger delay to allow the NMEA source to overlap with# the other sources and avoid the falseticker statusrefclock SHM 0 refid GPS precision 1e-1 offset 0.9999 delay 0.2#refclock SHM 1 refid PPS precision 1e-9refclock SOCK /var/run/chrony.ttyACM0.sock refid GPSSmakestep 1 -1On Sat, Aug 6, 2016 at 10:41 AM, Steve Horton <stevejhorton@xxxxxxxxx> wrote:,Not really Chris. I don't see a sock option in your configuration file. Gpsd should write time out to a device file some where and chrony can read the time from that device file via a Unix domain socket. Like I said..look into the sock option and how it relates to gpsd.
On Aug 6, 2016 10:10 AM, "Chris Greenman" <chris.m.greenman@xxxxxxxxx> wrote:Same thing. Already tried it.
On Aug 6, 2016 6:35 AM, "Steve Horton" <stevejhorton@xxxxxxxxx> wrote:I'd look closer at the SOCK option under the refclock section. https://chrony.tuxfamily.org/m
anual.html#refclock-directive On Aug 6, 2016 12:00 AM, "Chris Greenman" <chris.m.greenman@xxxxxxxxx> wrote:
>
> Hello,
> I'm having an issue with getting time from gpsd.
>
> My setup is:
> Raspberry Pi 3 running Jessie Lite
> USB U-Blox gps
>
> gpsd is receiving NMEA from the GPS, cgps also shows time and position properly.
>
> My chrony.conf is:
>>
>> server 0.us..pool.ntp.org
>> server 1.us..pool.ntp.org
>> server 2.us..pool.ntp.org
>> server 3.us..pool.ntp.org
>> driftfile /var/lib/chrony/drift
>> allow
>> refclock SHM 0 refid GPS precision 1e-1 offset 0.9999 delay 0.2
>> makestep 1 -1
>>
> Chronyc sources shows this:
>>
>> $ chronyc sources
>> 210 Number of sources = 5
>> MS Name/IP address Stratum Poll Reach LastRx Last sample
>> ============================================================ ===================
>> #? GPS 0 4 0 10y +0ns[ +0ns] +/- 0ns
>> ^+ time-c.nist.gov 1 9 375 110 -23ms[ -22ms] +/- 47ms
>> ^* pool-96-248-122-64.cmdnnj 1 10 377 56 +9749us[ +11ms] +/- 18ms
>> ^- 104.156.99.226 2 9 377 367 +15ms[ +17ms] +/- 107ms
>> ^- 4.53.160.75
>>
> This system is going to be used on a boat and might not have internet. I can tell that both programs are accessing the shared memory using ipcs -m:
>
>> ------ Shared Memory Segments --------
>> key shmid owner perms bytes nattch status
>> 0x4e545030 0 root 600 80 2
>> 0x4e545031 32769 root 600 80 1
>>
> Any idea why chrony isn't getting time from the GPS?
>
> Thanks
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |