All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Update the current date using ntp.
@ 2018-10-15 16:47 Oscar Gomez Fuente
  2018-10-15 16:57 ` Matthew Weber
  0 siblings, 1 reply; 9+ messages in thread
From: Oscar Gomez Fuente @ 2018-10-15 16:47 UTC (permalink / raw)
  To: buildroot

Hi everyone,

I'm using ntp from buildroot 2018.02.5 in a Rapberry Pi 3B+ HW
platform. These are the packages selected from: Target packages ->
Networking applications

ntp
ntpd
ntpdate

The problem is that ntpd takes around 300 seconds to update the
current date. Is there any way to speed up this process? I have to
wait until the date is updated before doing my tasks and it is very
annoying to wait around 300 seconds.

Best regards.

Oscar Gomez Fuente
TST Sistemas
www.tst-sistemas.es

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] Update the current date using ntp.
  2018-10-15 16:47 [Buildroot] Update the current date using ntp Oscar Gomez Fuente
@ 2018-10-15 16:57 ` Matthew Weber
  2018-10-15 21:35   ` Arnout Vandecappelle
  0 siblings, 1 reply; 9+ messages in thread
From: Matthew Weber @ 2018-10-15 16:57 UTC (permalink / raw)
  To: buildroot

Oscar,

On Mon, Oct 15, 2018 at 11:48 AM Oscar Gomez Fuente
<oscargomezf@gmail.com> wrote:
>
> Hi everyone,
>
> I'm using ntp from buildroot 2018.02.5 in a Rapberry Pi 3B+ HW
> platform. These are the packages selected from: Target packages ->
> Networking applications
>
> ntp
> ntpd
> ntpdate
>
> The problem is that ntpd takes around 300 seconds to update the
> current date. Is there any way to speed up this process? I have to
> wait until the date is updated before doing my tasks and it is very
> annoying to wait around 300 seconds.
>

By default NTP is going to take a period of time to sync as the clock
will be way out of check > 1000 sec.  Most distros use ntpdate or the
new ntpd -q to get the initial time jammed in and then start ntpd to
maintain.

Matt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] Update the current date using ntp.
  2018-10-15 16:57 ` Matthew Weber
@ 2018-10-15 21:35   ` Arnout Vandecappelle
  2018-10-16  5:26     ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Arnout Vandecappelle @ 2018-10-15 21:35 UTC (permalink / raw)
  To: buildroot



On 15/10/18 18:57, Matthew Weber wrote:
> Oscar,
> 
> On Mon, Oct 15, 2018 at 11:48 AM Oscar Gomez Fuente
> <oscargomezf@gmail.com> wrote:
>>
>> Hi everyone,
>>
>> I'm using ntp from buildroot 2018.02.5 in a Rapberry Pi 3B+ HW
>> platform. These are the packages selected from: Target packages ->
>> Networking applications
>>
>> ntp
>> ntpd
>> ntpdate
>>
>> The problem is that ntpd takes around 300 seconds to update the
>> current date. Is there any way to speed up this process? I have to
>> wait until the date is updated before doing my tasks and it is very
>> annoying to wait around 300 seconds.
>>
> 
> By default NTP is going to take a period of time to sync as the clock
> will be way out of check > 1000 sec.  Most distros use ntpdate or the
> new ntpd -q to get the initial time jammed in and then start ntpd to
> maintain.

 I believe chrony does all this automatically. I've used chrony on boards
without battery-backed RTC and the time is correct when I log in, without any
magic added by me.

 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] Update the current date using ntp.
  2018-10-15 21:35   ` Arnout Vandecappelle
@ 2018-10-16  5:26     ` Peter Korsgaard
  2018-10-16  8:41       ` Oscar Gomez Fuente
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2018-10-16  5:26 UTC (permalink / raw)
  To: buildroot

>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

Hi,

 >  I believe chrony does all this automatically. I've used chrony on boards
 > without battery-backed RTC and the time is correct when I log in, without any
 > magic added by me.

FYI, this can be finetuned by the makestep configuration option:

https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#makestep

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] Update the current date using ntp.
  2018-10-16  5:26     ` Peter Korsgaard
@ 2018-10-16  8:41       ` Oscar Gomez Fuente
  2018-10-16 10:02         ` Peter Korsgaard
  0 siblings, 1 reply; 9+ messages in thread
From: Oscar Gomez Fuente @ 2018-10-16  8:41 UTC (permalink / raw)
  To: buildroot

Hi everyone,


I was trying on chrony (version 3.4) on my Raspberry Pi 3b+ but it
seems to be that it fails wit this message:

Could not open configuration file /etc/chrony.conf : No such file or directory

I think that it has to be added a chrony.conf default file in
../package/chrony and it has to installed in /etc.


Best regards.

Oscar Gomez Fuente
TST Sistemas
www.tst-sistemas.es


On Tue, 16 Oct 2018 at 07:26, Peter Korsgaard <peter@korsgaard.com> wrote:
>
> >>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:
>
> Hi,
>
>  >  I believe chrony does all this automatically. I've used chrony on boards
>  > without battery-backed RTC and the time is correct when I log in, without any
>  > magic added by me.
>
> FYI, this can be finetuned by the makestep configuration option:
>
> https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#makestep
>
> --
> Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] Update the current date using ntp.
  2018-10-16  8:41       ` Oscar Gomez Fuente
@ 2018-10-16 10:02         ` Peter Korsgaard
  2018-10-16 10:27           ` Oscar Gomez Fuente
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2018-10-16 10:02 UTC (permalink / raw)
  To: buildroot

>>>>> "Oscar" == Oscar Gomez Fuente <oscargomezf@gmail.com> writes:

 > Hi everyone,
 > I was trying on chrony (version 3.4) on my Raspberry Pi 3b+ but it
 > seems to be that it fails wit this message:

 > Could not open configuration file /etc/chrony.conf : No such file or directory

 > I think that it has to be added a chrony.conf default file in
 > ../package/chrony and it has to installed in /etc.

Well, the question is what should the default configuration be exactly?
We have a lot of packages that do not provide any default configuration.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] Update the current date using ntp.
  2018-10-16 10:02         ` Peter Korsgaard
@ 2018-10-16 10:27           ` Oscar Gomez Fuente
  2018-10-16 15:24             ` Matthew Weber
  0 siblings, 1 reply; 9+ messages in thread
From: Oscar Gomez Fuente @ 2018-10-16 10:27 UTC (permalink / raw)
  To: buildroot

Hi Peter

> Well, the question is what should the default configuration be exactly?
> We have a lot of packages that do not provide any default configuration.

I don't know, but I think it should have a default  /etc/chrony.conf
because right now chrony is not working.

Finally, I'm using ntpd and I made this change in the script S49ntp in
order to execute ntpdate before running the ntpd demon:

#! /bin/sh

NAME=ntpd

# Read config file if it is present.
if [ -r /etc/default/$NAME ]; then
. /etc/default/$NAME
fi

case $1 in
start)
        printf "Starting $NAME: "
        NUM_SERVER=0
        CURRENT_DATE=$(date | grep "1970")
        while [ "$NUM_SERVER" != "3" -a "$CURRENT_DATE" = "1970" ];
        do
                /usr/bin/ntpdate $NUM_SERVER.pool.ntp.org > /dev/null 2>&1
                CURRENT_DATE=$(date | grep "1970")
                NUM_SERVER=$(( $NUM_SERVER + 1 ))
        done
        start-stop-daemon -S -q -x /usr/sbin/ntpd -- -g
        [ $? = 0 ] && echo "OK" || echo "FAIL"
        ;;
stop)
        printf "Stopping $NAME: "
        start-stop-daemon -K -q -n $NAME
        [ $? = 0 ] && echo "OK" || echo "FAIL"
        ;;
restart|reload)
        echo "Restarting $NAME: "
        $0 stop
        sleep 1
        $0 start
        ;;
*)
        echo "Usage: $0 {start|stop|restart|reload}" >&2
        exit 1
        ;;
esac

exit 0

Best regards.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] Update the current date using ntp.
  2018-10-16 10:27           ` Oscar Gomez Fuente
@ 2018-10-16 15:24             ` Matthew Weber
  2018-10-16 15:54               ` Oscar Gomez Fuente
  0 siblings, 1 reply; 9+ messages in thread
From: Matthew Weber @ 2018-10-16 15:24 UTC (permalink / raw)
  To: buildroot

Oscar,

On Tue, Oct 16, 2018 at 5:28 AM Oscar Gomez Fuente
<oscargomezf@gmail.com> wrote:
>
> Hi Peter
>
> > Well, the question is what should the default configuration be exactly?
> > We have a lot of packages that do not provide any default configuration.
>
> I don't know, but I think it should have a default  /etc/chrony.conf
> because right now chrony is not working.
>
> Finally, I'm using ntpd and I made this change in the script S49ntp in
> order to execute ntpdate before running the ntpd demon:
>
> #! /bin/sh
>
> NAME=ntpd
>
> # Read config file if it is present.
> if [ -r /etc/default/$NAME ]; then
> . /etc/default/$NAME
> fi
>
> case $1 in
> start)
>         printf "Starting $NAME: "
>         NUM_SERVER=0
>         CURRENT_DATE=$(date | grep "1970")
>         while [ "$NUM_SERVER" != "3" -a "$CURRENT_DATE" = "1970" ];
>         do
>                 /usr/bin/ntpdate $NUM_SERVER.pool.ntp.org > /dev/null 2>&1
>                 CURRENT_DATE=$(date | grep "1970")
>                 NUM_SERVER=$(( $NUM_SERVER + 1 ))
>         done

Care to submit a patch with this?  If it was pulled as an example from
another distro, be sure to cite that in the description.

>         start-stop-daemon -S -q -x /usr/sbin/ntpd -- -g
>         [ $? = 0 ] && echo "OK" || echo "FAIL"
>         ;;
> stop)
>         printf "Stopping $NAME: "
>         start-stop-daemon -K -q -n $NAME
>         [ $? = 0 ] && echo "OK" || echo "FAIL"
>         ;;
> restart|reload)
>         echo "Restarting $NAME: "
>         $0 stop
>         sleep 1
>         $0 start
>         ;;
> *)
>         echo "Usage: $0 {start|stop|restart|reload}" >&2
>         exit 1
>         ;;
> esac
>
> exit 0
>
> Best regards.



-- 
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / RC Linux Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA
www.rockwellcollins.com

Note: Any Export License Required Information and License Restricted
Third Party Intellectual Property (TPIP) content must be encrypted and
sent to matthew.weber at corp.rockwellcollins.com.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] Update the current date using ntp.
  2018-10-16 15:24             ` Matthew Weber
@ 2018-10-16 15:54               ` Oscar Gomez Fuente
  0 siblings, 0 replies; 9+ messages in thread
From: Oscar Gomez Fuente @ 2018-10-16 15:54 UTC (permalink / raw)
  To: buildroot

Hi Matthew,

> > I don't know, but I think it should have a default  /etc/chrony.conf
> > because right now chrony is not working.

The script was made on my own and ff course, I don't care to
send a patch with this changes. I fixed some mistakes and
I added an option in case you don't have the package ntpdate
selected. The final S49ntp script is:

-------
#! /bin/sh

NAME=ntpd
NTPDATE=/usr/bin/ntpdate

# Read config file if it is present.
if [ -r /etc/default/$NAME ]; then
. /etc/default/$NAME
fi

case $1 in
start)
        printf "Starting $NAME: "
        if [ -f $NTPDATE ]
        then
                NUM_SERVER=0
                CURRENT_DATE=$(date | grep "1970")
                while [ "$NUM_SERVER" != "4" -a "$CURRENT_DATE" != "" ]
                do
                        $NTPDATE $NUM_SERVER.pool.ntp.org > /dev/null 2>&1
                        CURRENT_DATE=$(date | grep "1970")
                        NUM_SERVER=$(( $NUM_SERVER + 1 ))
                done
        fi
        start-stop-daemon -S -q -x /usr/sbin/ntpd -- -g
        [ $? = 0 ] && echo "OK" || echo "FAIL"
        ;;
stop)
        printf "Stopping $NAME: "
        start-stop-daemon -K -q -n $NAME
        [ $? = 0 ] && echo "OK" || echo "FAIL"
        ;;
restart|reload)
        echo "Restarting $NAME: "
        $0 stop
        sleep 1
        $0 start
        ;;
*)
        echo "Usage: $0 {start|stop|restart|reload}" >&2
        exit 1
        ;;
esac

exit 0
-------

I've never sent a patch to buildroot, I expect to do it well.


Best regards.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-10-16 15:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 16:47 [Buildroot] Update the current date using ntp Oscar Gomez Fuente
2018-10-15 16:57 ` Matthew Weber
2018-10-15 21:35   ` Arnout Vandecappelle
2018-10-16  5:26     ` Peter Korsgaard
2018-10-16  8:41       ` Oscar Gomez Fuente
2018-10-16 10:02         ` Peter Korsgaard
2018-10-16 10:27           ` Oscar Gomez Fuente
2018-10-16 15:24             ` Matthew Weber
2018-10-16 15:54               ` Oscar Gomez Fuente

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.