Re: systemd/dhcp v. ntpd
Hi.
On Wed, Feb 09, 2022 at 09:05:51AM -0500, Lee wrote:
> On 2/8/22, Greg Wooledge <greg@wooledge.org> wrote:
> > On Tue, Feb 08, 2022 at 02:43:02PM -0500, Lee wrote:
> >> How to tell systemd to leave the ntpd config alone?
> >
> > What makes you think the two are connected in any way?
>
> $ grep "Network Time Service" syslog
> Feb 6 12:06:48 spot systemd[1]: Stopping Network Time Service...
> Feb 6 12:06:48 spot systemd[1]: Stopped Network Time Service.
> Feb 6 12:06:48 spot systemd[1]: Starting Network Time Service...
> Feb 6 12:06:48 spot systemd[1]: Started Network Time Service.
> Feb 6 12:09:25 spot systemd[1]: Stopping Network Time Service...
> Feb 6 12:09:25 spot systemd[1]: Stopped Network Time Service.
> Feb 6 12:09:25 spot systemd[1]: Starting Network Time Service...
> Feb 6 12:09:25 spot systemd[1]: Started Network Time Service.
> Feb 6 12:22:53 spot systemd[1]: Stopping Network Time Service...
> Feb 6 12:22:53 spot systemd[1]: Stopped Network Time Service.
> Feb 6 12:22:53 spot systemd[1]: Starting Network Time Service...
> Feb 6 12:22:53 spot systemd[1]: Started Network Time Service.
> ... etc
>
> every time I connect or disconnect from a wifi network.
Or it could mean that dhclient hook merely asks systemd to restart ntpd
service. See /etc/dhcp/dhclient-exit-hooks.d/ntp.
> My first thought was telling the machine to ignore the NTP server
> address handed out via DHCP. Maybe there's a way to do that, but I
> couldn't figure out how :(
supercede ntp-servers "..." in dhclient.conf should do it for you.
The option was helpfully provided by dhclient.conf(5).
> >> I tried changing /etc/dhcp/dhclient.conf to request just
> >> request subnet-mask, broadcast-address, routers,
> >> interface-mtu,
> >> rfc3442-classless-static-routes ;
> >>
> >> and systemd still restarted ntpd with only the dhcp supplied ntp
> >> server address ... which is this machine, so all the configured ntp
> >> servers went away :(
And that merely stopped dhclient from asking DHCP server to provide
"ntp-server" option. What it cannot stop is DHCP server providing
"ntp-server" option anyway.
ISC dhclient simply lacks the option to ignore certain options in DHCP
reply. It can supercede them though.
> >> I then tried telling network manager to just get an ip address &
> >> subnet mask from dhcp. And still systemd fucked up the ntpd config
> >>
> >> What finally worked was editing /usr/lib/ntp/ntp-systemd-wrapper to
> >> remove ' NTPD_OPTS="$NTPD_OPTS -u $UGID" '
> >
> > Huh? You're saying that removing the "-u $UGID" option made it "work"?
> > And that it "didn't work" with -u being passed?
Changing the contents of /etc/dhcp/dhclient-exit-hooks.d/ntp would make
it more friendly for the purpose of the future updates.
Reco
Reply to: