# [systemd] What NTP service to use

## WvR

I recently upgraded to Gnome-3.8 and systemd. It seems that systemd works, but there are a few details to take care of. One of these details is how to get automatic & continuous time & data setting with NTP. Previously, I used ntp-client (at startup) and then ntpd while the computer was running. I tried to use these with systemd, but it seems there are no services for systemd. I tried several ways: 

```
 systemctl enable ntp
```

 (does not work), 

```
 systemctl enable ntpd
```

 (does not work), 

```
 systemctl enable ntpdate
```

 (does not work), 

```
 systemctl enable ntp-client
```

 (does not work). 

After some Googling, I found that maybe I should use 

```
chronyd
```

, so I installed that. However, when I issue

```
 systemctl enable chrony
```

there is no error, but the chronyd service is listed as FAILED. When I start chronyd by hand, it works fine. I don't understand why it does not work with systemd but I could not find any usable debug info. So.... what can I use to set the time & date automatically and have continuous synchronization with NTP, if I use systemd?

----------

## azp

I have a service called ntp-client.service, which starts and tries to set the time. But it doesn't quite work:

```
root@skare$ systemctl status ntp-client.service 

ntp-client.service - Set time via NTP

   Loaded: loaded (/usr/lib64/systemd/system/ntp-client.service; enabled)

   Active: failed (Result: exit-code) since tor 2013-09-05 23:08:29 CEST; 20min ago

  Process: 445 ExecStart=/usr/sbin/ntpdate $NTPCLIENT_OPTS (code=exited, status=1/FAILURE)

 Main PID: 445 (code=exited, status=1/FAILURE)

   CGroup: /system.slice/ntp-client.service

sep 05 23:08:29 skare ntpdate[445]: 5 Sep 23:08:29 ntpdate[445]: no servers can be used, exiting

sep 05 23:08:29 skare systemd[1]: ntp-client.service: main process exited, code=exited, status=1/FAILURE

sep 05 23:08:29 skare systemd[1]: Failed to start Set time via NTP.

sep 05 23:08:29 skare systemd[1]: Unit ntp-client.service entered failed state.
```

and the log says:

```
sep 05 23:30:17 skare systemd[1]: Starting Set time via NTP...

-- Subject: Unit ntp-client.service has begun with start-up

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

-- 

-- Unit ntp-client.service has begun starting up.

sep 05 23:30:17 skare systemd[1]: Ignoring invalid environment 'NTPCLIENT_OPTS=-s -b -u         0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org         2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org': /etc/conf.d/ntp-client

sep 05 23:30:17 skare ntpdate[25340]: 5 Sep 23:30:17 ntpdate[25340]: no servers can be used, exiting

sep 05 23:30:17 skare systemd[1]: ntp-client.service: main process exited, code=exited, status=1/FAILURE

sep 05 23:30:17 skare systemd[1]: Failed to start Set time via NTP.
```

So I'm not quite sure what to do about that. I guess the settings are b0rked and it needs to be ported to work with systemd.

By the way, I really recommend enabling bash completion, that lets you write 'systemctl enable' and then press tab to see all available services. No need to guess anymore  :Smile: 

----------

## loading...

As I am on a desktop system which is only turned on once a day, I use ntpdate which is part of net-misc/ntp.

The net-misc/ntp installs as well a ntpdate.service file for systemd. You can easily activate it by passing a "systemctl enable ntpdate.service".

----------

## croutch

Take a look there.

http://wiki.gentoo.org/wiki/System_time

https://wiki.archlinux.org/index.php/time

----------

## ulenrich

@WvR , I learned from another thread your issue might be more basic systemd related:

As root user having to configure localtime with systemd  you should have a look at output of :

```
 $ timedatectl

# if not the timezone you want in the first line, list possibilities:

 $ timedatectl list-timezones

# shows how to configure:

 $ man timedatectl 
```

At the end you should have something like me for germany:

```
 $ vdir /etc/localtime

lrwxrwxrwx 1 root root 33 19. Nov 14:37 /etc/localtime -> /usr/share/zoneinfo/Europe/Berlin
```

----------

