每5秒/ var / log / syslog'systemd [1]:时间已更改'消息


15

我有个问题。有类似的消息

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时间也不正确。

有关我的系统的一些信息

  • 在VDS上运行的Ubuntu 16.04、4.4.0-64-通用,x86_64

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

我没有安装sclockadj。我也问我的VDS提供者是否阻止了任何NTP请求。不,他们没有。

更新1
我完全相同地设置了另一个VDS#2。systemd[1]: Time has been changed出现此消息几分钟后,问题消息CRON[3684]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)已经消失了。但是,我已尝试升级VDS#2,并且在重启后立即更改了该时间。

找到了这个线程,也许它可以提供更多的信息。看起来这是一个内核问题。

试图降级内核,systemd,udev,但此操作无济于事。从我的一些答复中可以看出,这不仅是我的托管者和虚拟化的问题。

Answers:


21

我在Windows 8.1 Hyper-V下运行的16.04服务器上systemd[...]Time has been changed 每五秒钟记录一次此 消息/var/log/syslog。为了解决这个问题,我在Hyper-V端禁用了时间同步。

在Hyper-V管理器中,我突出显示了VM,选择“设置”,然后 选择 Integration Services”,未选中“ 时间同步”,然后单击“ 应用”

消息立即停止-无需重新启动VM。


我要求提供者禁用时间同步,这解决了我的问题。谢谢你的帮助!
罗素FP

2
我在Azure上的VM遇到此问题。虽然如果它以Hyper-V(或它的某种变体)为核心运行,我不会感到惊讶,但我认为这不是我的选择:-/
Adam Plocher

如此简单的修复。非常感谢您!
PatricF

8

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

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

    vi /etc/rsyslog.d/15-excludetime.conf 
    
  2. 插入两行

    :msg, contains, "Time has been changed" ~ 
    :msg, contains, "apt-daily.timer: Adding" ~
    
  3. 重新启动rsyslog

    systemctl restart rsyslog.service
    

或者,您可以在VMBUS上禁用主机时间同步。我将该行放在/etc/rc.local下

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

0

我在Microsoft Azure VM上遇到了相同的问题。将硬件时钟设置为系统时间对我来说很成功。

hwclock -w
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.