1

I have Ubuntu Server 16.04 running on OpenVZ (VPS hosting provider), and I have difficulties running ntp for time synchronization. I just installed ntp (apt install ntp), but when I try it, I see

root@vps:~# ntpq -p
ntpq: read: Connection refused

My local time zone is correct

root@vps:~# dpkg-reconfigure tzdata    
Current default time zone: 'Europe/Prague'
Local time is now:      Mon May  9 08:40:44 CEST 2016.
Universal Time is now:  Mon May  9 06:40:44 UTC 2016.

When I try to reload ntp service systemctl reload ntp.service

Failed to reload ntp.service: Job type reload is not applicable for unit ntp.service.
See system logs and 'systemctl status ntp.service' for details.

And when I run systemctl status ntp.service

ntp.service - LSB: Start NTP daemon
Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
Active: active (exited) since Mon 2016-05-09 09:04:29 CEST; 8min ago
 Docs: man:systemd-sysv-generator(8)
Process: 25429 ExecStop=/etc/init.d/ntp stop (code=exited, status=0/SUCCESS)
Process: 25487 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS)

May 09 09:04:29 vps systemd[1]: Started LSB: Start NTP daemon.
May 09 09:04:29 vps ntpd[25496]: proto: precision = 0.092 usec (-23)
May 09 09:04:29 vps ntpd[25496]: Listen and drop on 0 v6wildcard [::]:123
May 09 09:04:29 vps ntpd[25496]: Listen and drop on 1 v4wildcard 0.0.0.0:123
May 09 09:04:29 vps ntpd[25496]: Listen normally on 2 lo 127.0.0.1:123
May 09 09:04:29 vps ntpd[25496]: Listen normally on 3 venet0 127.0.0.2:123
May 09 09:04:29 vps ntpd[25496]: Listen normally on 4 venet0:0 myipv4:123
May 09 09:04:29 vps ntpd[25496]: Listen normally on 5 lo [::1]:123
May 09 09:04:29 vps ntpd[25496]: Listen normally on 6 venet0 [myipv6]:123
May 09 09:04:29 vps ntpd[25496]: Listening on routing socket on fd #23 for interface updates

And in /var/log/syslog

May  9 09:04:29 vps ntpd[25496]: Listening on routing socket on fd #23 for interface updates
May  9 09:04:29 vps ntpd[25496]: start_kern_loop: ntp_loopfilter.c line 1126: ntp_adjtime: Operation not permitted
May  9 09:04:29 vps ntpd[25496]: set_freq: ntp_loopfilter.c line 1089: ntp_adjtime: Operation not permitted
May  9 09:04:29 vps ntpd[25496]: cap_set_proc() failed to drop root privs: Operation not permitted

I also tried

root@vps:~# ntpdate pool.ntp.org
9 May 09:19:47 ntpdate[25785]: Can't adjust the time of day: Operation not permitted

Does anybody know what's wrong with my NTP?

Thank you.

1
  • I wonder if there is some conflict with timedatectl, the default in 16.04. What do you get for timedatectl status? The Ubuntu Serverguide is not up to date with these changes for 16.04, but there is a pending merge proposal with updates. May 9, 2016 at 14:49

4 Answers 4

3

This is probably due to the fact that you are running ntp in a unprivileged container. OpenVZ is another project for containers, but like the others it share the same kernel between the host and the guests. And as the kernel maintain the time, it would be not acceptable for a VPS host that one container can change the kernel time, because that would impact all other container.

So there is not solution to your problem. If you find that the time reported inside your OpenVZ container is incorrect, you need to open a support ticket with your VPS host provider. They have to install ntpd on their host and make sure it is correctly synchronised.

2

It seems to be a conflict with ntpdate being on the machine as well. If you ONLY install ntp but not ntpdate, then ntp is allowed to work. With both on the machine, ntp won't stay up on next reboot.

Seems related to this bug.

1
  • I started with just ntp installed and the problem was exactly the same. But I discussed it with the hosting provider and he told me that it should not work because changing time is not allowed on OpenVZ because it's built in to the hypervisor and virtual machines takes the time from hypervisor and I should take care only of right time zone settings on my VPS.
    – LukasBeran
    May 14, 2016 at 5:16
0

I changed my ntp pool member list and restarted my ntp service. It worked for me.

server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org

@ubuntu:/etc$ sudo service ntp restart * Stopping NTP server ntpd

  • Starting NTP server ntpd [ OK ] @ubuntu:/etc$ ntpq -p

    remote refid st t when poll reach delay offset jitter

    ntp.ubuntu.com .POOL. 16 p - 64 0 0.000 0.000 0.000 *ntp.nexcess.net 142.66.101.13 2 u 8 64 1 28.094 -6.892 0.000 propjet.latt.ne 44.24.199.34 3 u 6 64 1 141.591 14.905 0.000 barry.tsi.io 198.60.22.240 2 u 7 64 1 91.846 0.492 0.000 ntp1.wiktel.com 216.218.254.202 2 u 6 64 1 44.371 -10.567 0.000 chilipepper.can 140.203.204.77 2 u 7 64 1 97.269 -6.298 0.000 juniperberry.ca 145.238.203.14 2 u 7 64 1 98.729 -9.011 0.000 golem.canonical 145.238.203.14 2 u 6 64 1 104.873 -11.536 0.000 alphyn.canonica 132.246.11.231 2 u 1 64 1 35.188 -6.797 0.000

0

I do not have enough reputation to comment, but I have the issue and following the answer of user542049 I did:

sudo apt remove ntpdate

Suddenly with no reboot required, the clock matched the correct hour.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .