How to run Chronyd in Debug mode On RHEL / CentOS

Chrony Logo

This tutorial will be helpful for beginners to run Chronyd in debug mode On RHEL , CentOS , Alma Linux and Rocky Linux.

What is Chronyd?

Chronyd is a cross-platform time tracking and project management tool. It allows you to track time and tasks across multiple projects, devices, and files.

Uses of Chronyd

  • Chronyd can be used to keep track of the time and date, schedule events, and send notifications to individuals.
  • Chronyd can also be used to keep track of the time of day and day of the week.
  • Chronyd can be used to create calendars and to manage personal schedules.

How to run Chronyd in Debug mode?

Step 1: Modify the /etc/sysconfig/chronyd file by adding “-dd” options to the file by using the below command

sed -i 's/OPTIONS=""/OPTIONS="-dd"/g' /etc/sysconfig/chronyd
[root@almalinux ~]# cat /etc/sysconfig/chronyd
# Command-line options for chronyd
OPTIONS="-dd"
[root@almalinux ~]#

Step 2: Copy the Chronyd service file to the /etc/systemd/system

cp -pr /lib/systemd/system/chronyd.service /etc/systemd/system/

Step 3: Under Service change the Type=forking to Type=simple

sed -i 's/Type=forking/Type=simple/g' /etc/systemd/system/chronyd.service
[root@almalinux ~]# cat /etc/systemd/system/chronyd.service
[Unit]
Description=NTP client/server
Documentation=man:chronyd(8) man:chrony.conf(5)
After=ntpdate.service sntp.service ntpd.service
Conflicts=ntpd.service systemd-timesyncd.service
ConditionCapability=CAP_SYS_TIME

[Service]
Type=simple
PIDFile=/run/chrony/chronyd.pid
EnvironmentFile=-/etc/sysconfig/chronyd
ExecStart=/usr/sbin/chronyd $OPTIONS
ExecStartPost=/usr/libexec/chrony-helper update-daemon
ExecStopPost=/usr/libexec/chrony-helper remove-daemon-state
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full

[Install]
WantedBy=multi-user.target
[root@almalinux ~]#

Step 4: Restart the chronyd service and verify the logs

systemctl daemon-reload

systemctl restart chronyd.service

Step 5: Verify the logs are generating or not from /var/log/messages file

Sep 16 14:26:38 almalinux chronyd[732]: 2022-09-16T08:56:38Z sourcestats.c:584:(SST_DoNewRegression) off=-5.684919e+02 freq=-8.323545e-01 skew=6.964053e+00 n=25 bs=19 runs=3 asym=0.000000 arun=-1
Sep 16 14:26:38 almalinux chronyd[732]: 2022-09-16T08:56:38Z sourcestats.c:708:(SST_GetSelectionData) n=6 off=-2518.173331 dist=29.459639 sd=582.355499 first_ago=781.832549 last_ago=3.796313 selok=1
Sep 16 14:26:38 almalinux chronyd[732]: 2022-09-16T08:56:38Z sources.c:648:(mark_source) 165.22.211.200 status=3 options=0 reach=377/8 updates=1 distant=32 leap=0 vote=0 lo=-2547.632970 hi=-2488.713692
Sep 16 14:26:38 almalinux chronyd[732]: 2022-09-16T08:56:38Z sourcestats.c:708:(SST_GetSelectionData) n=6 off=-2507.797795 dist=0.580161 sd=400.238290 first_ago=910.774841 last_ago=0.030954 selok=1

Conclusion

From this tutorial, you have learned how to run Chronyd in Debug mode On RHEL, CentOS, Alma Linux and Rocky Linux

Do let us know your comments and feedback in the comments section below.

If my articles on TipsonUNIX have helped you, kindly consider buying me a coffee as a token of appreciation.

Kofi logo
Buymeacoffee

Thank You for your support!!

Leave a Comment