Bug 178968

Summary: Unable to contact time server when the ntp daemon is running.
Product: [Applications] systemsettings Reporter: ljfnord
Component: kcm_clockAssignee: Paul Campbell <paul>
Severity: normal CC: adaptee, alessandro.ufms, ali.sherif10, criguada, donchar, doug, flying-sheep, giacof, gideon, kde.org, kelytharun, leoni.massimiliano1, lueck, manutortosa, MurzNN, nortexoid, pavel_mendl, ruchir.brahmbhatt
Priority: NOR Keywords: triaged
Version: 4.9.3   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description ljfnord 2008-12-28 15:16:45 UTC
Version:            (using KDE 4.1.3)
Compiler:          gcc 4.3.2 
OS:                Linux
Installed from:    Unlisted Binary Package

Attempting to enter systemsettings and setting the timezone leads to an error,
"Unable to contact time server: Public Time Server (pool.ntp.org)."  Running the following command...

sudo /usr/lib/kde4/libexec/kcmdatetimehelper 'ntp' '5' 'Public Time Server (pool.ntp.org)' 'asia.pool.ntp.org' 'europe.pool.ntp.org' 'north-america.pool.ntp.org' 'oceania.pool.ntp.org' 'enabled' 'tz' 'America/Chicago'

...results in errors like this...

rdate: connect to address Connection refused
rdate: connect to address Connection refused
rdate: connect to address Connection refused
rdate: connect to address Connection refused
rdate: timed out connecting to after 10 seconds.

OpenNTPD is installed and running properly under ArchLinux.
Comment 1 Murz 2009-03-29 11:44:27 UTC
Confirm on Kubuntu 8.10 with KDE 4.2.1.
When I try to turn on "Set date and time automatically" and press "Apply", I see three error windows:
1. Unable to contact time server: Public Time Server (pool.ntp.org).
2. Can not set date.
3. Error setting new time zone.

On coomand line as user:
$ ntpdate pool.ntp.org
29 Mar 13:42:58 ntpdate[18129]: bind() fails: Permission denied

as root:
~$ kdesudo ntpdate pool.ntp.org
29 Mar 13:44:09 ntpdate[18227]: adjust time server offset 0.000025 sec
Comment 2 Doug Roberts 2010-03-02 21:04:49 UTC
Same problem with Kubuntu 9.10, KDE 4.4.0.
Comment 3 Kelytha 2010-03-28 09:50:28 UTC
The bug still exists in KDE 4.4.1 on both Kubuntu and Arch Linux
Comment 4 François Rey 2010-04-08 14:17:12 UTC
Confirmed arch linux 64 bit kde 4.4.2
Comment 5 Pavel Mendl 2011-02-21 21:21:23 UTC
Confirmed on Debian testing (Squeeze) KDE 4.4.5
Comment 6 Pavel Mendl 2011-02-21 21:24:34 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Burkhard Lück 2011-04-12 17:42:07 UTC
Kubuntu 10.10:
$ KDE_LANG=en_US systemsettings --version
Qt: 4.7.0
KDE Development Platform: 4.6.2 (4.6.2)
System Settings: 1.0

Works for me. 
When I turn on "Set date and time automatically" and press "Apply" an authentication dialog pops up asking for my password and the setting is accepted.
Comment 8 Alessandro Nakamuta 2011-05-09 05:38:21 UTC
This is happening to me too. KDE 4.6.3
Comment 9 Alessandro Nakamuta 2011-05-19 19:06:20 UTC
I disabled ntp daemon and it works. Check if you have ntpd running on the system.
Comment 10 Burkhard Lück 2011-05-20 08:03:26 UTC
Ican confirm:

Without ntp daemon-> works

With ntp daemon -> error "Unable to contact time server: Public Time Server (pool.ntp.org)."
Comment 11 Manuel Tortosa 2011-07-13 21:13:25 UTC
Same problem here using Chakra GNU/Linux with both kde 4.6.5 and 4.7rc2, 

no errors running:

sudo /usr/lib/kde4/libexec/kcmdatetimehelper 'ntp' '5' 'Public Time Server
(pool.ntp.org)' 'asia.pool.ntp.org' 'europe.pool.ntp.org'
'north-america.pool.ntp.org' 'oceania.pool.ntp.org' 'enabled' 'tz'

but systemsettings shoots a error "Unable to contact time server: Public Time Server..."
Comment 12 Jekyll Wu 2012-12-04 12:03:47 UTC
Conditions and steps for reproducing.

1. Install the full ntp suite to have both ntpd and ntpdate binaries installed.
2. start the ntpd daemon
3. run "kcmshell4 clock", enable the "Set date the time automatically" option, and change the timezone, then click apply
4. error
Comment 13 Jekyll Wu 2012-12-04 20:56:31 UTC
*** Bug 219035 has been marked as a duplicate of this bug. ***
Comment 14 Massimiliano 2013-01-09 09:08:23 UTC
Still present on Archlinux with KDE 4.9.5.
Disabling ntpd auto-start on boot [~$ systemctl disable ntpd.service] seems to be a workaround though.
Comment 15 Philipp A. 2014-02-28 12:40:59 UTC
i also don’t see the setting doing anything.

my hwclock was wrong by 5 minutes, and KDE didn’t set set the correct time within days. (likely not ever). it will only set the time when i manually change the time server and click “apply” (which forces it to sync), but even then it doesn’t set the hwclock, so the clock will be 5 minutes wrong after rebooting.

KDE’s time management is plain broken for me (Archlinux). So the only sane thing is to enable ntp and disable KDE’s time syncing.
Comment 16 Christoph Feck 2014-06-29 20:18:20 UTC
*** Bug 336873 has been marked as a duplicate of this bug. ***
Comment 17 giacof 2014-09-12 11:25:58 UTC
I confirm this bug on Kubuntu 14.04:

Application: kcmshell4 (4.13.3)
KDE Platform Version: 4.13.3
Qt Version: 4.8.6
Operating System: Linux 3.13.0-36-generic x86_64
Distribution: Ubuntu 14.04.1 LTS

On first attempt the application crashed, then I retried and got the error message reported by OP
Comment 18 Michael D 2014-12-03 09:01:40 UTC
Still broken in KDE 4.14.1, Kubuntu 14.10, though I have been updating from previous versions so maybe a fresh install would fix it?

Is there a modern-day fix/workaround for this? Is it still broken in Plasma 5/Frameworks 5?
Comment 19 Christoph Feck 2014-12-12 20:32:15 UTC
Probably. We have no maintainer for kcm-clock. Also, with distributions switching to systemd, the complete clock setting stuff should be rewritten anyway. If you know someone who would be able to do it, please point them here.
Comment 20 David Edmundson 2015-02-27 19:02:38 UTC
Git commit b6ae01ca8ea776c97cc57836401ca9696e2529e8 by David Edmundson.
Committed on 14/02/2015 at 13:50.
Pushed by davidedmundson into branch 'master'.

Add systemd support into the clock KCM as an optional dependency

The current time setting helper is incredibly broken.

It manually tries to run a range of NTP utilities, all of which are

We can just call timedated directly and cut out the middleman as it has
uses polkit anyway.

This is currently an optional dependency, and the original helper still
exists. It makes the code messy, but we have users to support for now.

Detection is done at runtime
Related: bug 196316, bug 311286, bug 317784, bug 319072, bug 337012, bug 339582, bug 241817, bug 320456, bug 317999, bug 337659
REVIEW: 122400

M  +5    -1    kcms/dateandtime/CMakeLists.txt
M  +22   -12   kcms/dateandtime/dateandtime.ui
M  +44   -30   kcms/dateandtime/dtime.cpp
M  +2    -1    kcms/dateandtime/dtime.h
M  +80   -7    kcms/dateandtime/main.cpp
M  +5    -1    kcms/dateandtime/main.h
A  +43   -0    kcms/dateandtime/timedated1.xml

Comment 21 Alberto Salvia Novella 2021-11-02 12:09:33 UTC
Related: Enabling "set date and time automatically" shall start ntpd.service