我在“时间和日期设置”中设置了与互联网服务器同步的时间。那里没有显示任何错误。但是时间没有自动同步,并且偏离了几天。systemctl status systemd-timesyncd
提示无法找到相应的服务单元。如何修复此问题?
编辑:
笔记本电脑没有主电池,而且可能有辅助电池,如果有的话,也已经没电了,所以我希望在启动后尽快从互联网设置时间,即使用户没有登录。
$ timedatectl status
Local time: su 2023-06-25 11:53:30 EEST
Universal time: su 2023-06-25 08:53:30 UTC
RTC time: pe 1980-01-04 00:15:56
Time zone: Europe/Helsinki (EEST, +0300)
System clock synchronized: no
NTP service: n/a
RTC in local TZ: no
$ timedatectl timesync-status
Failed to query server: The name org.freedesktop.timesync1 was not provided by any .service files
$ systemctl status systemd-timesyncd
Unit systemd-timesyncd.service could not be found.
$ LC_ALL=C systemctl status ntp
* ntp.service - Network Time Service
Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2023-03-27 20:56:59 EEST; 2 months 28 days ago
Docs: man:ntpd(8)
Main PID: 593 (code=exited, status=0/SUCCESS)
Mar 27 20:55:19 jarnos-8510w ntpd[593]: Soliciting pool server 65.21.58.9
Mar 27 20:56:22 jarnos-8510w ntpd[593]: Soliciting pool server 95.216.71.38
Mar 27 20:56:23 jarnos-8510w ntpd[593]: Soliciting pool server 95.216.218.15
Mar 27 20:56:25 jarnos-8510w ntpd[593]: Soliciting pool server 91.189.91.157
Mar 27 20:56:25 jarnos-8510w ntpd[593]: Soliciting pool server 62.241.198.253
Mar 27 20:56:26 jarnos-8510w ntpd[593]: Soliciting pool server 65.109.217.171
Mar 27 20:56:59 jarnos-8510w ntpd[593]: ntpd exiting on signal 15 (Terminated)
Mar 27 20:56:59 jarnos-8510w systemd[1]: Stopping Network Time Service...
Mar 27 20:56:59 jarnos-8510w systemd[1]: ntp.service: Succeeded.
Mar 27 20:56:59 jarnos-8510w systemd[1]: Stopped Network Time Service.
$ systemctl status chrony
Unit chrony.service could not be found.
ntp
并且sntp
已安装,chrony
但尚未安装。
答案1
命令sudo apt install systemd-timesyncd
在这种情况下有所帮助。它还删除了ntp
。