Wrong service name used for chrony when restarting service

Bug #1885952 reported by Lorant Nemeth
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Ryan Harper

Bug Description

service is called chronyd and not chrony in CentOS/RH. Have been tested with lated CentOS cloud image + all latest updates (with epel enabled).

[root@myhostname ~]# uname -a
Linux myhostname 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@myhostname ~]# cat /etc/centos-release
CentOS Linux release 7.8.2003 (Core)

[root@myhostname ~]# cloud-init single --name cc_ntp
Cloud-init v. 18.5 running 'single' at Wed, 01 Jul 2020 19:16:33 +0000. Up 54.51 seconds.
2020-07-01 19:16:34,023 - cc_ntp.py[ERROR]: Failed to reload/start ntp service: Unexpected error while running command.
Command: ['systemctl', 'reload-or-restart', 'chrony']
Exit code: 5
Reason: -
Stdout:
Stderr: Failed to reload-or-restart chrony.service: Unit not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.py", line 547, in handle
    systemd=cloud.distro.uses_systemd())
  File "/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.py", line 436, in reload_ntp
    util.subp(cmd, capture=True)
  File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 2084, in subp
    cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['systemctl', 'reload-or-restart', 'chrony']
Exit code: 5
Reason: -
Stdout:
Stderr: Failed to reload-or-restart chrony.service: Unit not found.
2020-07-01 19:16:34,025 - util.py[WARNING]: Running module cc_ntp (<module 'cloudinit.config.cc_ntp' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_ntp.pyc'>) failed
2020-07-01 19:16:34,040 - main.py[WARNING]: Ran cc_ntp but it failed!

Revision history for this message
Ryan Harper (raharper) wrote :

Centos/Rhel/Fedora/SuSE all use chronyd.service.

Changed in cloud-init:
assignee: nobody → Ryan Harper (raharper)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Ryan Harper (raharper) wrote :

It also turns out there's no templates/chrony.conf.centos.tmpl (or ntp); we can reuse the rhel one though.

Revision history for this message
Brett Holman (holmanb) wrote : Fixed in cloud-init version 22.3.

This bug is believed to be fixed in cloud-init in version 22.3. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Confirmed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
Revision history for this message
Felipe Alencastro (falencastro) wrote :

Also affects Rocky Linux

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.