Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ guest/zig-cache/
guest/zig-out/
guest/.zig-cache/
guest/image/out/
image-out/
guest/image/.cache/
guest/fuzz/out/
guest/fuzz/out-native/
Expand Down
19 changes: 19 additions & 0 deletions guest/image/init
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ mount -t tmpfs tmpfs /run || log "[init] mount tmpfs failed"

export PATH=/usr/sbin:/usr/bin:/sbin:/bin

# Sync the system clock from the hardware RTC as early as possible.
#
# The host issues short-lived MITM TLS certificates whose notBefore is the
# host wall-clock time. If the guest system clock lags behind the host (which
# can happen depending on how the kernel initialises time on boot), freshly
# minted certificates are seen as "certificate is not yet valid" and every
# HTTPS request through the egress proxy (curl, apk, language runtimes, ...)
# fails. The QEMU-exposed RTC tracks host time, so seeding the system clock
# from it keeps the guest within the certificate validity window.
if command -v hwclock > /dev/null 2>&1; then
if hwclock --hctosys --utc > /dev/null 2>&1 || hwclock -s > /dev/null 2>&1; then
log "[init] synced system clock from RTC: $(date -u 2>/dev/null)"
else
log "[init] hwclock RTC sync failed"
fi
else
log "[init] hwclock not available; skipping RTC clock sync"
fi

mkdir -p /tmp /var/tmp /var/cache /var/log /root /home
mount -t tmpfs tmpfs /tmp || log "[init] mount tmpfs /tmp failed"
mount -t tmpfs tmpfs /root || log "[init] mount tmpfs /root failed"
Expand Down
1 change: 1 addition & 0 deletions images/alpine-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"ca-certificates",
"curl",
"e2fsprogs",
"e2fsprogs-extra",
"nodejs",
"npm",
"uv",
Expand Down