目前共有8篇帖子。 字體大小:較小 - 100% (默認)▼  內容轉換:不轉換▼
 
點擊 回復
35 7
【解决方案】Fedora43有个奇怪的bug:只要笔记本合盖休眠,打开电脑之后系统必定出现8个小时时差。
一派掌門 二十級
1樓 發表于:2026-1-7 15:55
https://weibo.com/1649763572/PpvgGsC19
Incorrect system time after suspending
Apr 2023
when i start my system (hp spectre x360) after suspension. the system time is usually incorrect. i’ve recently reinstalled my system, after this reinstall it started showing this behaviour which it didnt before.
If i run sudo hwclock -s the time gets corrected until i suspend again. if automatic time sync and automatic timezone are on this behaviour still occurs.
edit: i’m not 100% certain this only happens after a system suspends or if it always happens. but but after a start after suspension is usually when i notice it
https://discussion.fedoraproject.org/t/incorrect-system-time-after-suspending/81056

执行sudo hwclock -s命令也可以模拟笔记本合上盖子再打开的过程,可立即复现该bug。
sudo hwclock -s命令用于将硬件时钟RTC的时间同步到系统时钟,即读取主板上的硬件时钟时间并设置为操作系统的时间。该命令等价于sudo hwclock --hctosys。
oct1158@fedora:~/Documents$ timedatectl
               Local time: Wed 2026-01-07 14:47:19 CST
           Universal time: Wed 2026-01-07 06:47:19 UTC
                 RTC time: Wed 2026-01-07 14:47:19
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no
oct1158@fedora:~/Documents$ sudo hwclock -s
oct1158@fedora:~/Documents$ timedatectl
               Local time: Wed 2026-01-07 22:47:26 CST
           Universal time: Wed 2026-01-07 14:47:26 UTC
                 RTC time: Wed 2026-01-07 14:47:26
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: no
oct1158@fedora:~/Documents$ sudo hwclock -r
2026-01-07 22:49:16.122097+08:00
oct1158@fedora:~/Documents$
一派掌門 二十級
2樓 發表于:2026-1-7 15:56
【问题原因】
这是因为fedora43系统自动获取网络时间的功能有bug。
自动获取网络时间后,能正确设置系统时间,却不能正确设置bios硬件时间(RTC)。
date命令显示的系统时间是正确的(UTC+8),而sudo hwclock -r命令显示的bios时间是错误的(UTC+16)。
 
巨大八爪鱼:合上笔记本盖子前,系统时间是正确的,bios硬件时间是错误的。
合上笔记本盖子后再打开,fedora会自动将bios硬件时间读回系统,所以系统时间就出错了。
  2026-1-7 16:31 回復
一派掌門 二十級
3樓 發表于:2026-1-7 15:57
【解决办法】
(1)首先,bios硬件时间的时区一定要设置成UTC时区,不能设置成UTC+8时区。
如果bios硬件时间没有设置成标准的UTC时区的话,执行timedatectl命令会看到醒目的黄色警告。
oct1158@fedora:~/Documents$ timedatectl
               Local time: Tue 2026-01-06 16:11:03 CST
           Universal time: Tue 2026-01-06 08:11:03 UTC
                 RTC time: Tue 2026-01-06 16:11:03
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: yes
 
Warning: The system is configured to read the RTC time in the local time zone.
         This mode cannot be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
        
此时需要执行sudo timedatectl set-local-rtc 0命令,将bios硬件时间的时区设置成UTC时区。
oct1158@fedora:~/Documents$ sudo timedatectl set-local-rtc 0
[sudo] password for oct1158:
这样再次执行timedatectl命令,黄色警告就消失了。
oct1158@fedora:~/Documents$ timedatectl
               Local time: Tue 2026-01-06 16:11:49 CST
           Universal time: Tue 2026-01-06 08:11:49 UTC
                 RTC time: Tue 2026-01-06 08:11:49
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

oct1158@fedora:~/Documents$

 
一派掌門 二十級
4樓 發表于:2026-1-7 15:58
(2)开启一下fedora系统的自动获取网络时间和时区的功能,等待系统时间(date)变成正确的UTC+8时间,系统时区变成正确的UTC+8时区。与此同时bios硬件时间(sudo hwclock -r)会变成错误的时间。
oct1158@fedora:~/Documents$ date
Wed  7 Jan 14:58:09 CST 2026
oct1158@fedora:~/Documents$ sudo hwclock -r
2026-01-07 22:58:11.948348+08:00
oct1158@fedora:~/Documents$

此时,立即关闭fedora系统的自动获取网络时间和时区的功能,以后不要再开了。

 
一派掌門 二十級
5樓 發表于:2026-1-7 15:59
(3)将系统时间写入bios硬件时间,使bios硬件时间变成正确的时间。
oct1158@fedora:~/Documents$ sudo hwclock -r
2026-01-07 23:00:39.841509+08:00
oct1158@fedora:~/Documents$ sudo hwclock --systohc
oct1158@fedora:~/Documents$ sudo hwclock -r
2026-01-07 15:00:45.725250+08:00
oct1158@fedora:~/Documents$
这样一来,问题就解决了。
 
巨大八爪鱼:现在再执行sudo hwclock -s命令从硬件时间设置系统时间,就不再出问题了。
  2026-1-7 15:59 回復
一派掌門 二十級
6樓 發表于:2026-1-8 20:03
 

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
(快捷鍵:Ctrl+Enter)
 

本帖信息

點擊數:35 回複數:7
評論數: ?
作者:巨大八爪鱼
最後回復:巨大八爪鱼
最後回復時間:2026-1-8 20:03
 
©2010-2026 Purasbar Ver2.0
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。