Ubuntu

無法使用 ubuntu 在 LXC 容器上放置正確的日期和時間

  • January 19, 2022

我正在嘗試將正確的日期和時間放在帶有 ubuntu 的 Proxmox LXC 容器上,但我不能。我的伺服器有一些資訊。

➜  ~ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

日期和時間不是周:

➜  / date
Fri Apr 19 09:15:17 CEST 2019

➜  / timedatectl status
              Local time: Fri 2019-04-19 09:15:27 CEST
          Universal time: Fri 2019-04-19 07:15:27 UTC
                RTC time: n/a
               Time zone: Europe/Madrid (CEST, +0200)
System clock synchronized: no
             NTP service: n/a
         RTC in local TZ: no

➜  / sudo hwclock --hctosys --verbose
hwclock from util-linux 2.34
System Time: 1555659408.378273
Trying to open: /dev/rtc0
Trying to open: /dev/rtc
Trying to open: /dev/misc/rtc
No usable clock interface found.
hwclock: Cannot access the Hardware Clock via any known method.

當我嘗試更新軟體包儲存庫時,出現此錯誤:

/ apt update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Reading package lists... Done
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal/InRelease is not valid yet (invalid for another 370d 10h 17min 57s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease is not valid yet (invalid for another 998d 2h 18min 54s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-security/InRelease is not valid yet (invalid for another 998d 2h 18min 20s). Updates for this repository will not be applied.

任何人都可以幫助我嗎?

謝謝,

解決了

問題是主機的日期和時間不正確。我更改主機日期設置這樣的日期date --set="yyyymmdd hh:mm"並解決它,因為容器從主機獲取日期。

引用自:https://serverfault.com/questions/1090243