Menu

ptpd doesn't start, log: Debian, Raspbe...

Help
2012-09-22
2012-11-23
  • Tom Ritchford

    Tom Ritchford - 2012-09-22

    Hello, Precise people.

    I'm trying to run ptpd on Debian, in particular the Raspbian dialect that runs on the new, tiny Raspberry Pi platform.  I've so far had good success installing and running other packages, but ptp doesn't run and doesn't give me any feedback.

    Running as root, I installed the package successfully using apt-get, turned off ntp, and then started ptpd using /etc/init.d/ptpd.  The result was… nothing at all.  Specifically, I don't find any ptp process running using ps, and nothing seems to have been written to logs in /var/log. 

    Still as root, I tried running the daemon by hand using

      /usr/sbin/ptpd  -l /var/log/ptpd.log

    but again, nothing happened - /var/log/ptpd.log isn't even created.

    There is certainly more I can do - even going as far as recompiling ptp with my own logging - but i thought I'd stop here and see if the collective wisdom of the group here had any insight for me.

    I understand that I might be the first person to attempt to run ptpd on the Raspberry Pi, and if needs be I can certainly limp along with ntp, but in the medium-term I'm quite interested in getting this to work and prepared to invest some time into this.

    Thanks in advance!

     
  • Tom Ritchford

    Tom Ritchford - 2012-09-25

    Don't all rush up at once.  :-/

     
  • Jan Breuer

    Jan Breuer - 2012-09-26

    PTPd has weird command line switches. Try to run ptpd with -H option to see all options. After that, try to run ptpd in non-daemon mode with -c to see everything is ok.

    If you want to log output to file, use -f /var/log/ptpd.log option.

    All these implies, that you have ptpd version 2.1.0
    These switches are different in later versions 2.2.x and 2.3.0-svn

     
  • Tom Ritchford

    Tom Ritchford - 2012-09-26

    Hello, and thanks for your reply (and OOPS for me in reporting -f as -l).

    Unfortunately, I continue to get "nothing at all" from ptpd, despite trying -c and a few other options.

    For example, running

    $ ptpd -c -f /var/log/ptpd.log
    

    creates the logfile - but puts nothing in it - and the program neither terminates nor prints anything on the console, but continues doing nothing till I control-C out of it.

    $ ptpd -cd
    

    prints:

    state: 2012-09-26 19:03:45:567644, mst (ID:b827ebfffeb3ff2c)
    

    and then neither terminates nor prints anything else until I break out of it.

    So it DOES run when I use -c - but I have no idea if it's doing anything or not (I note with regret the lack of a -verbose flag).

    So three questions…

    1. How do I know if ptpd is doing anything or not?
    2. Why does ptpd run from the command line and at least not fail, but doesn't start any process as a daemon?
    3. If I wanted to continue to debug this, should I go to the ptpd2 source code?

    Thanks again!  It would be advantageous for everyone if ptpd ran on the Raspberry Pi as people are doing a lot of time-oriented things with it…

     
  • Tom Ritchford

    Tom Ritchford - 2012-09-26

    All right!

    Some progress here - perhaps good progress!

    I downloaded the source of ptpd2 and compiled - it compiled and ran right the first time but had the same issues as before of not obviously doing anything.  :-)

    So I recompiled with debug - specifically

    CFLAGS += -Wall -DBSD_INTERFACE_FUNCTIONS -DPTPD_DBGV -g -O0
    

    .   The flag  -DPTPD_DBGV does enable a lot more logging - and I see things happening (which I'll post in gory detail below).

    From my reading of these messages, I'm believing that ptpd2 is in fact doing its job, synchronizing my kernel time and all that.  Am I right?

    If so, this is good news…!

    More comments/questions:

    1. It'd be great to get ptpd2 installable through apt-get.  I'm not sure how that works but would be willing find out or help.
    2. I still think a little more logging in the non-debug case would be useful, if only to say, "Yes, I've started up and will now synchronize your clock."

    Thanks again for your kind attention!

    --- long, boring log file below --

    (ptpd debug) allocated 1176 bytes for protocol engine data
    (ptpd debug) allocated 420 bytes for foreign master data
    (ptpd notice) ptpd 2.1.0alpha.p1 started
    (ptpd debug) event POWERUP
    (ptpd debug) state PTP_INITIALIZING
    (ptpd debug) Debug Initializing...(ptpd debug) manufacturerIdentity: MaceG VanKempen;2.0.0
    (ptpd debug) netInit
    (ptpd debug) 0 lo 127.0.0.1
    (ptpd debug) does not meet requirements(00000049, 00001041)
    (ptpd debug) 1 eth0 192.168.0.101
    (ptpd debug) found interface (eth0)
    (ptpd debug) Local IP address used : 192.168.0.101
    (ptpd debug) initData
    (ptpd debug) initTimer
    (ptpd debug) initClock
    (ptpd debug) state PTP_LISTENING
    (ptpd debug) timerStart: set timer 3 to 12.000
    (ptpd debug) activity
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate: timer 3 expired
    (ptpd debug) event ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
    (ptpd debug) state PTP_MASTER
    (ptpd debug) timerStart: set timer 2 to 1.000
    (ptpd debug) SYNC INTERVAL TIMER : 1.000000
    (ptpd debug) timerStart: set timer 4 to 2.000
    (ptpd debug) timerStart: set timer 0 to 2.000
    (ptpd debug) timerUpdate
    (ptpd debug) activity
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate: timer 2 expired
    (ptpd debug) event SYNC_INTERVAL_TIMEOUT_EXPIRES
    (ptpd debug) Sync MSG sent !
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) handle: something
    (ptpd debug) kernel recv time stamp 1348689371s 320671000ns
    (ptpd debug) Message header :
    (ptpd debug)
    (ptpd debug) transportSpecific : 8
    (ptpd debug) messageType : 0
    (ptpd debug) versionPTP : 2
    (ptpd debug) messageLength : 44
    (ptpd debug) domainNumber : 0
    (ptpd debug) FlagField 02:00
    (ptpd debug) Integer 64 :
    (ptpd debug) LSB : 0
    (ptpd debug) MSB : 0
    (ptpd debug) ClockIdentity : b8:27:eb:ff:fe:b3:ff:2c
    (ptpd debug) port number : 1
    (ptpd debug) sequenceId : 0
    (ptpd debug) controlField : 0
    (ptpd debug) logMessageInterval : 0
    (ptpd debug)
    (ptpd debug) received SYNC message, entering handleSync()
    (ptpd debug) Sync message received :
    (ptpd debug) FollowUp MSG sent !
    (ptpd debug) activity
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) handle: something
    (ptpd debug) kernel recv time stamp 1348689371s 322424000ns
    (ptpd debug) Message header :
    (ptpd debug)
    (ptpd debug) transportSpecific : 8
    (ptpd debug) messageType : 8
    (ptpd debug) versionPTP : 2
    (ptpd debug) messageLength : 44
    (ptpd debug) domainNumber : 0
    (ptpd debug) FlagField 02:00
    (ptpd debug) Integer 64 :
    (ptpd debug) LSB : 0
    (ptpd debug) MSB : 0
    (ptpd debug) ClockIdentity : b8:27:eb:ff:fe:b3:ff:2c
    (ptpd debug) port number : 1
    (ptpd debug) sequenceId : 0
    (ptpd debug) controlField : 2
    (ptpd debug) logMessageInterval : 0
    (ptpd debug)
    (ptpd debug) received FOLLOW_UP message, entering handleFollowUp()
    (ptpd debug) Handlefollowup : Follow up message received
    (ptpd debug) Handlefollowup : Ignore message from self
    (ptpd debug) activity
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate
    (ptpd debug) catch_alarm: elapsed 1
    (ptpd debug) timerUpdate
    (ptpd debug) timerUpdate: timer 0 expired
    (ptpd debug) timerUpdate: timer 2 expired
    (ptpd debug) timerUpdate: timer 4 expired
    

    … more of the same.

     
  • Wojciech Owczarek

    Tom,

    One (potentially VERY) important thing to remember is that ptpd only sends timing statistics to /var/log/ptpd.log! All the rest (which is probably what you're really looking for) such as state changes etc, by default goes to syslog so most likely to /var/log/messages. You can bypass syslog with "-S" in which case all your logs should be merged.

    Cheers
    Woj

     

Log in to post a comment.