You are not logged in.
I'm trying to set up the oneshot ntp time sync as described in the arch wiki https://wiki.archlinux.org/index.php/Ne … col_daemon
I believe I have /etc/ntp.conf configured correctly, because when I manually run
>sudo ntpd -gq
I get:
ntpd: time set -7.226927s
However, when I try to start the service, either enabled at boot or started manually afterwards, I get:
>sudo systemctl start ntp-once.service
Job for ntp-once.service failed. See 'systemctl status ntp-once.service' and 'journalctl -xn' for details.
The suggested links give:
>sudo systemctl status ntp-once.service
ntp-once.service - Network Time Service (once)
Loaded: loaded (/etc/systemd/system/ntp-once.service; disabled)
Active: failed (Result: exit-code) since Sat 2013-03-30 05:48:56 EDT; 2min 13s ago
Process: 939 ExecStart=/usr/bin/ntpd -q -g -u ntp:ntp (code=exited, status=255)
Mar 30 05:48:55 arch ntpd[939]: Listen and drop on 1 v6wildcard :: UDP 123
Mar 30 05:48:55 arch ntpd[939]: Listen normally on 2 lo 127.0.0.1 UDP 123
Mar 30 05:48:55 arch ntpd[939]: Listen normally on 3 eth0 192.168.0.110 UDP 123
Mar 30 05:48:55 arch ntpd[939]: Listen normally on 4 lo ::1 UDP 123
Mar 30 05:48:55 arch ntpd[939]: Listen normally on 5 eth0 fe80::f66d:4ff:fe40:3c9b UDP 123
Mar 30 05:48:55 arch ntpd[939]: peers refreshed
Mar 30 05:48:55 arch ntpd[939]: Listening on routing socket on fd #22 for interface updates
Mar 30 05:48:56 arch systemd[1]: ntp-once.service: main process exited, code=exited, status=255/n/a
Mar 30 05:48:56 arch systemd[1]: Failed to start Network Time Service (once).
Mar 30 05:48:56 arch systemd[1]: Unit ntp-once.service entered failed state
>sudo journalctl -xn
-- Logs begin at Sun 2012-10-28 09:25:15 EDT, end at Sat 2013-03-30 05:53:07 EDT. --
Mar 30 05:48:55 arch ntpd[939]: Listening on routing socket on fd #22 for interface updates
Mar 30 05:48:56 arch systemd[1]: ntp-once.service: main process exited, code=exited, status=255/n/a
Mar 30 05:48:56 arch systemd[1]: Failed to start Network Time Service (once).
-- Subject: Unit ntp-once.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li … temd-devel
-- Documentation: http://www.freedesktop.org/wiki/Softwar … 8ba40df7e9
--
-- Unit ntp-once.service has failed.
--
-- The result is failed.
Mar 30 05:48:56 arch systemd[1]: Unit ntp-once.service entered failed state
Mar 30 05:48:56 arch sudo[936]: pam_unix(sudo:session): session closed for user root
Mar 30 05:51:10 arch sudo[941]: bp : TTY=pts/0 ; PWD=/home/bp ; USER=root ; COMMAND=/usr/bin/system
Mar 30 05:51:10 arch sudo[941]: pam_unix(sudo:session): session opened for user root by bp(uid=0)
Mar 30 05:51:10 arch sudo[941]: pam_unix(/etc/systemd/system/ntp-once.servicesudo:session): session closed for user root
Mar 30 05:53:07 arch sudo[946]: bp : TTY=pts/0 ; PWD=/home/bp ; USER=root ; COMMAND=/usr/bin/journa
Mar 30 05:53:07 arch sudo[946]: pam_unix(sudo:session): session opened for user root by bp(uid=0)
My /etc/systemd/system/ntp-once.service looks like this:
[Unit]
Description=Network Time Service (once)
After=network.target nss-lookup.target
[Service]
Type=oneshot
ExecStart=/usr/bin/ntpd -q -g -u ntp:ntp ; /sbin/hwclock -w
[Install]
WantedBy=multi-user.target
And my /etc/ntp.conf like this:
# Associate to public NTP pool servers; see http://www.pool.ntp.org/
server 0.north-america.pool.ntp.org iburst
server 1.north-america.pool.ntp.org iburst
server 2.north-america.pool.ntp.org iburst
server 3.north-america.pool.ntp.org iburst
# Only allow read-only access from localhost
restrict default noquery nopeer
restrict 127.0.0.1
restrict ::1
# Location of drift file
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log
Last edited by bpeary (2013-03-31 23:12:20)
Offline
I'm not sure, but I don't think you can/should put multiple commands on one ExecStart line. Use two ExecStart lines.
Also, code tags would make this much more readable in the forums.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks for the suggestions. I tried breaking that line up into
ExecStart=/usr/bin/ntpd -q -g -u ntp:ntp
ExecStart=/sbin/hwclock -w but got the same fail error. Then I thought about how it worked manually, and I had used ntpd -gq. I don't know what the ntp:ntp means, or the 'u', but decided to try it with the format that worked manually. So I put in:
ExecStart=/usr/bin/ntpd -qg ; /sbin/hwclock -wand now it is working.
Offline