Fwd: local/etc/rc.d service that runs before date being set by ntpd

From: Nuno Teixeira <eduardo_at_freebsd.org>
Date: Thu, 28 Mar 2024 10:56:44 UTC
[forgot to include this list on reply]

---------- Forwarded message ---------
De: Nuno Teixeira <eduardo@freebsd.org>
Date: quarta, 27/03/2024 à(s) 12:53
Subject: Re: local/etc/rc.d service that runs before date being set by ntpd
To: Ronald Klop <ronald-lists@klop.ws>


Hello Ronald!

Setting:
ntpdate_enable="YES"
ntpd_enable="YES"
fixes it.

I took my config:
ntpd_enable="YES"
ntpd_sync_on_start="YES"

from https://forums.freebsd.org/threads/ntpdate-settings-in-14-0.91115/
related to ntpdate deprecation and recommendation to use ntpd -g flag.

-g, --panicgate
             Allow the first adjustment to be Big.  This option may appear an
             unlimited number of times.

I will install sysutils/fakertc since I use ZFS.

Thanks!

Ronald Klop <ronald-lists@klop.ws> escreveu (quarta, 27/03/2024 à(s) 12:09):
>
>
> Van: Nuno Teixeira <eduardo@freebsd.org>
> Datum: woensdag, 27 maart 2024 10:55
> Aan: FreeBSD ARM List <freebsd-arm@freebsd.org>
> Onderwerp: local/etc/rc.d service that runs before date being set by ntpd
>
> Hello all,
>
> On rpi4 I use a service dns/noip and found that it don't get actual date from ntpd:
>
> /var/log/daemon.log (today) after boot
> ---
> <snip>
> Mar 27 09:09:40 rpi4 dhclient[1183]: DHCPREQUEST on genet0 to 192.168.1.1 port 67
> Mar 27 09:09:40 rpi4 dhclient[1183]: DHCPACK from 192.168.1.1
> Mar 27 09:09:40 rpi4 dhclient[1183]: bound to 192.168.1.66 -- renewal in 1800 seconds.
> Jan  1 01:00:34 rpi4 noip2[1617]: v2.1.9 daemon started with NAT enabled
> Jan  1 01:00:35 rpi4 noip2[1617]: freebsdrpi4.hopto.org was already set to 149.90.156.215.
> <service noip restart>
> Mar 27 09:26:13 rpi4 noip2[1617]: v2.1.9 daemon ended.
> Mar 27 09:26:13 rpi4 noip2[1887]: v2.1.9 daemon started with NAT enabled
> Mar 27 09:26:14 rpi4 noip2[1887]: freebsdrpi4.hopto.org was already set to 149.90.156.215.
> ---
>
> rcconf:
> ntpd_enable="YES"
> ntpd_sync_on_start="YES"
>
> Checking `rcorder /etc/rc.d/* /usr/local/etc/rcd/*` have correct order (?):
>
> <snip>
>
> /etc/rc.d/ntpdate
> ...
> /etc/rc.d/sdpd
> /etc/rc.d/rarpd
> /etc/rc.d/powerd
> /etc/rc.d/ntpd
> /etc/rc.d/nscd
> /usr/local/etc/rc.d/dbus
> /usr/local/etc/rc.d/git_daemon
> /usr/local/etc/rc.d/noip
> /etc/rc.d/rfcomm_pppd_server
> /etc/rc.d/mountd
> /etc/rc.d/swaplate
> ...
>
> Strange that noip doesn't get correct date at boot time.
>
> Do I missing something?
>
> Thanks!
>
> --
> Nuno Teixeira
> FreeBSD Committer (ports)
>
>
>
> Hi,
>
> In my rcorder output noip2 comes before ntpd.
> But I have in rc.conf:
> ntpdate_enable="YES"
> ntpd_enable="YES"
>
> ntpdate is run more early in the rcorder.
>
> I don't know about ntpd_sync_on_start and if that influences the rcorder. I think it is just an option to ntpd.
>
> Please try to add ntpdate_enable="YES".
>
> BTW: if you run ZFS-on-boot on RPI you can use sysutils/fakertc to get a bit better time at boot. In UFS the time is stored on disk on unmount/shutdown which is used to set the time on startup. ZFS does not have this feature. Fakertc mimics this as good as it can which can help to have a "decent" time to make TLS certificates, etc. valid on boot.
>
> Regards,
> Ronald.
>



--
Nuno Teixeira
FreeBSD Committer (ports)


-- 
Nuno Teixeira
FreeBSD Committer (ports)