双系统问题整理

win11 + ubuntu 时间不同步问题

方法一:使用 timedatectl 命令(不推荐)

1
2
3
4
5
6
7
8
# 安装ntpdate,这个工具可以同步系统时间到指定的NTP服务器时间
sudo apt install ntpdate
# 在ubuntu24中安装hwclock
sudo apt install util-linux-extra
# 同步时间
sudo ntpdate time.windows.com
# 转换并写入硬件时钟的命令
sudo hwclock --localtime --systohc

方法二:修改注册表(推荐)

  1. 在 Windows 中修改注册表:

    • Win + R,输入 regedit 打开注册表编辑器。

    • 导航到:

      1
      HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
    • 右键新建一个 DWORD (32-bit) Value,命名为 RealTimeIsUniversal,值设为 1

    • 重启 Windows。

  2. 在 Ubuntu 中确认使用 UTC:

    1
    timedatectl | grep "RTC in local TZ"

    如果显示 yes,改为 UTC:

    1
    sudo timedatectl set-local-rtc 0