Score:0

Can't put correct date & time on LXC container with ubuntu

pk flag

I'm tryig to put correct date and time, on Proxmox LXC container with ubuntu but I can't. There are some info of my server.

➜  ~ 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 and time is not weel:

➜  / 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.

When I tried to update package repositori i have this error:

 / 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.

Can anyone help me please?

Thanks,

in flag
Is the date correct on the host?
xabikip avatar
pk flag
No, on the host a have the same issue. I'm trying to solve host date but i can't. You know how can i put weel date? thnks
in flag
set the date on the host and it will be correct in the container as well. Read the manual of the `date` command and configure an NTP server.
Paul Gear avatar
cn flag
As it stands, this question is not clear enough; by "weel" do you mean "correct"? Please edit the question to clarify.
Paul Gear avatar
cn flag
Containers are (usually) unable to adjust the hardware clock of the host; you need to make any date changes from the host.
xabikip avatar
pk flag
Thanks at all. I change host date seting a date like this `date --set="yyyymmdd hh:mm"`, and solve it.
Score:0
pk flag

SOLVED

The problem was that the date and time of host don't was correct. I change host date seting a date like this date --set="yyyymmdd hh:mm", and solve it, because the the container take date from the host.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.