0

I've read a few posts on here about this and I can't seem to solve it. The NTP service will not start with my pi.

Model 4B Revision 1.2 (4 GB)

I'm in a situation where the pi is blocked from internet but we have some local time servers setup. When I manually run:

   sudo ntpdate -s 192.168.2.247

This works fine and updates to the correct time from our local server, but the service will not start with the pi booting and I cant figure out why.

I have disabled systemd-timesyncd

Output of status on ntp: sudo service ntp status

● ntp.service - Network Time Service
   Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2022-09-23 17:16:34 MST; 1min 32s ago
     Docs: man:ntpd(8)
  Process: 468 ExecStart=/usr/lib/ntp/ntp-systemd-wrapper (code=exited, status=0/SUCCESS)
 Main PID: 499 (ntpd)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/ntp.service
           └─499 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 111:116

Sep 23 17:16:34 allsky ntpd[499]: Listening on routing socket on fd #20 for interface updates
Sep 23 17:16:34 allsky ntpd[499]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
Sep 23 17:16:34 allsky ntpd[499]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
Sep 23 17:16:44 allsky ntpd[499]: bind(23) AF_INET6 fe80::af86:b202:dbb6:9953%2#123 flags 0x11 failed: Cannot assi
Sep 23 17:16:44 allsky ntpd[499]: unable to create socket on eth0 (4) for fe80::af86:b202:dbb6:9953%2#123
Sep 23 17:16:44 allsky ntpd[499]: failed to init interface for address fe80::af86:b202:dbb6:9953%2
Sep 23 17:16:46 allsky ntpd[499]: Listen normally on 5 eth0 [fe80::af86:b202:dbb6:9953%2]:123
Sep 23 17:16:46 allsky ntpd[499]: new interface(s) found: waking up resolver
Sep 23 17:16:49 allsky ntpd[499]: Listen normally on 6 eth0 192.167.1.52:123
Sep 23 17:16:49 allsky ntpd[499]: new interface(s) found: waking up resolver

Config file:

cat /etc/ntp.conf
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

# Leap seconds definition provided by tzdata
leapfile /usr/share/zoneinfo/leap-seconds.list

# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable


# You do need to talk to an NTP server or two (or three).
#server ntp.your-provider.example
server  192.168.2.248
server  192.168.2.52
server  192.168.2.55
server  192.168.2.17
#server 192.168.2.16
#server 192.168.2.247

# pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
# pick a different set every time it starts up.  Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
pool 0.debian.pool.ntp.org iburst
#pool 1.debian.pool.ntp.org iburst
#pool 2.debian.pool.ntp.org iburst
#pool 3.debian.pool.ntp.org iburst


# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Needed for adding pool entries
restrict source notrap nomodify noquery

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth

#broadcastclient

timedatectl status

               Local time: Fri 2022-09-23 17:21:14 MST
           Universal time: Sat 2022-09-24 00:21:14 UTC
                 RTC time: n/a
                Time zone: America/Phoenix (MST, -0700)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: no

Thanks!

6
  • 1
    TLDR; "I have disabled systemd-timesyncd". Why did you do this? systemd-timesyncd is (or was when the question last arose) intelligent enough to make adjustments if it detected ntp was installed. REFERENCE. If that doesn't sort it out for you, please let us know & we'll take another look at your details.
    – Seamus
    Sep 24, 2022 at 0:40
  • I read on another post it had to be disabled for NTP to work. I guess that isn't right then. I'm just trying to get the system time to update from a local ntp server as it doesn't have access to internet. Sep 24, 2022 at 0:42
  • Two things: Thing 1: When you reply to a comment under your post (Q or A), you need to preface the cmt with the "handle" of the user you want to reach; in my case, that's @seamus - the autocomplete will help. Thing 2: Where did you see that post? AFAIK, the only report of an exception to that is if you build ntp from source (I've not confirmed that, but another user reported it). Anyway - let us know if that works.
    – Seamus
    Sep 24, 2022 at 0:50
  • @Seamus, I saw it here: forums.raspberrypi.com/viewtopic.php?t=266864 (from 2020). I was having this issue before disabling timesyncd, reenabled it, same issue. NTP service: inactive Sep 24, 2022 at 0:55
  • I'm confused... are you saying that you've installed NTP while systemd-timesyncd was installed & enabled, etc, and that it still doesn't start NTP?
    – Seamus
    Sep 24, 2022 at 1:02

1 Answer 1

1

These instructions seemed to fix the issue, npt starts with the pi and syncs time now:

sudo apt install ntp
sudo systemctl stop systemd-timesyncd
sudo systemctl disable systemd-timesyncd
sudo systemctl enable ntp
sudo systemctl start ntp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.