重新启动RHEL8 Linux服务器时,时间少了一小时

分享于 

4分钟阅读

互联网

  繁體

问题:

我有一个Linux服务器在RHEL8上运行,chrony用于时间同步,在重新启动服务器时,在消息文件中,我看到以下时间差异:


Dec 22 10:09:53 prodserver1 systemd[1]: Shutting down.


Dec 22 10:09:53 prodserver1 kernel: printk: systemd-shutdow: 59 output lines suppressed due to ratelimiting


Dec 22 10:09:53 prodserver1 systemd-shutdown[1]: Syncing filesystems and block devices.


Dec 22 **10:09:53** prodserver1 systemd-shutdown[1]: Sending SIGTERM to remaining processes...


Dec 22 **10:09:53** prodserver1 systemd-journald[7001]: Journal stopped


Dec 22 **11:10:04** prodserver1 kernel: Linux version 4.18.0-240.1.1.el8_3.x86_64 (mockbuild@x86-vm-09.build.eng.bos.redhat.com) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Fri Oct 16 13:36:46 EDT 2020


Dec 22 **11:10:04** prodserver1 kernel: Command line: BOOT_IMAGE=(hd0,gpt2)/vmlinuz-4.18.0-240.1.1.el8_3.x86_64 root=/dev/mapper/systemvg-rootlv ro crashkernel=auto resume=/dev/mapper/systemvg-swaplv rd.lvm.lv=systemvg/rootlv rd.lvm.lv=systemvg/swaplv rd.lvm.lv=systemvg/usrlv net.ifnames=0 rhgb quiet ipv6.disable=1 audit=1 audit_backlog_limit=128


Dec 22 11:10:04 prodserver1 kernel: Disabled fast string operations


Dec 22 11:10:04 prodserver1 kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'


Dec 22 11:10:04 prodserver1 kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'


Dec 22 11:10:04 prodserver1 kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'



一旦服务器启动,时间再次被纠正。


Dec 22 11:10:08 prodserver1 systemd[1]: Started Setup Virtual Console.


Dec 22 11:10:08 prodserver1 systemd[1]: Reached target Switch Root.


Dec 22 11:10:08 prodserver1 systemd[1]: Starting Switch Root...


Dec 22 11:10:08 prodserver1 systemd[1]: Switching root.


Dec 22 11:10:08 prodserver1 systemd-journald[290]: Journal stopped


Dec 22 10:10:10 prodserver1 systemd-journald[290]: Received SIGTERM from PID 1 (systemd).


Dec 22 10:10:10 prodserver1 kernel: printk: systemd: 23 output lines suppressed due to ratelimiting


Dec 22 10:10:10 prodserver1 kernel: SELinux: policy capability network_peer_controls=1


Dec 22 10:10:10 prodserver1 kernel: SELinux: policy capability open_perms=1


Dec 22 10:10:10 prodserver1 kernel: SELinux: policy capability extended_socket_class=1


Dec 22 10:10:10 prodserver1 kernel: SELinux: policy capability always_check_network=0




答案1:

当系统运行在initramfs上时出现了错误的时间。

你可能最近更改了系统时区,但之后没有刷新initramfs文件,

要为当前内核重建initramfs,请运行:


cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak


dracut -f /boot/initramfs-$(uname -r).img $(uname -r)





Server  时间  HOUR  RHEL