0

I asked the same question on SOF but be told this is the more appropriate place. There's a very weird problem about system time on one of my Linux machines, the system time is kept being changed to 40 seconds ahead of my local time automatically by something. No matter what time I reset, it'll be changed a couple seconds later, as you can see from the following output:

[root@node ~]# date; date -s "2018-01-23 14:06:40";sleep 5;date
Tue Jan 23 14:07:21 CST 2018
Tue Jan 23 14:06:40 CST 2018
Tue Jan 23 14:07:26 CST 2018

The ntpd service is stopped, and there's no cronjob running to change the system time. I tried to add audit rules to trace the event of time change, but there's nothing recorded, audit rules appended to /etc/audit/audit.rules:

-a always,exit -F arch=b64 -S clock_adjtime -S adjtimex  -S time -S timer_settime -S settimeofday -S clock_settime -k time_change
-w /etc/localtime -p rxwa -k access_localtime
-w /etc/adjtime -p rxwa -k access_adjtime

After service auditd restart, I can see time change logs from /var/log/audit/audit.log by either ntpdate time.windows.com:

[root@node ~]# ntpdate time.windows.com
23 Jan 13:08:24 ntpdate[14584]: step time server 52.178.161.41 offset -61.612892 sec

Logs of the above command:

type=SYSCALL msg=audit(1516684164.838:3093): arch=c000003e syscall=223 success=yes exit=0 a0=0 a1=0 a2=7fff507e2600 a3=0 items=0 ppid=14397 pid=14584 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=47 comm="ntpdate" exe="/usr/sbin/ntpdate" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="time_change"
type=SYSCALL msg=audit(1516684166.521:3094): arch=c000003e syscall=227 success=yes exit=0 a0=0 a1=7fff507e2110 a2=0 a3=0 items=0 ppid=14397 pid=14584 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=47 comm="ntpdate" exe="/usr/sbin/ntpdate" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="time_change"

or by date -s <date-time>:

[root@node ~]# date -s "2018-01-23 13:12:30"
Tue Jan 23 13:12:30 CST 2018

Logs of the above command:

type=SYSCALL msg=audit(1516684402.125:3110): arch=c000003e syscall=227 success=yes exit=0 a0=0 a1=7fff55d0ced0 a2=0 a3=112e0be826d694b3 items=0 ppid=14397 pid=14626 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=47 comm="date" exe="/bin/date" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="time_change"

But the time will be changed again very soon without any useful audit logs. BTW, this is a virtual machine managed by Hyper-V on a blade server, but there's no such problem on the other VMs on the same blade server.

OS environment info:

[root@node ~]# uname -a
Linux node 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@node ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)

Could anyone give me any clues about why this is happening? Thanks a lot :-)

3
  • It looks like 50-something minutes rather than 40 seconds. Is your hardware clock set to use UTC (it should be)? Is systemd doing timekeeping nowadays? Commented Jan 23, 2018 at 5:59
  • @Kusalananda, sorry I posted a bad example,the time "2018-01-23 11:00:00" is picked up randomly, the actually time was supposed to be around "Tue Jan 23 11:55:36 CST 2018". I wanted to demo that the time will be changed automatically by something. Commented Jan 23, 2018 at 6:03
  • @Kusalananda, the hardware clock is set to UTC now, but the system time still has the same problem. The OS is a very old release so systemd is not used. Commented Jan 23, 2018 at 6:37

1 Answer 1

1

Hyper-V includes a time synchronization service that works between the hypervisor and the VM's kernel - no user-space processes involved, so no audit logs.

If the OS is a very old release as you said, this time sync service might have some old bugs. You might want to ask the Hyper-V host administrator to disable the time synchronization for your VM.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.