Skip to content

os/v3/puppy: read the hardware clock as UTC, so a boot does not run 4 h ahead until NTP (engine#3287) - #3308

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl-release/hwclock-utc
Nov 22, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl-release/hwclock-utc

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Part of #3287. Found while looking for the logs from the c35 installer's reboot freeze.

Cause. In rc.country, the quiet path runs /usr/sbin/set_hwclock_type -q --hctosys, which reads whether the RTC holds local time or UTC from /etc/clock. The base SFS ships HWCLOCKTIME=localtime, and the embed sets /etc/localtime -> America/Moncton, so the RTC, which holds UTC, was read as Atlantic time.

Measured on the AI MAX+ 395 (c35 installed, 22 Nov):

  • At 10:57 AST, hwclock -r printed 14:57 (the RTC read as local time) and hwclock -r -u printed 10:57 (read as UTC, which is right).
  • Every installed boot ran 4 h ahead until NTP corrected it. The /data/logs directories for the 14:12–14:25Z boots are named 20261122T1812..1825. Because 1bit-logs prune keeps the five newest names, those skewed names pushed out the real newer boot directories, including the ones from around the freeze.
  • sudo /usr/sbin/set_hwclock_type -q utc --hctosys on the box: rc=0, system clock unchanged (15:05:39), /etc/clock now HWCLOCKTIME='utc'.

Change. container-build.sh passes utc to both set_hwclock_type ... --hctosys calls in rc.country. The build is refused if the patched line is missing or if any call still leaves the clock type to /etc/clock. set_hwclock_type writes the type back to /etc/clock on every boot, so an installed system whose save layer still holds the old localtime copy is corrected too.

No new test script. The build's own REFUSED guards check the result, the same way as the existing rc.country edits in this file. Not yet run through a full image build or a boot of a new image; it is next to test on the next stick. scripts/pre-pr-checks.sh --base origin/main: 16 green, 4 skipped.

🤖 Generated with Claude Code

… h ahead until NTP (engine#3287)

rc.country's quiet path, `set_hwclock_type -q --hctosys`, takes the RTC's meaning from /etc/clock and the base
SFS ships HWCLOCKTIME=localtime; with /etc/localtime -> America/Moncton it read the UTC RTC as Atlantic time.
Measured on the AI MAX+ 395 (c35 installed): every boot 4 h ahead until NTP, /data/logs naming the 14:12-14:25Z
boots 18:12-18:25Z, and 1bit-logs' name-ordered prune evicting the real newer boot directories (the ones from
around the c35 installer's reboot freeze). container-build.sh now passes `utc` on both set_hwclock_type calls
and refuses the build if either still leaves the type to /etc/clock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3287 - Partially compliant

Compliant requirements:

  • Fix the hardware clock reading issue by ensuring RTC is interpreted as UTC
  • Modify rc.country to use 'utc' parameter in set_hwclock_type calls
  • Add build-time checks to verify the changes are applied
  • Ensure the fix corrects both base SFS and installed systems

Non-compliant requirements:

  • The PR does not include a full image build test run

Requires further human verification:

  • The fix needs to be validated on actual hardware (AI MAX+ 395) to confirm the 4-hour offset issue is resolved
  • The build-time checks need to be confirmed to properly detect the changes
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Potential build-time check failure

The build-time checks added to verify the set_hwclock_type changes may not be robust enough. Specifically, the check on line 208 looks for any occurrence of "set_hwclock_type [a-z-]* *--hctosys" which could potentially match unintended patterns or fail to catch cases where the command is modified in a way that still leaves the clock type unspecified. This could lead to a false negative where the build passes despite not actually fixing the issue.

! grep -q "set_hwclock_type [a-z-]* *--hctosys" "$skeleton/etc/rc.d/rc.country" || {
    echo "build: REFUSED: an rc.country set_hwclock_type call still leaves the clock type to /etc/clock" >&2; exit 1; }

@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) November 22, 2026 15:15
@bong-water-water-bong
bong-water-water-bong merged commit 04fe858 into main Nov 22, 2026
11 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the cl-release/hwclock-utc branch November 22, 2026 15:26
bong-water-water-bong added a commit that referenced this pull request Nov 22, 2026
…follow-up, engine#3287) (#3329)

#3308 fixed rc.country in container-build.sh (the woof path). rc.country is a base file, not an embed/ one, so a
cut patched from a released base (BASE=) still shipped the base's set_hwclock_type --hctosys under
HWCLOCKTIME=localtime: every boot 4 h ahead on an RTC that holds UTC, and 1bit-logs pruned the real boots.
BASE mode now takes the base's rc.country, applies the same two seds and REFUSED guard, and patches it in.

Co-authored-by: bong-water-water-bong <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant