Thread: [Linuxptp-users] Question about how to run linuxptp as a service daemon
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: james j. <jam...@gm...> - 2022-08-10 00:14:10
|
Dear, We are using Ubuntu 20.04 LTS. I am trying to use linuxptp as a service daemon rather than an application. (The purpose is to automatically run ptp4l and phc2sys when the Master and Slave devices are booted.) Are there any guide documents or sample scripts for this? Any advice would be appreciated. Regards, |
From: Miroslav L. <mli...@re...> - 2022-08-10 07:21:08
|
On Wed, Aug 10, 2022 at 09:13:53AM +0900, james jeong wrote: > Dear, > > We are using Ubuntu 20.04 LTS. > I am trying to use linuxptp as a service daemon rather than an application. > (The purpose is to automatically run ptp4l and phc2sys when the Master and > Slave devices are booted.) The Ubuntu linuxptp package seems to contain systemd service files: /lib/systemd/system/phc2sys.service /lib/systemd/system/ptp4l.service /lib/systemd/system/timemaster.service and it has configuration files in /etc/linuxptp. You would just edit the configuration and enable the services you need to run. -- Miroslav Lichvar |
From: Keller, J. E <jac...@in...> - 2022-08-10 21:41:40
|
> -----Original Message----- > From: Miroslav Lichvar <mli...@re...> > Sent: Wednesday, August 10, 2022 12:21 AM > To: james jeong <jam...@gm...> > Cc: lin...@li... > Subject: Re: [Linuxptp-users] Question about how to run linuxptp as a service > daemon > > On Wed, Aug 10, 2022 at 09:13:53AM +0900, james jeong wrote: > > Dear, > > > > We are using Ubuntu 20.04 LTS. > > I am trying to use linuxptp as a service daemon rather than an application. > > (The purpose is to automatically run ptp4l and phc2sys when the Master and > > Slave devices are booted.) > > The Ubuntu linuxptp package seems to contain systemd service files: > > /lib/systemd/system/phc2sys.service > /lib/systemd/system/ptp4l.service > /lib/systemd/system/timemaster.service > > and it has configuration files in /etc/linuxptp. > > You would just edit the configuration and enable the services you need > to run. > > -- > Miroslav Lichvar Yep, I'd recommend systemd or another service manager which converts the stdin/stdout behavior of ptp4l into backgrounding. Thanks, Jake |
From: james j. <jam...@gm...> - 2022-08-16 04:24:59
|
Dear, In the path you mentioned, the service files of ph2sys and ptp4l were modified and run according to my environment. ---ptp4l.service---(Master) [Unit] Description=Precision Time Protocol (PTP) service Documentation=man:ptp4l [Service] Type=simple ExecStart=/root/linuxptp-3.1.1/ptp4l -i eno1 -m --step_threshold=1 [Install] WantedBy=multi-user.target ---ptp4l.service---(Slave) [Unit] Description=Precision Time Protocol (PTP) service Documentation=man:ptp4l [Service] Type=simple ExecStart=/root/linuxptp-3.1.1/ptp4l -i ens6f0 -s -m --step_threshold=1 [Install] WantedBy=multi-user.target ----phc2sys.service--- (same content between master and slave) [Unit] Description=Synchronize system clock or PTP hardware clock (PHC) Documentation=man:phc2sys #After=ntpdate.service Requires=ptp4l.service After=ptp4l.service [Service] Type=simple ExecStart=/root/linuxptp-3.1.1/phc2sys -a -r -r -m --step_threshold=1 [Install] WantedBy=multi-user.target However, after booting, the following output is displayed in the phc2sys service of Master and Slave. Aug 16 13:19:59 ozhdr-devel2 phc2sys[1390]: phc2sys[8432.167]: failed to get UTC offset Aug 16 13:19:59 ozhdr-devel2 phc2sys[1390]: [8432.167] failed to get UTC offset Aug 16 13:20:01 ozhdr-devel2 phc2sys[1390]: phc2sys[8434.168]: failed to get UTC offset Aug 16 13:20:01 ozhdr-devel2 phc2sys[1390]: [8434.168] failed to get UTC offset Aug 16 13:20:03 ozhdr-devel2 phc2sys[1390]: phc2sys[8436.169]: failed to get UTC offset Aug 16 13:20:03 ozhdr-devel2 phc2sys[1390]: [8436.169] failed to get UTC offset Aug 16 13:20:05 ozhdr-devel2 phc2sys[1390]: phc2sys[8438.171]: failed to get UTC offset Aug 16 13:20:05 ozhdr-devel2 phc2sys[1390]: [8438.171] failed to get UTC offset Aug 16 13:20:07 ozhdr-devel2 phc2sys[1390]: phc2sys[8440.172]: failed to get UTC offset Aug 16 13:20:07 ozhdr-devel2 phc2sys[1390]: [8440.172] failed to get UTC offset I get this message and the time synchronization doesn't work. But if I manually restart the service in phc2sys (systemctl restart phc2sys.service) the time synchronization works fine. How can I fix this error? Regards, 2022년 8월 10일 (수) 오후 4:20, Miroslav Lichvar <mli...@re...>님이 작성: > > On Wed, Aug 10, 2022 at 09:13:53AM +0900, james jeong wrote: > > Dear, > > > > We are using Ubuntu 20.04 LTS. > > I am trying to use linuxptp as a service daemon rather than an application. > > (The purpose is to automatically run ptp4l and phc2sys when the Master and > > Slave devices are booted.) > > The Ubuntu linuxptp package seems to contain systemd service files: > > /lib/systemd/system/phc2sys.service > /lib/systemd/system/ptp4l.service > /lib/systemd/system/timemaster.service > > and it has configuration files in /etc/linuxptp. > > You would just edit the configuration and enable the services you need > to run. > > -- > Miroslav Lichvar > |
From: james j. <jam...@gm...> - 2022-08-31 00:06:35
|
Could someone give me an answer to this question? Thank you 2022년 8월 16일 (화) 오후 1:24, james jeong <jam...@gm...>님이 작성: > > Dear, > > In the path you mentioned, the service files of ph2sys and ptp4l were > modified and run according to my environment. > > ---ptp4l.service---(Master) > [Unit] > Description=Precision Time Protocol (PTP) service > Documentation=man:ptp4l > > [Service] > Type=simple > ExecStart=/root/linuxptp-3.1.1/ptp4l -i eno1 -m --step_threshold=1 > > [Install] > WantedBy=multi-user.target > > > ---ptp4l.service---(Slave) > [Unit] > Description=Precision Time Protocol (PTP) service > Documentation=man:ptp4l > > [Service] > Type=simple > ExecStart=/root/linuxptp-3.1.1/ptp4l -i ens6f0 -s -m --step_threshold=1 > > [Install] > WantedBy=multi-user.target > > > ----phc2sys.service--- (same content between master and slave) > [Unit] > Description=Synchronize system clock or PTP hardware clock (PHC) > Documentation=man:phc2sys > #After=ntpdate.service > Requires=ptp4l.service > After=ptp4l.service > > [Service] > Type=simple > ExecStart=/root/linuxptp-3.1.1/phc2sys -a -r -r -m --step_threshold=1 > > [Install] > WantedBy=multi-user.target > > > However, after booting, the following output is displayed in the > phc2sys service of Master and Slave. > > Aug 16 13:19:59 ozhdr-devel2 phc2sys[1390]: phc2sys[8432.167]: failed > to get UTC offset > Aug 16 13:19:59 ozhdr-devel2 phc2sys[1390]: [8432.167] failed to get UTC offset > Aug 16 13:20:01 ozhdr-devel2 phc2sys[1390]: phc2sys[8434.168]: failed > to get UTC offset > Aug 16 13:20:01 ozhdr-devel2 phc2sys[1390]: [8434.168] failed to get UTC offset > Aug 16 13:20:03 ozhdr-devel2 phc2sys[1390]: phc2sys[8436.169]: failed > to get UTC offset > Aug 16 13:20:03 ozhdr-devel2 phc2sys[1390]: [8436.169] failed to get UTC offset > Aug 16 13:20:05 ozhdr-devel2 phc2sys[1390]: phc2sys[8438.171]: failed > to get UTC offset > Aug 16 13:20:05 ozhdr-devel2 phc2sys[1390]: [8438.171] failed to get UTC offset > Aug 16 13:20:07 ozhdr-devel2 phc2sys[1390]: phc2sys[8440.172]: failed > to get UTC offset > Aug 16 13:20:07 ozhdr-devel2 phc2sys[1390]: [8440.172] failed to get UTC offset > > I get this message and the time synchronization doesn't work. > But if I manually restart the service in phc2sys (systemctl restart > phc2sys.service) the time synchronization works fine. > > How can I fix this error? > > Regards, > > > > 2022년 8월 10일 (수) 오후 4:20, Miroslav Lichvar <mli...@re...>님이 작성: > > > > On Wed, Aug 10, 2022 at 09:13:53AM +0900, james jeong wrote: > > > Dear, > > > > > > We are using Ubuntu 20.04 LTS. > > > I am trying to use linuxptp as a service daemon rather than an application. > > > (The purpose is to automatically run ptp4l and phc2sys when the Master and > > > Slave devices are booted.) > > > > The Ubuntu linuxptp package seems to contain systemd service files: > > > > /lib/systemd/system/phc2sys.service > > /lib/systemd/system/ptp4l.service > > /lib/systemd/system/timemaster.service > > > > and it has configuration files in /etc/linuxptp. > > > > You would just edit the configuration and enable the services you need > > to run. > > > > -- > > Miroslav Lichvar > > |
From: Hussamuddin N. <na...@ne...> - 2022-08-31 13:25:09
|
Make sure your systemd script starts the daemon after the network is online. -- cheers, Hussam (Hussamuddin Nasir) Netlab, GENI and FABRIC Operations Team ------------------------------------------------------------------- Laboratory for Adv. Networking Phone : (859)218-0059 James F Hardymon Building Fax : (859)323-3740 301 Rose Street, Rm 237 E-mail : na...@ne... Lexington, KY 40506-0495 Web : http://www.netlab.uky.edu University of Kentucky ********************** ------------------------------------------------------------------- On 8/30/22 20:06, james jeong wrote: > Could someone give me an answer to this question? > > Thank you > > 2022년 8월 16일 (화) 오후 1:24, james jeong <jam...@gm...>님이 작성: >> Dear, >> >> In the path you mentioned, the service files of ph2sys and ptp4l were >> modified and run according to my environment. >> >> ---ptp4l.service---(Master) >> [Unit] >> Description=Precision Time Protocol (PTP) service >> Documentation=man:ptp4l >> >> [Service] >> Type=simple >> ExecStart=/root/linuxptp-3.1.1/ptp4l -i eno1 -m --step_threshold=1 >> >> [Install] >> WantedBy=multi-user.target >> >> >> ---ptp4l.service---(Slave) >> [Unit] >> Description=Precision Time Protocol (PTP) service >> Documentation=man:ptp4l >> >> [Service] >> Type=simple >> ExecStart=/root/linuxptp-3.1.1/ptp4l -i ens6f0 -s -m --step_threshold=1 >> >> [Install] >> WantedBy=multi-user.target >> >> >> ----phc2sys.service--- (same content between master and slave) >> [Unit] >> Description=Synchronize system clock or PTP hardware clock (PHC) >> Documentation=man:phc2sys >> #After=ntpdate.service >> Requires=ptp4l.service >> After=ptp4l.service >> >> [Service] >> Type=simple >> ExecStart=/root/linuxptp-3.1.1/phc2sys -a -r -r -m --step_threshold=1 >> >> [Install] >> WantedBy=multi-user.target >> >> >> However, after booting, the following output is displayed in the >> phc2sys service of Master and Slave. >> >> Aug 16 13:19:59 ozhdr-devel2 phc2sys[1390]: phc2sys[8432.167]: failed >> to get UTC offset >> Aug 16 13:19:59 ozhdr-devel2 phc2sys[1390]: [8432.167] failed to get UTC offset >> Aug 16 13:20:01 ozhdr-devel2 phc2sys[1390]: phc2sys[8434.168]: failed >> to get UTC offset >> Aug 16 13:20:01 ozhdr-devel2 phc2sys[1390]: [8434.168] failed to get UTC offset >> Aug 16 13:20:03 ozhdr-devel2 phc2sys[1390]: phc2sys[8436.169]: failed >> to get UTC offset >> Aug 16 13:20:03 ozhdr-devel2 phc2sys[1390]: [8436.169] failed to get UTC offset >> Aug 16 13:20:05 ozhdr-devel2 phc2sys[1390]: phc2sys[8438.171]: failed >> to get UTC offset >> Aug 16 13:20:05 ozhdr-devel2 phc2sys[1390]: [8438.171] failed to get UTC offset >> Aug 16 13:20:07 ozhdr-devel2 phc2sys[1390]: phc2sys[8440.172]: failed >> to get UTC offset >> Aug 16 13:20:07 ozhdr-devel2 phc2sys[1390]: [8440.172] failed to get UTC offset >> >> I get this message and the time synchronization doesn't work. >> But if I manually restart the service in phc2sys (systemctl restart >> phc2sys.service) the time synchronization works fine. >> >> How can I fix this error? >> >> Regards, >> >> >> >> 2022년 8월 10일 (수) 오후 4:20, Miroslav Lichvar <mli...@re...>님이 작성: >>> On Wed, Aug 10, 2022 at 09:13:53AM +0900, james jeong wrote: >>>> Dear, >>>> >>>> We are using Ubuntu 20.04 LTS. >>>> I am trying to use linuxptp as a service daemon rather than an application. >>>> (The purpose is to automatically run ptp4l and phc2sys when the Master and >>>> Slave devices are booted.) >>> The Ubuntu linuxptp package seems to contain systemd service files: >>> >>> /lib/systemd/system/phc2sys.service >>> /lib/systemd/system/ptp4l.service >>> /lib/systemd/system/timemaster.service >>> >>> and it has configuration files in /etc/linuxptp. >>> >>> You would just edit the configuration and enable the services you need >>> to run. >>> >>> -- >>> Miroslav Lichvar >>> > > _______________________________________________ > Linuxptp-users mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linuxptp-users |