MT#55949 Ensure we have proper date/time configuration

If the date of the running system isn't appropriate enough, then apt
runs might fail with somehint like:

| E: Release file for https://deb/sipwise/com/spce/mr10.5.2/dists/bullseye/InRelease is not valid yet (invalid for another 6h 19min 2s)

So let's try to sync date/time of the system via NTP. Given that chrony
is a small (only 650 kB disk space) and secure replacement for ntp,
let's ship chrony with the Grml deployment ISO (and fall back to ntp
usage in deployment script if chrony shouldn't be available).

Also, if the system is configured to read the RTC time in the local time
zone, this is known as another source of problems, so let's make sure to
use the RTC in UTC.

Change-Id: I747665d1cee3b6f835c62812157d0203bcfa96e2
mr11.2.1
Michael Prokop 2 years ago
parent 245c7ef702
commit 6412814e6b

@ -5,7 +5,7 @@ FROM docker.mgm.sipwise.com/sipwise-bookworm:latest
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
ENV REFRESHED_AT 2022-11-11
ENV REFRESHED_AT 2022-11-14
# tools for building and testing
RUN apt-get update && apt-get install --assume-yes --no-install-recommends \

@ -7,6 +7,7 @@ binutils
bridge-utils
bsdmainutils
buffer
chrony
coreutils
cpio
cpufrequtils

@ -725,6 +725,33 @@ display_partition_table() {
fi
}
enable_ntp() {
echo "Displaying original timedatectl status:"
timedatectl status
if systemctl cat chrony &>/dev/null ; then
echo "Ensuring chrony service is running"
systemctl start chrony
echo "Enabling NTP synchronization"
timedatectl set-ntp true || true
elif systemctl cat ntp &>/dev/null ; then
echo "Ensuring ntp service is running"
systemctl start ntp
echo "Enabling NTP synchronization"
timedatectl set-ntp true || true
else
echo "No ntp service identified, skipping NTP synchronization"
fi
echo "Disabling RTC for local time"
timedatectl set-local-rtc false
echo "Displaying new timedatectl status:"
timedatectl status
}
lvm_setup() {
local saved_options
saved_options="$(set +o)"
@ -1879,6 +1906,9 @@ fi
service ssh start >/dev/null &
echo "root:sipwise" | chpasswd
# date/time settings, so live system has proper date set
enable_ntp
## partition disk
set_deploy_status "disksetup"

Loading…
Cancel
Save