Bug 339582

Summary: Set Date and Time Automatically > Apply hangs systemsettings5
Product: [Applications] systemsettings Reporter: Mike C. Fletcher <mcfletch>
Component: kcm_clockAssignee: Sebastian Kügler <sebas>
Status: RESOLVED FIXED    
Severity: minor CC: bhush94, com, costallat, hrvoje.senjan, lukas, pnunn, valorie.zimmerman
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Mike C. Fletcher 2014-10-01 19:06:47 UTC
On a Kubuntu Neon desktop updated this morning, I go to System Settings > Regional Settings > Date and Time, enable "Set date and time automatically" then click apply. The GUI becomes unresponsive (can't close the window, can't activate anything, but the clock display continues to update).

The machine is running standard ntpd configuration for Ubuntu, there's no need to enable the feature, but it shouldn't crash the application to attempt that enabling.

Reproducible: Always

Steps to Reproduce:
1. Enable "Set date and time automatically"
2. Click Apply


Actual Results:  
GUI becomes unresponsive

Expected Results:  
GUI should either request permissions to run ntpdate or report the failure to run it (note, ntpd is running on the machine, so ntpdate will likely fail even if permissions were set).

Bonus points if the presence of a running ntpd were to make the settings module grey out or show the option as "checked", possibly with a note that this is not a KDE-managed process.

Workaround: don't check the box on machines where it won't work, kill any hung systemsettings5 instances

Here's the command line output from the hung process:

$ /opt/project-neon5/bin/systemsettings5
"Theme tree: (Breeze)"
Shortcut for action  "options_configure" "Configure" set with QAction::setShortcut()! Use KActionCollection::setDefaultShortcut(s) instead.
Shortcut for action  "searchText" "" set with QAction::setShortcut()! Use KActionCollection::setDefaultShortcut(s) instead.
Trying to open ksycoca from "/home/mcfletch/.project-neon5-kde//cache/ksycoca5"
systemsettings: ntpUtility =  "/usr/sbin/ntpdate"
false
QWidget::setWindowModified: The window title does not contain a '[*]' placeholder
QWidget::setWindowModified: The window title does not contain a '[*]' placeholder
systemsettings: Setting date from time server  "Public Time Server (pool.ntp.org)"
Comment 1 Mike C. Fletcher 2014-10-01 19:10:05 UTC
Apparently the "hang" is actually an *extremely* long time out (long enough to fill out this whole bug report). The window eventually becomes responsive again, though when returning to the page the "Set date and time automatically" checkbox is again un-checked... some error and/or status warning would likely be appropriate.
Comment 2 Valorie Zimmerman 2014-10-03 09:50:42 UTC
I can confirm this, and it never does become responsive. I tested also my test laptop, which has Kubuntu 14.10 upgraded to Plasma 5, freshly updated and upgraded. On that one, there is no freeze; however, once I click Apply, it reports: You are not allowed to save the configuration.

When I try to close the KCM, I get a popup: Apply Settings---System Settings
The settings of the current module have changed.
Do you want to apply the changes or discard them?
and then Apply, Discard, Cancel buttons.

Click apply: red X and Unable to authenticate/execute the action: 9, The backend does not specify how to authorize

Definite bug.
Comment 3 Lukáš Tinkl 2014-10-03 09:54:17 UTC
Do you have polkit-kde-agent-1 installed and running?
Comment 4 Lukáš Tinkl 2014-10-03 09:55:16 UTC
You should see something like this:

[ltinkl@goblin ~]$ ps aux | grep polkit
ltinkl    8771  0.0  0.4 664928 34248 ?        Sl   09:15   0:00 /usr/lib64/libexec/polkit-kde-authentication-agent-1
Comment 5 Hrvoje Senjan 2014-10-03 10:24:04 UTC
(In reply to Valorie Zimmerman from comment #2)

> Click apply: red X and Unable to authenticate/execute the action: 9, The
> backend does not specify how to authorize

this indicates broken KAuth/polkit-qt installation..
Comment 6 Mike C. Fletcher 2014-10-03 14:18:14 UTC
I do show a Polkit-kde, but it's a kde-4 version (this is on Kubuntu 14.04 with Neon 5 packages):

mcfletch 25672  0.0  0.1 381644 16004 ?        Sl   Oct01   0:00 /usr/lib/kde4/libexec/polkit-kde-authentication-agent-1

potentially this might be down to having the wrong version running?
Comment 7 Peter Nunn 2015-01-02 05:30:14 UTC
I am also getting this behaviour in a Kubuntu/KDE5 installation. 

I tried running sudo systemsettings5 and have the same result (are we sure this is an authentication problem)?

Peter.
Comment 8 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
deprecated.

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 241817, bug 178968, 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

http://commits.kde.org/plasma-desktop/b6ae01ca8ea776c97cc57836401ca9696e2529e8
Comment 9 com 2015-08-13 07:49:35 UTC
Same problem as OP except the hang is relatively short and followed by the error popup: 

Unable to authenticate/execute the action: 4,
Comment 10 com 2015-08-13 07:50:27 UTC
(In reply to com from comment #9)
> Same problem as OP except the hang is relatively short and followed by the
> error popup: 
> 
> Unable to authenticate/execute the action: 4,

Forgot: Kubuntu 15.04 new installation