重新启动 RHEL8 Linux 服务器时时间会改变一小时

重新启动 RHEL8 Linux 服务器时时间会改变一小时

我有一台运行在 RHEL8 上的 Linux 服务器,使用 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 ([email protected]) (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 文件。因此,/etc/localtimeinitramfs 中的文件现在与实际根文件系统中的相应文件不同步。

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

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

相关内容