16.04/var/log/syslog'systemd[1]: Time has been changed'消息每5秒出现一次

分享于 

5分钟阅读

ubuntu

  繁體

问题


Mar 1 15:52:34 ubuntu systemd[1]: Time has been changed


Mar 1 15:52:34 ubuntu systemd[1]: snapd.refresh.timer: Adding 1h 16min 25.978183s random time.


Mar 1 15:52:34 ubuntu systemd[1]: apt-daily.timer: Adding 8h 21min 914.167ms random time.


Mar 1 15:52:34 ubuntu systemd[6041]: Time has been changed



每5秒出现在/var/log/syslog中,看起来在不断改变时间,RTC时间也不正确。

关于系统的一些信息:

  • Ubuntu 16.04.4.4.0 -64-generic,x86_64,在VDS上运行

timedatectl


 Local time: Ср 2017-03-01 16:05:03 MSK


 Universal time: Ср 2017-03-01 13:05:03 UTC


 RTC time: Пт 2017-03-03 11:33:10


 Time zone: Europe/Moscow (MSK, +0300)


 Network time on: yes


NTP synchronized: yes


 RTC in local TZ: no



iptables


Chain INPUT (policy DROP)


Chain OUTPUT (policy ACCEPT)



INPUT链有规则。

systemctl list-units | grep running


acpid.path loaded active running ACPI Events Check


init.scope loaded active running System and Service Manager


acpid.service loaded active running ACPI event daemon


asterisk.service loaded active running Asterisk PBX


atd.service loaded active running Deferred execution scheduler


cron.service loaded active running Regular background program processing daemon


dbus.service loaded active running D-Bus System Message Bus


getty@tty1.service loaded active running Getty on tty1


hv-kvp-daemon.service loaded active running Hyper-V KVP Protocol Daemon


hv-vss-daemon.service loaded active running Hyper-V VSS Protocol Daemon 


iscsid.service loaded active running iSCSI initiator daemon (iscsid) 


lvm2-lvmetad.service loaded active running LVM2 metadata daemon 


lxcfs.service loaded active running FUSE filesystem for LXC 


mdadm.service loaded active running LSB: MD monitoring daemon 


mysql.service loaded active running MySQL Community Server 


openvpn@server.service loaded active running OpenVPN connection to server 


rsyslog.service loaded active running System Logging Service 


snapd.service loaded active running Snappy daemon 


ssh.service loaded active running OpenBSD Secure Shell server 


systemd-journald.service loaded active running Journal Service 


systemd-timesyncd.service loaded active running Network Time Synchronization 


systemd-udevd.service loaded active running udev Kernel Device Manager 


user@1000.service loaded active running User Manager for UID 1000 


vpsguard.service loaded active running VPSGUARD 


acpid.socket loaded active running ACPID Listen Socket 


dbus.socket loaded active running D-Bus System Message Bus Socket 


lvm2-lvmetad.socket loaded active running LVM2 metadata daemon socket 


snapd.socket loaded active running Socket activation for snappy daemon



我尝试过:

  • sudo systemctl stop systemd-timesyncd.service
  • 安装/卸载NTP
  • sudo hwclock -w

systemd[1]: Time has been changedCRON[3684]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)


答案1

在Windows 8.1 Hyper-V下运行的16.04服务器上,我遇到过/var/log/syslog中每五秒钟记录一次"systemd [...] Time has been changed"的问题。为了解决这个问题,我禁用了Hyper-V端的时间同步,消息立即停止了-不需要重新启动虚拟机。


答案2

在HyperV/Azure上,可以通过为syslog创建一个过滤器来禁用消息。

在/etc/rsyslog.d中创建一个新文件


vi /etc/rsyslog.d/15-excludetime.conf 



插入两行


:msg, contains,"Time has been changed" ~ 


:msg, contains,"apt-daily.timer: Adding" ~



重新启动rsyslog


systemctl restart rsyslog.service



或者你可以在VMBUS上禁用主机时间同步。


echo 2dd1ce17-079e-403c-b352-a1921ee207ee > /sys/bus/vmbus/drivers/hv_util/unbind




答案3

我在Microsoft Azure VM上遇到了同样的问题,将硬件时钟设置为系统时间,我这里可以工作。

 
hwclock -w