1

I have no experience in this field but I have the task to synchronize a number of Ubuntu 18.04 machines on a local network not connected to the internet. I tried using chrony following the instructions found in this answer, but when I tried systemctl enable chronyd I received this error

Failed to enable unit: Refusing to operate on linked unit file chronyd.service

I tried disabling it first, which showed

Removed /etc/systemd/system/chronyd.service.
Removed /etc/systemd/system/multi-user.target.wants/chrony.service

but now I can't start it or enable it, showing this error instead

Failed to enable unit: Unit file chronyd.service does not exist.

while I can see the file being present in the /etc/systemd/system/ folder. I'm at loss here on what I should do. I tried uninstalling and installing chrony again without success.

Otter_warrior
  • 21
  • 1
  • 2
  • 1
    After making changes to the underlying file structure you may want to start with `systemctl daemon-reload` (`sudo systemctl daemon-reload` if you're not logged in as root) to have systemd reload all unit files and recreate the entire dependency tree. – Bob May 19 '21 at 12:35
  • Thank you @Bob. I tried as you said but it would still show `chronyd.service` as missing. I purged chrony and reinstalled it. After applying the changes to the configuration I used `sudo systemctl daemon-reload` before enabling it, but it still showed the error `Refusing to operate on linked unit file chronyd.service` as before – Otter_warrior May 19 '21 at 13:45
  • Just a wild hunch: trying using 'chrony.service' (not 'chronyd.service') in your systemctl commands. – Brandon Xavier May 19 '21 at 14:58
  • I restarted the machine and chrony seems to be working fine now, even if `enable` still doesn't work. Weird! – Otter_warrior May 20 '21 at 13:08
  • Would you mind updating the title to something a little bit more relevant to the problem? Something like "Unable to enable or start Chrony service"? The disconnected nature of your environment has turned out to be unrelated to actual issue, but the actual cause was identified and answered thus this is still a useful question/answer. – Paul Aug 15 '23 at 23:08

1 Answers1

1

This is the correct answer to resolve the issue.
systemctl enable chrony

Just a wild hunch: trying using 'chrony.service' (not 'chronyd.service') in your systemctl commands. – Brandon Xavier May 19, 2021 at 14:58