Linux启动NTP服务报错Failed to start ntpd.service: Unit ntpd.service no ...

打印 上一主题 下一主题

主题 560|帖子 560|积分 1680

前言

今天在使用Linux的过程中安装了NTP服务,刚安装完成时使用systemctl start ntpd下令顺利地启动了NTP服务,但接下来我尝试使用systemctl diable ntpd禁用开机自启动后,系统实行了以下操作:
  1. Removed "/etc/systemd/system/multi-user.target.wants/ntpsec.service".
  2. Removed "/etc/systemd/system/ntpd.service".
  3. Removed "/etc/systemd/system/ntp.service".
复制代码
然后再使用systemctl enable ntpd下令就提示Failed to enable unit: Unit file ntpd.service does not exist错误,使用systemctl start ntpd下令就会提示Failed to start ntpd.service: Unit ntpd.service not found错误。比力闲的话可以看看我的研究过程,不愿意看研究过程的可以直接看末了的办理办法。
研究过程

出现问题后,首先思量的就是卸载重装NTP,但是这种方法似乎并不会完全删除配置文件(纵然是使用apt remove --purge也不可),无法规复到最初状态,导致仍无法启动NTP以及检察状态。我根据网上给出的方法,使用systemctl list-units --type=service下令检察全部服务,但是由于我没有翻页检察导致我没看到NTP相干的服务,导致我以为是没有安装成功,于是我在可视化界面中找到etc目录(软件包一样平常安装在这个目录),在这个目录中找到了一个叫ntpsec的文件夹,于是我怀疑是下令有所更新,于是使用了systemctl enable ntpsec
下令,发现成功输出了NTP有关信息!神奇的是,接下来再使用systemctl enable ntpd或systemctl start ntpd或systemctl status ntpd等下令均可成功实行。但详细是什么原理还没搞清晰。
办理方法

遇到Failed to start ntpd.service: Unit ntpd.service not found或Failed to enable unit: Unit file ntpd.service does not exist的错误时,可尝试使用如下下令:
  1. systemctl enable ntpsec
复制代码
然后再使用systemctl start ntpd等下令。目前沾点边的推测是服务名称全名是ntpsec,最初安装时默认enable,disable之后必须使用全名来才能enable,之后才能使用类似缩写的ntpd。详细原理还没有搞清晰,欢迎大家一起讨论。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

吴旭华

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表