Bug 2552941 - ntp module in cloud-init tries to restart the wrong service
Summary: ntp module in cloud-init tries to restart the wrong service
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: cloud-init
Version: 44
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jeremy Cline
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2026-10-14 20:57 UTC by Jakub Kuczys
Modified: 2026-10-26 17:55 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jakub Kuczys 2026-10-14 20:57:06 UTC
Description of problem:
When booting Fedora cloud-init image with user-data containing ntp configuration, ntp configuration fails to get applied due to cloud-init trying to restart a service named `chrony` rather than `chronyd`.
I was able to reproduce this on Fedora 43 as well but bugzilla only allows me to select one version.

Version-Release number of selected component (if applicable):
cloud-init-25.3-3.fc44.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create a VM with the Fedora 44 cloud-init image using the following user-data (I tested locally with https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2):
```
#cloud-config
ntp:
  pools: ["pool.ntp.org"]
users:
  - default
  - name: vm
    plain_text_passwd: vm
    lock_passwd: false
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
```
2. Once cloud-init finishes running, you should see the issue in boot logs. You can also try logging in with vm:vm and run `sudo cloud-init status -l` to see the same error.

Actual results:
cloud-init ntp module failed to restart the service due to wrong name being used.
Here's a short excerpt from the boot logs:
```
[  OK  ] Reached target multi-user.target - Multi-User System.
[    8.373325] cloud-init[882]: Cloud-init v. 25.3 running 'modules:config' at Wed, 14 Oct 2026 20:24:59 +0000. Up 8.36 seconds.
[    8.383909] cloud-init[882]: 2026-10-14 20:24:59,454 - cc_ntp.py[ERROR]: Failed to reload/start ntp service: Unexpected error while running command.
[    8.384635] cloud-init[882]: Command: ['systemctl', 'reload-or-restart', 'chrony']
[    8.385033] cloud-init[882]: Exit code: 5
[    8.385254] cloud-init[882]: Reason: -
[    8.385468] cloud-init[882]: Stdout:
[    8.385671] cloud-init[882]: Stderr: Failed to reload-or-restart chrony.service: Unit chrony.service not found.
[    8.386166] cloud-init[882]: Traceback (most recent call last):
[    8.386472] cloud-init[882]:   File "/usr/lib/python3.14/site-packages/cloudinit/config/cc_ntp.py", line 623, in handle
[    8.386995] cloud-init[882]:     cloud.distro.manage_service(
[    8.387295] cloud-init[882]:     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
[    8.387587] cloud-init[882]:         "reload", ntp_client_config["service_name"]
[  OK  ] Finished cloud-config.service - Cloud-init: Config Stage.
[    8.388332] cloud-init[882]:         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[    8.388703] cloud-init[882]:     )
[    8.388897] cloud-init[882]:     ^
[    8.389096] cloud-init[882]:   File "/usr/lib/python3.14/site-packages/cloudinit/distros/__init__.py", line 1384, in manage_service
         Starting cloud-final.service - Cloud-init: Final Stage...
[    8.390015] cloud-init[882]:     return subp.subp(cmd, capture=True, rcs=rcs)
[    8.390646] cloud-init[882]:            ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[    8.391046] cloud-init[882]:   File "/usr/lib/python3.14/site-packages/cloudinit/subp.py", line 291, in subp
[    8.391549] cloud-init[882]:     raise ProcessExecutionError(
[    8.391850] cloud-init[882]:         stdout=out, stderr=err, exit_code=rc, cmd=args
[    8.392232] cloud-init[882]:     )
[    8.392605] cloud-init[882]: cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
[    8.393097] cloud-init[882]: Command: ['systemctl', 'reload-or-restart', 'chrony']
[    8.393477] cloud-init[882]: Exit code: 5
[    8.393742] cloud-init[882]: Reason: -
[    8.393942] cloud-init[882]: Stdout:
[    8.394991] cloud-init[882]: Stderr: Failed to reload-or-restart chrony.service: Unit chrony.service not found.
[    8.396516] cloud-init[882]: 2026-10-14 20:24:59,455 - log_util.py[WARNING]: Running module ntp (<module 'cloudinit.config.cc_ntp' from '/usr/lib/python3.14/site-packages/cloudinit/config/cc_ntp.py'>) failed
[    8.408106] cloud-init[882]: Cloud-init v. 25.3 running 'modules:final' at Wed, 14 Oct 2026 20:24:59 +0000. Up 8.40 seconds.
```
and output from `sudo cloud-init status -l`:
```
[vm@localhost ~]$ sudo cloud-init status -l
status: error
extended_status: error - done
boot_status_code: enabled-by-generator
last_update: Thu, 01 Jan 1970 00:00:08 +0000
detail: DataSourceNoCloud [seed=dmi,/dev/sr0][dsmode=local]
errors:
	- ('ntp', ProcessExecutionError("Unexpected error while running command.\nCommand: ['systemctl', 'reload-or-restart', 'chrony']\nExit code: 5\nReason: -\nStdout: \nStderr: Failed to reload-or-restart chrony.service: Unit chrony.service not found."))
recoverable_errors:
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 chrony.service not found.
WARNING:
	- Running module ntp (<module 'cloudinit.config.cc_ntp' from '/usr/lib/python3.14/site-packages/cloudinit/config/cc_ntp.py'>) failed
```

Expected results:
I expected cloud-init to succeed with no errors.

Additional info:
Potentially relevant issue upstream from few years ago: https://github.com/canonical/cloud-init/issues/3756
Seems like the fix included RHEL but missed Fedora though: https://github.com/canonical/cloud-init/blob/8537237d80a48c8f0cbf8e66aa4826bbc882b022/cloudinit/config/cc_ntp.py#L121-L127

Comment 1 Jeremy Cline 2026-10-26 17:55:48 UTC
Thanks for the detailed report - I submitted https://github.com/canonical/cloud-init/pull/7184 and assuming it gets accepted (which seems rather likely) I'll pick it back to stable releases. 

It won't help for the release images including, unfortunately, F45, but for public clouds where we regularly update images it'll be fixed.


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