Skip to content

omamobile-firstboot 0.1.3: seed an offline clock before key setup - #97

Merged
derekross merged 3 commits into
derekross:mainfrom
h4rkl:firstboot-clock-floor
Nov 1, 2026
Merged

derekross merged 3 commits into
derekross:mainfrom
h4rkl:firstboot-clock-floor

Conversation

@h4rkl

@h4rkl h4rkl commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Phones without a working RTC can start before their package signing keys were created, causing offline key setup to fail. Seed the clock to the newest installed public-keyring timestamp before pacman-key runs, while leaving a newer clock unchanged. This shared policy belongs in omamobile-firstboot, separately from tegu support in #74.

Bump omamobile-firstboot to 0.1.3-2 and declare diffutils for package checks. Tests cover an old clock, an accurate clock, absent keyrings, and ordering before key setup.

Validation: native aarch64 makepkg with checks enabled on tegu; installed-package integrity checks; the installed keyring setup advanced the phone clock and successfully ran real pacman-key initialization and population in an isolated test keyring. This has not yet been tested through a clean full-device first boot. PR policy checks passed.

h4rkl and others added 2 commits October 28, 2026 10:36
Phones without an RTC can start before the installed signing keys were created. Use the newest public keyring timestamp in the verified root image as a clock floor before GnuPG creates or imports keys, without moving an accurate clock backwards.

The Linux firstboot tests cover an old clock, an accurate clock, absent keyrings, and ordering before pacman-key. Move this shared policy out of the tegu package.

Co-Authored-By: Codex <codex@openai.com>
The package check uses cmp, which is absent from the minimal phone root. Declare diffutils as a check dependency so makepkg can run the full tests in a fresh build environment.

Built with checks enabled on aarch64 tegu, installed 0.1.3-2, and ran the installed keyring setup against an isolated keyring root. Clock seeding and real pacman-key initialization and population passed.

Co-Authored-By: Codex <codex@openai.com>
@derekross

Copy link
Copy Markdown
Owner

Thanks for splitting this out of the 9a package. It's what I hoped for: a small change in the shared first-boot step, with tests for an old clock, an accurate one, no keyrings and the order before pacman-key. I ran the package test here and it passes, and its second-run check fails if the clock is ever moved backwards. Seeding the clock in the first step also means the user and password steps after it see the corrected date. (CI needs my approval for a first pull request; I'll approve the run.)

Two things before it can merge, both about numbers:

  1. The version. flame 0.1.0: hooks for shell 0.2.24 and firstboot 0.1.3 #55 (flame) and device-alioth: add experimental POCO F3 source build and guarded installer #25 (alioth) also set omamobile-firstboot to 0.1.3. Earlier I gave 0.1.3 to flame 0.1.0: hooks for shell 0.2.24 and firstboot 0.1.3 #55 and 0.1.4 to device-alioth: add experimental POCO F3 source build and guarded installer #25. Because the three version edits are identical, git merges them without a conflict, and two different packages would ship as 0.1.3. Please take 0.1.5, or leave it to me: I'll set the next free number when I merge, whichever PR lands first.
  2. pkgrel. A new version starts at pkgrel=1. The -2 was your local rebuild, so please put it back to 1.

Smaller things:

  • The comment and the commit message call it "the verified root image". Nothing verifies our root image (there's no dm-verity), so "the root image" would be accurate.
  • The pull request template's smoke report is missing, and the body says no clean first boot has run yet. Your isolated pacman-key run on the 9a covers the mechanism well. When your next clean install runs, please add the first boot's omamobile-firstboot lines here (the clock moving forward, then the keyring populated). If this merges first, they can go in a comment.
  • test/all will conflict with flame 0.1.0: hooks for shell 0.2.24 and firstboot 0.1.3 #55's new firewall block. The two blocks are independent, so whoever lands second keeps both.

Thanks again: this fixes a first boot that could fail on any phone whose clock starts in the past.

@derekross

Copy link
Copy Markdown
Owner

Following up on my 10-28 note: if you're busy, I'm happy to finish this myself, since maintainer edits are on. I'd set pkgrel back to 1, change "verified root image" to "root image", and keep 0.1.3 as long as it lands first. If you'd rather do it, or want something different, just say so here in the next day or so; otherwise I'll push those edits and merge it. The same offer goes for #75 (the tests/all conflict and the three RELEASES.md lines).

A new version starts at pkgrel=1; the -2 was a local rebuild. Nothing
verifies the root image (there is no dm-verity), so the comment no longer
calls it verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@h4rkl

h4rkl commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, done in 496f2e8: pkgrel is back to 1, and the comment now says "the root image". I left the version at 0.1.3 on your note that it's fine if this lands first; please renumber when you merge if #55 or #25 gets there first. The package test passes in an Arch container. The first-boot omamobile-firstboot lines will follow in a comment after my next clean install.

@derekross
derekross merged commit 881fe35 into derekross:main Nov 1, 2026
2 checks passed
@derekross

Copy link
Copy Markdown
Owner

Thanks, h4rkl: 496f2e8 does exactly what I asked. I rechecked it against today's main (it merged cleanly, 0.1.3 was still free, both CI jobs green) and checked the floor itself: omamobile.gpg is written after the key it holds, and neither pacman nor our root image build resets mtimes, so the floor is always at least the key's creation date. That's what #188 and #190 need. Merged, with a squash body I wrote from the final change, and I'm closing both issues with it. When your next clean install runs, please post the first boot's omamobile-firstboot lines here (the clock moving forward, then the keyring populated). Thanks for fixing this for every phone without an RTC.

robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…rekross#97)

A phone without a working RTC can start its first boot with a clock older
than the project's signing keys, and gpg then skips them at
pacman-key --populate ("created N days in the future"). Before key setup,
take the newest mtime of the installed keyrings in
/usr/share/pacman/keyrings as a floor and move the clock up to it; never
move a clock that is already later, and do nothing without a keyring.
The step runs first, so later steps see the corrected date too.

Tests cover an old clock, an accurate one, no keyrings, and the order
before pacman-key. diffutils is a check dependency for cmp.

Fixes derekross#188, fixes derekross#190.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants