Hi Team,
I have below test case:
AIM: disable the chronyd process, and set the date/time/timeZone of rocky to a specific values.
Expectation: Local/Universal and RTC time should be in sync and should be same as set by user.
Observation: once i set the date/time using timedatectl command, I observed that both RTC and Local/Universal are in sync, but when i reboot the system Local/Universal are set to other values were as RTC is still set to same time/date which i set using timedatectl command.
Logs:
Values before reboot
[root@localhost ~]# date
Mon Feb 17 06:18:55 PM IST 2025
[root@localhost ~]# timedatectl
Local time: Mon 2025-02-17 18:18:59 IST
Universal time: Mon 2025-02-17 12:48:59 UTC
RTC time: Mon 2025-02-17 12:48:59
Time zone: Asia/Calcutta (IST, +0530)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
[root@localhost ~]# timedatectl show
Timezone=Asia/Calcutta
LocalRTC=no
CanNTP=yes
NTP=yes
NTPSynchronized=no
TimeUSec=Mon 2025-02-17 18:19:03 IST
RTCTimeUSec=Mon 2025-02-17 18:19:02 IST
[root@localhost ~]# systemctl status chronyd
â—Ź chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; preset: enabled)
Active: active (running) since Mon 2025-02-17 18:03:28 IST; 16min ago
Docs: man:chronyd(8)
man:chrony.conf(5)
Main PID: 639 (chronyd)
Tasks: 1 (limit: 48952)
Memory: 5.1M
CPU: 137ms
CGroup: /system.slice/chronyd.service
└─639 /usr/sbin/chronyd -F 2
Feb 17 18:03:28 localhost systemd[1]: Starting NTP client/server...
Feb 17 18:03:28 localhost chronyd[639]: chronyd version 4.5 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 +D>
Feb 17 18:03:28 localhost chronyd[639]: Loaded 0 symmetric keys
Feb 17 18:03:28 localhost chronyd[639]: Frequency 0.000 +/- 1000000.000 ppm read from /var/lib/chrony/drift
Feb 17 18:03:28 localhost chronyd[639]: Using right/UTC timezone to obtain leap second data
Feb 17 18:03:28 localhost chronyd[639]: Loaded seccomp filter (level 2)
Feb 17 18:03:28 localhost systemd[1]: Started NTP client/server.
Feb 17 18:17:21 localhost chronyd[639]: Source 162.159.200.1 replaced with 3.6.43.90 (in.pool.ntp.org)
[root@localhost ~]# cat /tmp/timeInfo
Local time: Mon 2025-02-17 18:20:55 IST
Universal time: Mon 2025-02-17 12:50:55 UTC
RTC time: Mon 2025-02-17 12:50:55
Time zone: Asia/Calcutta (IST, +0530)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
[root@localhost ~]#
Disable the chronyd and set the time/date/timezone using timedatectl
[root@localhost ~]# systemctl disable chronyd
Removed "/etc/systemd/system/multi-user.target.wants/chronyd.service".
[root@localhost ~]# systemctl stop chronyd
[root@localhost ~]# systemctl status chronyd
â—‹ chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; preset: enabled)
Active: inactive (dead)
Docs: man:chronyd(8)
man:chrony.conf(5)
Feb 17 18:03:28 localhost chronyd[639]: Loaded 0 symmetric keys
Feb 17 18:03:28 localhost chronyd[639]: Frequency 0.000 +/- 1000000.000 ppm read from /var/lib/chrony/drift
Feb 17 18:03:28 localhost chronyd[639]: Using right/UTC timezone to obtain leap second data
Feb 17 18:03:28 localhost chronyd[639]: Loaded seccomp filter (level 2)
Feb 17 18:03:28 localhost systemd[1]: Started NTP client/server.
Feb 17 18:17:21 localhost chronyd[639]: Source 162.159.200.1 replaced with 3.6.43.90 (in.pool.ntp.org)
Feb 17 18:23:44 localhost chronyd[639]: chronyd exiting
Feb 17 18:23:44 localhost systemd[1]: Stopping NTP client/server...
Feb 17 18:23:44 localhost systemd[1]: chronyd.service: Deactivated successfully.
Feb 17 18:23:44 localhost systemd[1]: Stopped NTP client/server.
[root@localhost ~]#
[root@localhost ~]# timedatectl set-timezone "CST6CDT"
[root@localhost ~]# timedatectl set-time '2016-01-01 01:00'
[root@localhost ~]# cat /tmp/timeInfo
Local time: Mon 2025-02-17 18:27:19 IST
Universal time: Mon 2025-02-17 12:57:19 UTC
RTC time: Mon 2025-02-17 12:57:19
Time zone: Asia/Calcutta (IST, +0530)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
[root@localhost ~]# date
Fri Jan 1 01:00:23 AM CST 2016
[root@localhost ~]# timedatectl
Local time: Fri 2016-01-01 01:00:32 CST
Universal time: Fri 2016-01-01 07:00:32 UTC
RTC time: Fri 2016-01-01 07:00:32
Time zone: CST6CDT (CST, -0600)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
[root@localhost ~]# timedatectl show
Timezone=CST6CDT
LocalRTC=no
CanNTP=yes
NTP=no
NTPSynchronized=no
TimeUSec=Fri 2016-01-01 01:00:36 CST
RTCTimeUSec=Fri 2016-01-01 01:00:36 CST
[root@localhost ~]#
[root@localhost ~]# systemctl status chronyd
â—‹ chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; preset: enabled)
Active: inactive (dead)
Docs: man:chronyd(8)
man:chrony.conf(5)
Feb 17 06:33:28 localhost chronyd[639]: Loaded 0 symmetric keys
Feb 17 06:33:28 localhost chronyd[639]: Frequency 0.000 +/- 1000000.000 ppm read from /var/lib/chrony/drift
Feb 17 06:33:28 localhost chronyd[639]: Using right/UTC timezone to obtain leap second data
Feb 17 06:33:28 localhost chronyd[639]: Loaded seccomp filter (level 2)
Feb 17 06:33:28 localhost systemd[1]: Started NTP client/server.
Feb 17 06:47:21 localhost chronyd[639]: Source 162.159.200.1 replaced with 3.6.43.90 (in.pool.ntp.org)
Feb 17 06:53:44 localhost chronyd[639]: chronyd exiting
Feb 17 06:53:44 localhost systemd[1]: Stopping NTP client/server...
Feb 17 06:53:44 localhost systemd[1]: chronyd.service: Deactivated successfully.
Feb 17 06:53:44 localhost systemd[1]: Stopped NTP client/server.
Values of time/date after reboot
[root@localhost ~]# date
Mon Sep 2 11:16:55 PM CDT 2024
[root@localhost ~]# timedatectl show
Timezone=CST6CDT
LocalRTC=no
CanNTP=yes
NTP=no
NTPSynchronized=no
TimeUSec=Mon 2024-09-02 23:17:22 CDT
RTCTimeUSec=Fri 2016-01-01 05:20:30 CST
[root@localhost ~]# timedatectl
Local time: Mon 2024-09-02 23:17:28 CDT
Universal time: Tue 2024-09-03 04:17:28 UTC
RTC time: Fri 2016-01-01 11:20:36
Time zone: CST6CDT (CDT, -0500)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
[root@localhost ~]# cat /tmp/timeInfo
Local time: Mon 2024-09-02 19:04:45 CDT
Universal time: Tue 2024-09-03 00:04:45 UTC
RTC time: Fri 2016-01-01 07:07:52
Time zone: CST6CDT (CDT, -0500)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
[root@localhost ~]# systemctl status chronyd
â—‹ chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; preset: enabled)
Active: inactive (dead)
Docs: man:chronyd(8)
man:chrony.conf(5)