RHEL 6.3
我们昨晚刚刚重启,我发现很多进程显示它们一直在运行。例如:
root 11 2 99 Feb23 ? 212429-04:31:07 [kworker/0:1]
root 1 0 99 Feb23 ? 216-01:38:15 /sbin/init
NTP 看起来很正常:
Feb 23 18:13:58 hostA ntpd[7539]: ntpd [email protected] Tue Jul 6 21:50:26 UTC 2010 (1)
Feb 23 18:13:58 hostA ntpd[7540]: precision = 0.126 usec
Feb 23 18:13:58 hostA ntpd[7540]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Feb 23 18:13:58 hostA ntpd[7540]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
Feb 23 18:13:58 hostA ntpd[7540]: Listening on interface #1 lo, 127.0.0.1#123 Enabled
Feb 23 18:13:58 hostA ntpd[7540]: Listening on interface #2 em1, 192.168.1.9#123 Enabled
Feb 23 18:13:58 hostA ntpd[7540]: Listening on interface #3 em2, <ip.addr.scrubbed>#123 Enabled
Feb 23 18:13:58 hostA ntpd[7540]: Listening on routing socket on fd #20 for interface updates
Feb 23 18:13:58 hostA ntpd[7540]: kernel time sync status 2040
Feb 23 18:13:58 hostA ntpd[7540]: getaddrinfo: "::1" invalid host address, ignored
Feb 23 18:13:58 hostA ntpd[7540]: frequency initialized 27.053 PPM from /var/lib/ntp/drift
Feb 23 18:17:08 hostA ntpd[7540]: synchronized to LOCAL(0), stratum 10
Feb 23 18:17:08 hostA ntpd[7540]: kernel time sync status change 2001
Feb 23 18:17:18 hostA ntpd[7540]: synchronized to <ip.addr.scrubbed>, stratum 1
Feb 23 18:22:43 hostA ntpd[7540]: synchronized to <ip.addr.scrubbed>, stratum 1
Feb 23 18:25:57 hostA ntpd[7540]: synchronized to <ip.addr.scrubbed> stratum 1
Feb 23 18:32:21 hostA ntpd[7540]: time reset -0.192626 s
proc 中的 PID 文件看起来有合理的时间戳(全部来自今天或昨天)。
ps/htop 从哪里获取时间字段?
有人碰到过这种情况吗?
答案1
它没有同样的问题,但在我的例子中,如果 /proc/stat 的大小从 64KB 增加,它就会开始显示奇怪的 STIME 输出。原因是它在代码中被硬编码了
procps-3.2.8/ps/global.c
359 void reset_global(void){
360 static proc_t p;
361 reset_selection_list();
362 look_up_our_self(&p);
363 set_screen_size();
364 set_personality();
365 int fd;
366 char *buf[BUFFSIZE];
367 const char *b;
368
369 /* get boot time from /proc/stat */
370 fd = open("/proc/stat", O_RDONLY, 0);
371 if (fd != -1) {
372 buf[BUFFSIZE-1] = 0;
373 read(fd, buf, BUFFSIZE-1);
374 b = strstr(buf, "btime ");
375 if (b) {
376 sscanf(b, "btime %lu", &time_of_boot);
RedHat 已经存在与此问题相关的内部错误https://bugzilla.redhat.com/show_bug.cgi?id=867906
答案2
检查服务器的 BIOS 和硬件时钟。
如果这是物理服务器,请确保在 BIOS 中正确设置时间,或者将 NTP 获取的时间同步到硬件时钟。
这是虚拟机吗?请检查主机/虚拟机管理程序的时间状态。