Bug 27195 - Time synchronization cannot be set over the Internet (NTP)
Summary: Time synchronization cannot be set over the Internet (NTP)
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: release_blocker major
Target Milestone: Mageia 9
Assignee: Mageia tools maintainers
QA Contact:
URL:
Whiteboard:
Keywords: Triaged
Depends on:
Blocks:
 
Reported: 2020-08-25 10:03 CEST by Alex Kotov
Modified: 2022-07-18 18:32 CEST (History)
2 users (show)

See Also:
Source RPM: drakxtools-18.33-1.mga8.src.rpm
CVE:
Status comment:


Attachments
Setting up time synchronization over the Internet (175.75 KB, image/png)
2020-08-25 10:04 CEST, Alex Kotov
Details
Time synchronization via the Internet is not installed (176.92 KB, image/png)
2020-08-25 10:05 CEST, Alex Kotov
Details
3-chrony is installed (231.61 KB, image/png)
2020-08-25 13:38 CEST, Alex Kotov
Details
4-chronyd.service is disabled-dead (169.55 KB, image/png)
2020-08-25 14:13 CEST, Alex Kotov
Details
Output of user commands, 'sudo journalctl | grep pool.ntp.org' and 'drakclock' (21.55 KB, text/plain)
2021-11-18 14:52 CET, Rolf Pedersen
Details
ntp.conf_and_chrony.conf_corrected.tar.gz (1.32 KB, application/gzip)
2021-11-18 19:57 CET, Alex Kotov
Details
drakclock-perl-diff.tar.gz (4.88 KB, application/gzip)
2021-11-19 09:43 CET, Alex Kotov
Details
drakclock_test_screenshot.png (11.43 KB, image/png)
2021-11-19 10:58 CET, Alex Kotov
Details
konsole output of removing chrony, ntp, installing the patch rpm, and running drakclock twice (5.22 KB, text/plain)
2021-11-21 18:48 CET, Rolf Pedersen
Details
drakclock still working with Alex Kotov's patch (325.17 KB, image/png)
2022-07-06 16:12 CEST, Rolf Pedersen
Details

Description Alex Kotov 2020-08-25 10:03:29 CEST
Description of problem:
Hi. Time synchronization cannot be set over the Internet (NTP) in drakconf/drakclock.

Version-Release number of selected component (if applicable):
Mageia Cauldron, drakclock

How reproducible:
Install Mageia Linux and enable synchronization via NTP. See screenshots in the attached files...
Comment 1 Alex Kotov 2020-08-25 10:04:47 CEST
Created attachment 11834 [details]
Setting up time synchronization over the Internet
Comment 2 Alex Kotov 2020-08-25 10:05:38 CEST
Created attachment 11835 [details]
Time synchronization via the Internet is not installed
Comment 3 Aurelien Oudelet 2020-08-25 10:25:56 CEST
Hi,

Thanks reporting this,

Actually, drakclock should propose you to install chrony NTP package if not installed.

Is it installed on your system when proposed by UI?
Simply do in console:

$ rpm -q --last chrony

It will return "package    chrony is not installed" this is not obvious or:
"chrony-3.5.1-1.mga8.x86_64 Saturday 08 August 2020 08:00:15 AM CEST"
so it is installed.

Source RPM: (none) => drakxtools-18.33-1.mga8.src.rpm

Comment 4 Alex Kotov 2020-08-25 13:37:12 CEST
Hello, Aurelien Oudelet. The "chrony" package is installed. Please see the screenshot "3-chrony is installed".
Comment 5 Alex Kotov 2020-08-25 13:38:29 CEST
Created attachment 11836 [details]
3-chrony is installed
Comment 6 Aurelien Oudelet 2020-08-25 13:51:29 CEST Comment hidden (obsolete)

Severity: normal => major
Target Milestone: --- => Mageia 8

Comment 7 Aurelien Oudelet 2020-08-25 13:55:06 CEST
OK,

What about this command as root:
#systemctl status chronyd.service

Does it runs or failed?
Comment 8 Alex Kotov 2020-08-25 14:12:34 CEST
chronyd.service is disabled. See the screenshot: "4-chronyd.service is disabled-dead".
Comment 9 Alex Kotov 2020-08-25 14:13:01 CEST
Created attachment 11837 [details]
4-chronyd.service is disabled-dead
Comment 10 Aurelien Oudelet 2020-08-25 14:15:52 CEST
Bug is reproduce on my side (Mageia 8 Beta 1)

Running Drakclock, log outputs:
drakclock[3660]: ### Program is starting ###
drakclock[3660]: launched command: systemctl is-active chronyd.service >/dev/null
drakclock[3600]: running: /bin/rpm -q --qf %{name}
                                                 ntp
drakclock[3600]: running: /bin/rpm -q --qf %{name}
                                                 chrony
drakclock[3600]: running: xset s off
drakclock[3600]: running: xset -dpms
drakclock[3660]: modified file /etc/chrony.conf
drakclock[3660]: running: /sbin/chkconfig --list --type xinetd
drakclock[3660]: running: /bin/systemctl enable --no-reload chronyd.service
drakclock[3660]: running: /bin/systemctl --quiet is-active chronyd.service
drakclock[3660]: running: /bin/systemctl --no-block start chronyd.service
systemd[1]: Starting NTP client/server...
systemd[1]: Stopping Network Time Synchronization...
drakclock[3660]: launched command: systemctl enable chronyd.service
systemd[1]: systemd-timesyncd.service: Succeeded.
systemd[1]: Stopped Network Time Synchronization.
chronyd[4380]: chronyd version 3.5.1 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER -SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG)
chronyd[4380]: Initial frequency -7.207 ppm
systemd[1]: Reloading.
drakclock[3660]: launched command: systemctl stop chronyd.service
systemd[1]: Started NTP client/server.
chronyd[4380]: chronyd exiting
systemd[1]: Stopping NTP client/server...
systemd[1]: chronyd.service: Succeeded.
systemd[1]: Stopped NTP client/server.
drakclock[3660]: launched command: systemctl start chronyd.service
systemd[1]: Starting NTP client/server...
chronyd[4407]: chronyd version 3.5.1 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER -SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG)
chronyd[4407]: Frequency -7.207 +/- 1000000.000 ppm read from /var/lib/chrony/drift
systemd[1]: Started NTP client/server.
drakclock[3660]: launched command: chronyc waitsync 30 0.1
chronyd[4407]: Selected source 162.159.200.123
drakclock[3660]: launched command: /sbin/hwclock --systohc
drakclock[3660]: running: xset +dpms
drakclock[3660]: running: xset s on
drakclock[3660]: running: xset s reset
drakclock[3660]: ### Program is exiting ###
drakclock[4462]: ### Program is starting ###
drakclock[4462]: launched command: systemctl is-active chronyd.service >/dev/null
drakclock[4462]: running: /bin/rpm -q --qf %{name}
                                                 ntp
drakclock[4462]: running: /bin/rpm -q --qf %{name}
                                                 chrony
drakclock[4462]: running: xset s off
drakclock[4462]: running: xset -dpms
drakclock[4462]: modified file /etc/chrony.conf
drakclock[4462]: running: /sbin/chkconfig --list --type xinetd
drakclock[4462]: running: /bin/systemctl enable --no-reload chronyd.service
drakclock[4462]: running: /bin/systemctl --quiet is-active chronyd.service
drakclock[4462]: running: /bin/systemctl --no-block restart chronyd.service
chronyd[4407]: chronyd exiting
systemd[1]: Stopping NTP client/server...
systemd[1]: chronyd.service: Succeeded.
systemd[1]: Stopped NTP client/server.
systemd[1]: Starting NTP client/server...
drakclock[4462]: launched command: systemctl enable chronyd.service
chronyd[4493]: chronyd version 3.5.1 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER -SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG)
chronyd[4493]: Frequency 46.176 +/- 683.550 ppm read from /var/lib/chrony/drift
systemd[1]: Reloading.
drakclock[4462]: launched command: systemctl stop chronyd.service
systemd[1]: Started NTP client/server.
chronyd[4493]: chronyd exiting
systemd[1]: Stopping NTP client/server...
systemd[1]: chronyd.service: Succeeded.
systemd[1]: Stopped NTP client/server.
drakclock[4462]: launched command: systemctl start chronyd.service
systemd[1]: Starting NTP client/server...
chronyd[4519]: chronyd version 3.5.1 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER -SIGND +ASYNCDNS +SECHASH +IPV6 -DEBUG)
chronyd[4519]: Frequency 46.176 +/- 683.550 ppm read from /var/lib/chrony/drift
systemd[1]: Started NTP client/server.
drakclock[4462]: launched command: chronyc waitsync 30 0.1
chronyd[4519]: Selected source 162.159.200.123
drakclock[4462]: launched command: /sbin/hwclock --systohc
drakclock[4462]: running: xset +dpms
drakclock[4462]: running: xset s on
drakclock[4462]: running: xset s reset
drakclock[4462]: ### Program is exiting ###

On first attempt, chrony is installed, Europe/Paris ntp pool is selected in UI.
Subsequent relaunching drakclock: UI is like attached screenshot: https://bugs.mageia.org/attachment.cgi?id=11835

BUT:
$ systemctl status chronyd  gives:
● chronyd.service - NTP client/server
     Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-08-25 13:53:41 CEST; 39s ago
       Docs: man:chronyd(8)
             man:chrony.conf(5)
    Process: 4517 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS)
    Process: 4521 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
   Main PID: 4519 (chronyd)
      Tasks: 1 (limit: 19119)
     Memory: 1.1M
        CPU: 19ms
     CGroup: /system.slice/chronyd.service
             └─4519 /usr/sbin/chronyd

août 25 13:53:41 mageia.local systemd[1]: Starting NTP client/server...
août 25 13:53:41 mageia.local chronyd[4519]: chronyd version 3.5.1 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER -SIGND +ASYNCDNS +SECHASH +IPV>
août 25 13:53:41 mageia.local chronyd[4519]: Frequency 46.176 +/- 683.550 ppm read from /var/lib/chrony/drift
août 25 13:53:41 mageia.local systemd[1]: Started NTP client/server.
août 25 13:53:46 mageia.local chronyd[4519]: Selected source 162.159.200.123

Good running NTP client on system.
It is configured and running every system boot whereas Drakclock UI is not updated.

Does this refer to systemctl commands changes in systemd version 246?
Like bugs https://bugs.mageia.org/show_bug.cgi?id=27046

Assigning to Mageia Tools Team.

Hi, thanks for reporting this bug.
Assigned to the package maintainer.

(Please set the status to 'assigned' if you are working on it)

Keywords: (none) => Triaged

Aurelien Oudelet 2020-08-25 14:16:13 CEST

Assignee: bugsquad => mageiatools

Comment 11 Alex Kotov 2021-11-18 11:57:24 CET
Hello, friends. In my spare time, I examined in more or less detail the work of these "three Musketeers": drakclock->chrony->ntp.

Let me remind you that in Mageia-5 there were no problems with displaying and enabling automatic synchronization over NTP, the checkbox showed that NTP was being used and drakclock successfully registered ntp servers. I began to figure out exactly where and where drakclock writes and reads these settings. As it turned out, it works directly with configuration files: /etc/chrony.conf and /etc/ntp.conf.

In Mageia-5, there is a line in the /etc/chrony.conf file that drakclock starts from (which it is looking for) - this is "server iburst", which is missing in the Mageia-7/8 configuration files.

Therefore, drakclock cannot find a place exactly where to insert the servers that are selected from the list when the "Use NTP" checkbox is enabled.

In order for drakclock to finally be able to register the settings in the configuration files, they need to be changed:

If the ntp package is installed:
edit /etc/ntp.conf
---
#pool 2.fedora.pool.ntp.org iburst
server iburst

If the chrony package is installed:
edit /etc/chrony.conf
---
#pool pool.ntp.org iburst
server iburst

After that, drakclock starts working correctly and displays the status of the checkbox and the list.


The only question that remained a mystery to me... If both ntp and chrony packages are installed, then both of their services are in the "enabled" state. It is assumed that drakclock should use only one of them, and disable the second one, since only one should be engaged in synchronization. :)

Conclusion: The reason for the incorrect operation of drakclock was in the configuration files /etc/chrony.conf and /etc/ntp.conf. Could you fix drakclock (chrony.conf/ntp.conf)? I am grateful in advance...

Sincerely,
Alex
Comment 12 Alex Kotov 2021-11-18 14:21:22 CET
additionally...

Considering that the update process may take some time, for those who want to fix the situation right now, I made an rpm-patch.

You can download rpm here: https://github.com/AKotov-dev/drakclock-patch

That's all for now, sorry to bother you.

p.s. if the distribution of such rpm packages is prohibited, I ask the moderators to delete this message.

Sincerely,
Alex
Comment 13 Rolf Pedersen 2021-11-18 14:52:10 CET
Created attachment 12992 [details]
Output of user commands, 'sudo journalctl | grep pool.ntp.org' and 'drakclock'

I am running up-to-date 64-bit Mageia 8.
My experience for many versions is to choose network time synchronization during install and to be prompted to install the ntp package.
My experience when running drakclock at other times is as described, the ui not showing ntp enabled with no server chosen.  I repeated that experience, chose the US pool server, ok'ed, some time passed, gui closed, and subsequent runs show as depicted in https://bugs.mageia.org/attachment.cgi?id=11835 attachment.  The output of running drakclock from terminal is included in this attachment and shows:
Command line: /usr/sbin/ntpd -gqc /dev/null us.pool.ntp.org
reflecting my choice.  I have

[rolf@x570i ~]$ rpm -q ntp chrony
ntp-4.2.8p15-1.mga8
chrony-4.0-2.mga8
[rolf@x570i ~]$ grep iburst /etc/ntp.conf
pool 2.fedora.pool.ntp.org iburst
[rolf@x570i ~]$ grep iburst /etc/chrony.conf
pool pool.ntp.org iburst

I tried commenting the line containing 'iburst' in both configuration files but it made no obvious difference to the operation of drakclock.  

[rolf@x570i ~]$ sudo systemctl status chronyd.service
● chronyd.service - NTP client/server
     Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Thu 2021-11-18 04:11:49 PST; 32min ago
       Docs: man:chronyd(8)
             man:chrony.conf(5)
   Main PID: 2468 (code=exited, status=0/SUCCESS)
        CPU: 39ms

Nov 18 01:21:59 x570i systemd[1]: Starting NTP client/server...
Nov 18 01:21:59 x570i chronyd[2468]: chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTE>
Nov 18 01:21:59 x570i chronyd[2468]: Frequency -6.821 +/- 0.374 ppm read from /var/lib/chrony/drift
Nov 18 01:21:59 x570i systemd[1]: Started NTP client/server.
Nov 18 01:22:07 x570i chronyd[2468]: Selected source 165.232.149.130 (pool.ntp.org)
Nov 18 04:11:49 x570i chronyd[2468]: chronyd exiting
Nov 18 04:11:49 x570i systemd[1]: Stopping NTP client/server...
Nov 18 04:11:49 x570i systemd[1]: chronyd.service: Succeeded.
Nov 18 04:11:49 x570i systemd[1]: Stopped NTP client/server.

-using pool.ntp.org

[rolf@x570i ~]$ sudo journalctl | grep pool.ntp.org
Sep 30 00:44:28 x570i chronyd[1846]: Selected source 209.115.181.106 (pool.ntp.org)
Sep 30 00:44:28 x570i chronyd[1846]: Selected source 92.222.209.69 (pool.ntp.org)
Sep 30 00:45:33 x570i chronyd[1846]: Selected source 209.115.181.106 (pool.ntp.org)
Sep 30 18:08:10 x570i chronyd[1770]: Selected source 194.58.206.148 (pool.ntp.org)
...

and at least one, usually several such entries every day since.  AFAICT, ntp is working.

At https://www.pool.ntp.org/zone/us I see:

United States — us.pool.ntp.org
To use this specific pool zone, add the following to your ntp.conf file:
	   server 0.us.pool.ntp.org
	   server 1.us.pool.ntp.org
	   server 2.us.pool.ntp.org
	   server 3.us.pool.ntp.org
In most cases it's best to use pool.ntp.org to find an NTP server (or 0.pool.ntp.org, 1.pool.ntp.org, etc if you need multiple server names). The system will try finding the closest available servers for you. If you distribute software or equipment that uses NTP, please see our information for vendors.

Similar at https://www.pool.ntp.org/zone/ru and I suspect at the page for all localized servers.  Also, at 'information for vendors', https://www.pool.ntp.org/vendors.html there is more protocol advised for software distributors.

It appears to me that drakclock winds up following the first line of advice from  pool.ntp.org possibly directed at individuals.  However, for OS distributors, the advice is something else:

"You must absolutely not use the default pool.ntp.org zone names as the default configuration in your application or appliance."

It might be good to take these considerations into account when changing how the software works.

Thanks.

CC: (none) => rolfpedersen

Comment 14 Alex Kotov 2021-11-18 15:22:51 CET
In reply to Rolf Pedersen from comment #13)
> [rolf@x570i ~]$ grep iburst /etc/ntp.conf
> pool 2.fedora.pool.ntp.org iburst
> [rolf@x570i ~]$ grep iburst /etc/chrony.conf
> pool pool.ntp.org iburst
> 
> I tried commenting the line containing 'iburst' in both configuration files
> but it made no obvious difference to the operation of drakclock.  
Hi, Rolf Pedersen. ;)
I hope that you not only commented out the lines you found above, but also added the lines "server iburst" instead? Otherwise, you will not see the parser effect and drakclock will still not be able to insert the necessary servers into the configuration files and will not be able to display the correct state. Could you confirm or deny this?
Comment 15 Rolf Pedersen 2021-11-18 16:10:40 CET
I commented the lines without adding 'server iburst' as I was experimenting with this change in particular.  After commenting and then adding 'server iburst' to both files, I was immediately able to see the checkbox to enable ntp checked when I started drakclock.  The server field was not filled in and I selected 'us.pool.ntp.org'
After reboot, however, the checkbox was not checked and server field was blank in drakclock.  I have:

[rolf@x570i ~]$ grep iburst /etc/chrony.conf 
#pool pool.ntp.org iburst
server iburst
[rolf@x570i ~]$ grep iburst /etc/ntp.conf 
#pool 2.fedora.pool.ntp.org iburst
[rolf@x570i ~]$

Instead, in ntp.conf, there is:

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#pool 2.fedora.pool.ntp.org iburst
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org

and the output from drakclock is much less:

[rolf@x570i ~]$ drakclock
Ignore the following Glib::Object::Introspection & Gtk3 warnings
Subroutine Gtk3::main redefined at /usr/share/perl5/vendor_perl/Gtk3.pm line 539.
Thu Nov 18 07:04:22 AM PST 2021
[rolf@x570i ~]$
Comment 16 Alex Kotov 2021-11-18 16:56:30 CET
(In reply to Rolf Pedersen from comment #15)
> I commented the lines without adding 'server iburst' as I was experimenting
> with this change in particular.  After commenting and then adding 'server
> iburst' to both files, I was immediately able to see the checkbox to enable
> ntp checked when I started drakclock.
Thank you for testing, Rolf. :)

If you add your servers manually, then if the "ntpd" service is active, drakclock will show that the checkbox is enabled. But the operation of drakclock in the original, untouched configuration assumes that the "ntpd/cronyd" service is not active. And it is in this form (in the original) that the string "server iburst" will be needed. Otherwise, the configuration will not be complete, and ntp and crony can be used regardless of drakclock, since drakclock is just an interface, and the services themselves can be used manually and they need a full default configuration file.

This is what I managed to understand from the logic that drakclock offers. Subjectively, it looks like this to me. :)

Sincerely,
Alex
Comment 17 Alex Kotov 2021-11-18 17:37:27 CET
In other words... :)

In order for drakclock to start working properly, in the presence of the original (native, unchanged) configuration files /etc/chrony.conf и /etc/ntp.conf you either need to execute these commands:

su/password
systemctl stop chronyd ntpd; systemctl disable chronyd ntpd
sed -i 's/^pool.*/server iburst/g' {/etc/ntp.conf,/etc/chrony.conf}

OR, fix /etc/ntp.conf and /etc/chrony.conf, as described above, replace the necessary lines with "server iburst" and click the "NTP" checkbox and the "Ok" button in drakclock (make on/off and apply (кнопка Ok)), if it is active

OR, as already written above, install a patch: https://github.com/AKotov-dev/drakclock-patch

I repeat, these actions must be performed in the presence of the ORIGINAL configuration files /etc/ntp.conf and /etc/chrony.conf

p.s. Well, that's about it now. This is the end of my rich French vocabulary. :)

Sincerely,
Alex
Comment 18 Rolf Pedersen 2021-11-18 18:35:57 CET
(In reply to Alex Kotov from comment #17)
> In other words... :)
> 
> In order for drakclock to start working properly, in the presence of the
> original (native, unchanged) configuration files /etc/chrony.conf и
> /etc/ntp.conf you either need to execute these commands:
> 
> su/password
> systemctl stop chronyd ntpd; systemctl disable chronyd ntpd
> sed -i 's/^pool.*/server iburst/g' {/etc/ntp.conf,/etc/chrony.conf}
> 
> OR, fix /etc/ntp.conf and /etc/chrony.conf, as described above, replace the
> necessary lines with "server iburst" and click the "NTP" checkbox and the
> "Ok" button in drakclock (make on/off and apply (кнопка Ok)), if it is active
>

After you asked me to clarify in Comment 14, I *did* follow your instructions.  I commented the original line containing 'iburst' in ntp.conf and chrony.conf.  I added the 'server iburst' line to both.  I *could* "see the checkbox to enable ntp checked when I started drakclock.  The server field was not filled in and I selected 'us.pool.ntp.org'".

However, after a reboot, "the checkbox was not checked and server field was blank in drakclock.  I have:

[rolf@x570i ~]$ grep iburst /etc/chrony.conf 
#pool pool.ntp.org iburst
server iburst
[rolf@x570i ~]$ grep iburst /etc/ntp.conf 
#pool 2.fedora.pool.ntp.org iburst
[rolf@x570i ~]$"

IOW, a reboot, after I had modified the original config files in the manner you suggest, removed the 'server iburst' line I had written to /etc/ntp.conf and something had written in that file, under the commented original line:

#pool 2.fedora.pool.ntp.org iburst
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org

I did not write that.  I made the edits you suggest on the two "original" config files, ran drakclock, as described, and rebooted.  The only changes I have made to the original config files was to comment the lines you specify and add the line you specify to both.  Not all at once, to be sure, but I changed nothing else, maybe CR.  If you don't have both chrony and ntp installed, maybe a difference is there. 
 
> OR, as already written above, install a patch:
> https://github.com/AKotov-dev/drakclock-patch
> 
> I repeat, these actions must be performed in the presence of the ORIGINAL
> configuration files /etc/ntp.conf and /etc/chrony.conf
> 
> p.s. Well, that's about it now. This is the end of my rich French
> vocabulary. :)
> 
> Sincerely,
> Alex
Comment 19 Alex Kotov 2021-11-18 19:57:29 CET
Created attachment 12994 [details]
ntp.conf_and_chrony.conf_corrected.tar.gz

Dear Rolf, I have difficulties with translation (I use an online translator), so I will try to simplify everything as much as possible if drakclock still doesn't work for you after all the manipulations. And so... :)

1. Close drakclock (or MCC) if it is open

2. Log in to the terminal with root privileges (su/password) and run:
systemctl stop ntpd chronyd; systemctl disable ntpd chronyd

3. In the attachment ntp.conf_and_chrony.conf_corrected.tar.gz contains already corrected files /etc/ntp.conf and /etc/chrony.conf. Download it and overwrite them on top of existing files on your system.

4. Launch: drakclock

5. Turn on the "NTP" checkbox, select the server for synchronization and click "Ok" button

6. After drakclock applies the parameters and closes, open it again to make sure that the parameters are saved and applied again by the command: drakclock

If you have time, write about the results. Thanks.

p.s. it is not necessary to restart the computer and it is not necessary.
Comment 20 Rolf Pedersen 2021-11-18 22:09:09 CET
I executed steps 1-5.
With step 6, drakclock shows the settings persist, even after a reboot ;).

Also after the reboot, chronyd remained disabled

● chronyd.service - NTP client/server
     Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; vendor preset: enabled)
     Active: inactive (dead)

while ntpd became active/enabled

● ntpd.service - Network Time Service
     Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
     Active: active (running) since Thu 2021-11-18 12:59:16 PST; 5min ago

I suppose that is expected but I was curious.

Thanks.
Comment 21 Alex Kotov 2021-11-19 09:43:04 CET
Created attachment 12995 [details]
drakclock-perl-diff.tar.gz

Thanks for testing, Rolf. Nevertheless, the "ball" does not end there...

The second part of the "Marlezon Ballet" - is the correction of drakclock collaboration when installing two "time agents" at once: ntp and chrony... :)

If you start from scratch and remove both ntp and chrony packages, then when you try to enable NTP in drakclock, it will require the installation of the chrony package. We agree and install the chrony package (with the new correct configuration file, see above). After that, drakclock starts working correctly and correctly manages its activity.

Let's assume that the user took his own initiative and installed the ntp package (with the new correct configuration file, see above). By default, he's fine:
[root@localhost Desktop]# systemctl is-enabled ntpd
disabled

It can be seen from the drakclock code that it supports working with ntp and moreover, ntp is a priority for it! Of the two installed side by side (chrony and ntp), he chooses exactly ntp. As a result, when the NTP checkbox is turned on again, it corrects the /etc/ntp.conf config and synchronizes the time already using ntpd. But what is the status of the chronyd service after switching? Looking:
[root@localhost Desktop]# systemctl is-enabled ntpd chronyd
enabled
enabled

And here's the trouble - the ntpd service has risen and is active, but the chronyd service is still in "enabled"!

Conclusion: when automatically switching from chronyd to ntpd, drakclock forgets to deactivate the chronyd service.

To fix this error, I tried to fix /etc/libexec/drakclock. Here's the DIFF:

[root@localhost drakclock-perl-patch]# diff -u a/drakclock b/drakclock
--- a/drakclock	2021-02-21 17:56:25.000000000 +0300
+++ b/drakclock	2021-11-19 10:14:10.780984735 +0300
@@ -128,9 +128,11 @@
 				# Wait up to 30s for sync
 				$sync_ok = !system('chronyc', 'waitsync', '30', '0.1');
 				system('systemctl', 'stop', "$ntpd.service") if !$sync_ok;
+				system('systemctl', 'disable', "ntpd.service") if !$sync_ok;
 			    } else {
 				$sync_ok = !system('/usr/sbin/ntpd', '-gqc', '/dev/null', $choosed_serv);
 				system('systemctl', 'start', "$ntpd.service") if $sync_ok;
+				system('systemctl', 'disable', "chronyd.service") if $sync_ok;
 			    }
 			    if ($sync_ok) {
 				update_time(); #- get the new time before updating the hwclock
@@ -147,6 +149,8 @@
 			    if (is_ntp_daemon_running()) {
 				system('systemctl', 'stop', "$ntpd.service");
 				system('systemctl', 'disable', "$ntpd.service");
+				system('systemctl', 'stop', "chronyd.service");
+				system('systemctl', 'disable', "chronyd.service");
 			    }
 			}
 			if ($need_date) {

After the fixes, drakclock works correctly. In the attachment drakclock-perl-diff.tar.gz contains a corrected file b/drakclock и drakclock-perl-diff.

I have no experience in perl, but I understand the general "drawing" of the code. However, if this does not burden you too much, I ask Mageia perl specialists to review the changes (diff) that I am making to /usr/libexec/drakclock.


The general conclusion from everything, taking into account the tests from Rolf Pedersen... For drakclock to work properly, it was necessary to fix the configuration files /etc/ntp.conf and /etc/chrony.conf (ntp.conf_and_chrony.conf_corrected.tar.gz is in the attachment above) and adjust the activity of services ntpd.service and chronyd.service in the very /usr/libexec/drakclock (drakclock-perl-diff.tar.gz is in the attachment).

On this cheerful note, I finish and look forward to a kick in the ass from the Mageia team for arbitrariness. Amen.

Sincerely,
Alex
Comment 22 Alex Kotov 2021-11-19 10:58:52 CET
Created attachment 12996 [details]
drakclock_test_screenshot.png

...additional for QA Team

To simplify testing drakclock as much as possible, I just wrote a program "drakclock_test" - ntpd and cronyd status monitor (Lazarus-x86_64, see the screenshot in the attachment). When "drakclock_test" is started, it displays the full state of ntpd and chronyd (active/inactive, enabled/disabled) IN REAL TIME. This allows you to test drakclock in various ways: delete ntp/chrony packages, manage NTP from drakclock and immediately monitor the status.

drakclock_test: https://github.com/AKotov-dev/drakclock-patch/raw/main/drakclock_test.tar.gz

All of the attachments and patches listed above are duplicated on my GitHub so that it is not lost: https://github.com/AKotov-dev/drakclock-patch

Best regards,
Alex
Comment 23 Alex Kotov 2021-11-19 18:39:38 CET
Added for checking by maintainers (on GitHub, link above):
---
chrony-4.0-3.mga8.src.rpm - fixed /etc/chrony.conf to work correctly with drakclock

ntp-4.2.8p15-2.mga8.src.rpm - fixed /etc/ntp.conf to work correctly with drakclock

drakxtools-18.45-2.mga8.src.rpm - fixed /usr/libexec/drakclock to switch ntpd/cronyd correctly
Comment 24 Alex Kotov 2021-11-20 18:46:13 CET
drakclock-patch-0.3-0:
---
Dependencies: chrony
URL: https://github.com/AKotov-dev/drakclock-patch/raw/main/drakclock-patch-0.3-0.mrx8.noarch.rpm

Prepares the system to use NTP:
---
1. Installs chrony if the user has not already done so

2. Replaces files with their correct counterparts: /etc/chrony.conf and /etс/ntp.conf (if present)

3. Applies the patch /usr/libexec/drakclock.patch to the file /usr/libexec/drakclock (if not used before)

And no manual intervention. I'll leave it here just in case...
Comment 25 Rolf Pedersen 2021-11-21 18:48:43 CET
Created attachment 13001 [details]
konsole output of removing chrony, ntp, installing the patch rpm, and running drakclock twice

Hi Alex,
For a bit of Sunday fun, I tried testing your patch rpm:

1. remove ntp, chrony
2. install patch rpm
3. run drakclock twice

The konsole record is attached.

It seems drakclock is now working as expected.  *Seems* as this machine experienced a strange new screen blanking behavior co-incident with these types of manipulations, apparently solved with an old workaround, 'xset -dpms' as a startup program, so count no chickens! ;)

I made an amateurish attempt to screen record the two drakclock runs just after installing the rpm and that *should* be viewable at youtube:  https://youtu.be/_H_TC7RJUok  This is not my day job.

If any information there is not appropriate, let me know.

Thanks.
Comment 26 Alex Kotov 2021-11-22 08:22:23 CET
Hello, Rolf!
Great job and video, thanks a lot! If you don't mind, I have already given a link to this video in Russia: https://linuxforum.ru/viewtopic.php?pid=469595#p469595 I think it will be useful for everyone who wants to conduct a test and fix the situation with drakclock. :)

Sincerely,
Alex
Comment 27 Jose Manuel López 2022-07-06 10:29:49 CEST
This is still broken, drakconf does not show the selected ntp server, the fields remain empty.


Greetings!!

CC: (none) => joselp

Comment 28 Rolf Pedersen 2022-07-06 16:12:54 CEST
Created attachment 13327 [details]
drakclock still working with Alex Kotov's patch

[rolf@x570i ~]$ rpm -qa --last | grep drakclock
drakclock-patch-0.3-0.mrx8.noarch             Sun 21 Nov 2021 08:52:19 AM PST
[rolf@x570i ~]$

The attached screenshot demonstrates that Alex Kotov's patch/procedure is still working for me and is probably something that is worth pursuing.  I reiterate that it seems the protocols for distribution software that ntp.org advises, as cited in Comment 13, are not respected in drakclock and that detail should be addressed, AFAICT.
Thanks.
David Walser 2022-07-18 18:32:22 CEST

Target Milestone: Mageia 8 => Mageia 9
Priority: Normal => release_blocker


Note You need to log in before you can comment on or make changes to this bug.