Ubuntu 22.04 LXC container clock jumps forward after host resume, cron misses jobs and ACME renewal fails
Environment
Proxmox host running Ubuntu 22.04 LTS with LXC containers (systemd inside), host suspends (S3) on a laptop and resumes; container OS is also Ubuntu 22.04 with systemd-timesyncd.
Symptoms
After host resume, container system clock advanced by several minutes to hours compared to host; scheduled cron jobs inside container didn't run at expected times; cert renewals using certbot failed due to time skew.
Observations
host time is correct; container /proc/driver/rtc shows different RTC offset. journalctl in container shows a sudden time jump at resume time. systemd-timesyncd attempts to step back but is configured not to step large offsets, leaving container clock drifted. Host uses RTC hardware driver that LXC doesn't forward by default.
Already attempted
Restarted systemd-timesyncd inside container (temporary resync), mbind host NTP settings to container namespaces, attempted to mount /etc/localtime from host into container — no persistent fix. Rebooting container fixes time until next host suspend/resume.
Question
How can I prevent LXC containers from jumping their clocks after the host suspends/resumes, ensuring cron and ACME renewals remain reliable without rebooting containers?
Verified community troubleshooting
Make containers use the host wall-clock and let timesync take small corrective steps after resume. Bind-mount the host RTC into the container (/dev/rtc) or allow the device in the container config, then set systemd-timesyncd to permit stepping on large offsets (or add a host resume hook that nsenter+restarts timesyncd inside containers). Verify by suspending/resuming host and checking container 'timedatectl' and cron execution. Changes are reversible: remove the device bind or restore previous timesyncd config if you need to revert.
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Linux45% match
systemd timer misses periodic jobs after resume — clock jumps forward on resume when host uses TSC as RTC
Solved1 answer - Virtualization34% match
Docker containers lose DNS resolution after laptop resume on Ubuntu 22.04 due to systemd-resolved stub resolver change
Open0 answers - Linux33% match
Ubuntu 22.04 laptop: Docker containers lose DNS resolution after suspend/resume (systemd-resolved stub resolver conflict)
Open0 answers - Linux33% match
Ubuntu 22.04 laptop: Docker containers lose DNS after suspend/resume due to systemd-resolved stub resolver race with NetworkManager
Open1 answer - Linux33% match
Docker containers lose DNS after host switched to systemd-resolved stub resolver on Ubuntu 22.04
Solved1 answer