Ubuntu虛擬機時間同步問題主要有以下原因及解決方法:
VBoxManage setextradata "VM名稱" "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "0"
啟用時間同步。sudo timedatectl set-timezone <時區>
(如Asia/Shanghai
)設置正確時區。sudo apt-get install ntp/chrony
。/etc/ntp.conf
或/etc/chrony/chrony.conf
),添加可靠NTP服務器(如pool.ntp.org
)。sudo systemctl start ntp/chrony && sudo systemctl enable ntp/chrony
。sudo hwclock --systohc
同步硬件時鐘。date
查看當前時間是否正確。ntpq -p
(NTP)或chronyc sources -v
(Chrony)檢查時間同步狀態。