Repository navigation
feat(daemon): ship the update timer and service in the package - #459
Conversation
…sfers together, add the operation lock Phase 1 of plan 0001 (ADR-0016).
Phase 2 of plan 0001 (ADR-0016).
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
frostyard-machines
left a comment
There was a problem hiding this comment.
Murbella (snosi owner): host and image review, comment only. Checked against ADR-0016, Brian's decisions (every image, 6 h, AC only) and my #457 review. I do not approve.
Verdict: no blocking finding. Units match ADR-0016: OnCalendar=*-*-* 00/6:00:00, RandomizedDelaySec=3600s, Persistent=true, WantedBy=timers.target, ConditionACPower=true, network-online Wants=/After=, --no-refresh, ADR-0007 sandbox. No maintainer script enables anything, so snosi's preset (Phase 7) is the only enablement. daemon disable never deletes packaged units and hints systemctl mask updex-update.timer, which is the durable opt-out on snosi. systemd-analyze verify in CI and the dpkg-deb -c check are the right gates for my Phase 7 build check.
Sandbox, from the host side: ProtectSystem=full keeps /run (lock), /var/lib/extensions* and /var/lib/updex (rollback records, #461) writable. /usr/.systemd-sysext stays readable. Good.
Non-blocking:
- Offline laptop gives a failed unit. Without network,
network-online.targetcan still be reached, the downloads fail and the service exits non-zero. On a laptop that is often offline,systemctl is-system-runningreportsdegradedseveral times a day. That matches the ADR ("exits non-zero when any enabled feature failed"), but consider treating "no route / DNS failure for every source" as a skip with a log line. At least say it in the docs. - No
TimeoutStartSec=backstop. Per-request timeouts (30 s manifest, 10 min download) and ADR-0008 retries bound one run, but nothing bounds the unit. A stuck run holds/run/updex/lock, and every manualupdex features …getsErrBusyuntil a reboot. A generousTimeoutStartSec=(for example 2 h) costs nothing. - Background priority. A 1 GB incus image is downloaded, hashed and decompressed at normal priority on desktops. Consider
Nice=10andIOSchedulingClass=idle(both allowed under the current sandbox). - 10 min download timeout on slow links. A compressed incus image on a slow link can exceed 10 min, fail, and start again from zero every 6 h (no resume, ADR-0008). This is older than this PR, but the timer makes it repeat silently. Track it as an issue.
- Merge order. After #458 merges, the rebase must add the operation lock to
EnableDaemonandDisableDaemon, includingenablePackagedDaemon.
Needs a real host or VM (plan "Done when"): the nightly dev .deb installs both units, disabled. On snosi I cannot dpkg -i into /usr; the image build after Phase 6 is the real check, plus systemctl is-enabled updex-update.timer = disabled on an image without the preset. The systemctl show value formats for daemon status also need a host. Host test plan: see my comment on #462.
…able/disable and add TimeoutStartSec=2h Review follow-up (Murbella): EnableDaemon and DisableDaemon hold the operation lock on the packaged-units paths too; the service gets a TimeoutStartSec=2h backstop; the docs say an offline run fails the unit.
|
Concern: daemon status can report a schedule that systemd does not use. In I reproduced the reset case against commit Please obtain the effective timer configuration from systemd, or account for drop-in precedence and reset semantics. Add regression coverage for an overridden packaged timer and an empty assignment that clears earlier schedules. Separately, this head includes #458 and therefore still inherits the rollback defect reported there. |
…re failures Review follow-up (bsherman, blocking): a regular file at the link path is hard-linked to a backup before any link moves and renamed back when a later transfer fails; other non-symlink entries are refused up front; restore failures are joined into the returned error.
Review follow-up (bsherman): read OnCalendar from systemd (TimersCalendar), else from the timer file and its drop-ins with reset semantics.
… into feat/packaged-update-units # Conflicts: # .coverage-baseline
|
Fixed in 494ca07 (Lucilla). #458's fix is merged in 387f94e.
|
Review follow-up (bsherman): when the transfer whose link failed cannot be restored, its result and the returned error carry the restore failure and say that the link may point at the new version.
… into feat/packaged-update-units
…units # Conflicts: # .coverage-baseline # updex/daemon.go
Summary
Now stacked on #458 (after review). #458 is merged into this branch with commit
00a5ae1, soEnableDaemonandDisableDaemontake the operation lock on every path, including the packaged-units path. Merge #458 first. Review9cf4dddand the resolution in00a5ae1.Phase 2 of plan 0001, which implements ADR-0016, section "Units" and the
daemon statuspart of "Status and logs".Review follow-ups (Murbella) in
00a5ae1: the lock indaemon enableanddaemon disable(testTestPackagedDaemonTakesTheLock);TimeoutStartSec=2hon the service (pinned by the contract tests); the docs say that an offline run fails the unit.updex.DaemonUnits()returns the timer and service configuration.updex daemon enableand the release generator both use it.ExecStart=/usr/bin/updex features update --no-refresh,Wants=andAfter=network-online.target, andConditionACPower=true.OnCalendar=*-*-* 00/6:00:00,RandomizedDelaySec=3600s,Persistent=true,WantedBy=timers.target.systemd.ServiceConfiggainsWants,After,ConditionsandComment. Output is unchanged for callers that do not set them.updex units --output-dir DIRcommand andscripts/units.shwrite both files. The script is a GoReleaser before-hook.nfpms.contentsinstalls the files under/usr/lib/systemd/system/with mode 0644. The package does not enable them: there is no maintainer script.systemctl enableand thenstartand writes nothing./etc/systemd/system/with an ownership marker (# Generated by updex daemon enable; …).systemctl disableandstopon the timer./etcunits that carry the marker, or whose content exactly matches one of the 3 legacy ADR-0007 unit texts that earlier updex releases wrote.KeptFiles, and refuses a symlink or a directory.systemctl mask updex-update.timer./etc), the unit files, the schedule (read from the file in use), and the next run (NextElapseUSecRealtime).ExecMainExitTimestamp, andResultonly after the service ran.Systemd unitsjob builds updex, generates the units with the release script, installs the binary to/usr/bin/updex, and runssystemd-analyze verify. The job fails on a non-zero exit or on any output line that namesupdex-update.snapshot.ymlchecks the nightly amd64.debwithscripts/check-deb-units.sh(dpkg-deb -c).Checks
make fmtmake ci:==> CI gate passedlocally. Coverage is 87.4%, and.coverage-baselineis bumped from 86.9.updex/units_hook_contract_test.go: runsscripts/units.shand compares the output byte for byte with the generator. It pins--no-refresh, the schedule,ConditionACPower, the network-online lines and everySandboxDirectivesline. It also pins the GoReleaser hook, bothnfpmsdestinations, no maintainer scripts, the CI job steps, and the deb-check script (7 cases with a fakedpkg-deb).updex/daemon_units_test.go: enable with packaged units writes nothing; enable without them writes the marker; 24 disable ownership cases (marked, foreign, legacy, edited legacy, packaged), real and dry run; refusal of a symlink and a directory; a status table (ran, failed, never ran,n/a).cmd/updex: handler tests for the new behaviour, and the hiddenunitscommand.Risk classification
Rationale:
systemd/**,.goreleaser.yamland.github/workflows/**.daemon disabledeletes root-owned files in/etc/systemd/system.daemon disablenever deletes a file without the updex marker or an exact legacy match.Lstatrefuses a symlink or a directory at a unit path.sudo installonly on the ephemeral runner..debcheck runs after GoReleaser publishesdev. It turns the run red but cannot stop the publication./etckeeps them as overrides untildaemon disableruns.timers.target.wantslink untilsystemctl disable.Docs housekeeping
README.md,docs/design/overview.md,docs/design/packaging-and-maintainers.md,docs/specs/sdk-api.mdandAGENTS.md(Release Automation) updatedVerification
node scripts/check-docs.mjsgreensystemd-analyze verifypasses locally on both generated units, from a temp copy.nfpm packagebuilt a.debthat lists both units as 0644 files, andscripts/check-deb-units.shpasses on it.Not verified here:
Release configCI runsgoreleaser check).systemctl showvalue formats on a real host. Mock tests cover empty,n/aand0.