Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

ntpd.service fails #61

Closed
colegleason opened this issue Jul 2, 2014 · 7 comments · Fixed by coreos/coreos-overlay#721
Closed

ntpd.service fails #61

colegleason opened this issue Jul 2, 2014 · 7 comments · Fixed by coreos/coreos-overlay#721

Comments

@colegleason
Copy link

I have three vagrant machines that were suspended. Their dates are now several days off.

core@core-02 ~ $ date
Sat Jun 28 16:22:53 UTC 2014

You can see that the service failed:

core@core-02 ~ $ systemctl status ntpd
● ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib64/systemd/system/ntpd.service; disabled)
   Active: failed (Result: exit-code) since Sat 2014-06-28 02:17:09 UTC; 14h ago
 Main PID: 420 (code=exited, status=255)

Jun 27 04:16:52 core-02 ntpd[420]: Listen normally on 5 enp0s8 172.17.8.102 UDP 123
Jun 27 04:16:52 core-02 ntpd[420]: Listen normally on 6 enp0s8 fe80::a00:27ff:fe56:8c62 UDP 123
Jun 27 04:16:52 core-02 ntpd[420]: Listen normally on 7 enp0s3 fe80::a00:27ff:fe93:b955 UDP 123
Jun 27 04:16:52 core-02 ntpd[420]: peers refreshed
Jun 27 04:16:52 core-02 ntpd_intres[432]: DNS 0.pool.ntp.org -> 38.104.197.228
Jun 27 04:16:52 core-02 ntpd_intres[432]: DNS 1.pool.ntp.org -> 50.7.64.4
Jun 27 04:16:52 core-02 ntpd_intres[432]: DNS 2.pool.ntp.org -> 192.198.93.86
Jun 27 04:16:52 core-02 ntpd_intres[432]: DNS 3.pool.ntp.org -> 74.95.126.33
Jun 28 02:17:09 core-02 systemd[1]: ntpd.service: main process exited, code=exited, status=255/n/a
Jun 28 02:17:09 core-02 systemd[1]: Unit ntpd.service entered failed state.

The service file:

core@core-02 ~ $ systemctl cat ntpd
# /usr/lib64/systemd/system/ntpd.service
[Unit]
Description=Network Time Service
After=ntpdate.service sntp.service

[Service]
ExecStart=/usr/sbin/ntpd -g -n -u ntp:ntp -f /var/lib/ntp/ntp.drift
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Journal since reboot:

-- Reboot --
Jun 27 04:16:47 core-02 systemd[1]: Starting Network Time Service...
Jun 27 04:16:47 core-02 systemd[1]: Started Network Time Service.
Jun 27 04:16:47 core-02 ntpd[420]: ntpd 4.2.6p5@1.2349 Fri Jun 27 03:28:57 UTC 2014 (1)
Jun 27 04:16:47 core-02 ntpd[420]: proto: precision = 0.121 usec
Jun 27 04:16:47 core-02 ntpd[420]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Jun 27 04:16:47 core-02 ntpd[420]: Listen and drop on 1 v6wildcard :: UDP 123
Jun 27 04:16:47 core-02 ntpd[420]: Listen normally on 2 lo 127.0.0.1 UDP 123
Jun 27 04:16:47 core-02 ntpd[420]: Listen normally on 3 lo ::1 UDP 123
Jun 27 04:16:47 core-02 ntpd[420]: peers refreshed
Jun 27 04:16:47 core-02 ntpd[420]: Listening on routing socket on fd #20 for interface updates
Jun 27 04:16:47 core-02 ntpd[420]: Deferring DNS for 0.pool.ntp.org 1
Jun 27 04:16:47 core-02 ntpd[420]: Deferring DNS for 1.pool.ntp.org 1
Jun 27 04:16:47 core-02 ntpd[420]: Deferring DNS for 2.pool.ntp.org 1
Jun 27 04:16:47 core-02 ntpd[420]: Deferring DNS for 3.pool.ntp.org 1
Jun 27 04:16:47 core-02 ntpd[432]: signal_no_reset: signal 17 had flags 4000000
Jun 27 04:16:52 core-02 ntpd[420]: Listen normally on 4 enp0s3 10.0.2.15 UDP 123
Jun 27 04:16:52 core-02 ntpd[420]: Listen normally on 5 enp0s8 172.17.8.102 UDP 123
Jun 27 04:16:52 core-02 ntpd[420]: Listen normally on 6 enp0s8 fe80::a00:27ff:fe56:8c62 UDP 123
Jun 27 04:16:52 core-02 ntpd[420]: Listen normally on 7 enp0s3 fe80::a00:27ff:fe93:b955 UDP 123
Jun 27 04:16:52 core-02 ntpd[420]: peers refreshed
Jun 27 04:16:52 core-02 ntpd_intres[432]: DNS 0.pool.ntp.org -> 38.104.197.228
Jun 27 04:16:52 core-02 ntpd_intres[432]: DNS 1.pool.ntp.org -> 50.7.64.4
Jun 27 04:16:52 core-02 ntpd_intres[432]: DNS 2.pool.ntp.org -> 192.198.93.86
Jun 27 04:16:52 core-02 ntpd_intres[432]: DNS 3.pool.ntp.org -> 74.95.126.33
Jun 28 02:17:09 core-02 systemd[1]: ntpd.service: main process exited, code=exited, status=255/n/a
Jun 28 02:17:09 core-02 systemd[1]: Unit ntpd.service entered failed state.

cc @crawford @marineam

@colegleason
Copy link
Author

Possible issue: Starts as user/group ntp, but those don't exist?

@jonboulle
Copy link

Why don't they exist? They should be in /usr/share/baselayout/passwd

@marineam
Copy link

marineam commented Jul 2, 2014

@crawford
Copy link
Contributor

@colegleason can you retest this with the latest image?

@crawford crawford added os tools and removed os labels Jul 11, 2014
@marineam
Copy link

Should be fixed in 379.1.0 which goes out tomorrow, reopen if you find otherwise.

@bassam
Copy link
Member

bassam commented Nov 18, 2014

I'm not sure this fix is working in latest alpha build 494.0.0. Using a vbox VM, I see that the time is way off on resume. repro roughly as follows:

vagrant suspend
<wait a bit>
vagrant resume
vagrant ssh
timedatectl status

the time will be in the past.

The only workaround I found is running:

sudo systemctl restart ntpdate.service

which corrects the time.

Looking at the fix made by @marineam I'm not sure how adding Restart=always on ntpd.service would correct this problem. I'm no systemd expert but I though I don't understand how this would restart ntpd on wakeup/resume.

@marineam
Copy link

Normally ntpd aborts when it detects the system time is too far out of whack. It will tolerate a big time jump when it first starts up. So either you are checking the time before ntpd aborts or the time offset isn't bad enough for it to abort and ntpd will attempt to gradually sync you. That gradual sync is meant to be unnoticeable and can take many hours.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants