Skip to content

fix: the first boot's security updates never hold it - #41

Merged
marcos-mendez merged 1 commit into
masterfrom
fix/secupdates-never-hold-boot
Oct 3, 2026
Merged

marcos-mendez merged 1 commit into
masterfrom
fix/secupdates-never-hold-boot

Conversation

@marcos-mendez

Copy link
Copy Markdown
Collaborator

The maintainer's decision: an unattended first boot installs the security updates (SEC_UPDATES=FORCE, security.updates_at_first_boot: force), but they must never block the boot.

What changes in firstboot.d/95secupdates

  • apt-get update runs within SEC_UPDATES_UPDATE_TIMEOUT (default 120 s), and the whole run (dpkg --configure -a, update, autoclean, dist-upgrade from security.sources) within SEC_UPDATES_TIMEOUT (default 900 s). Both are read from the inithooks conf; a value that is not a whole number of seconds is said in the journal and the default is used.
  • timeout signals apt's whole process group (dpkg and maintainer scripts too), SIGKILL 30 s after SIGTERM. Stdin is /dev/null.
  • After a stopped or failed step, dpkg --configure -a runs (bounded, 300 s) when dpkg --audit reports anything, so dpkg is not left half configured.
  • One line goes to the inithooks log (plus the journal and secupdates.log): WARN: [95secupdates] security updates not installed: <why>; the boot goes on and cron-apt installs them at its daily run. cron-apt is what the images ship (Keel-Linux/common plans/turnkey/base, conf/turnkey.d/cronapt; no unattended-upgrades). The hook checks for cron-apt's install action /etc/cron-apt/action.d/5-install and names turnkey-install-security-updates instead when it is missing.
  • Exit codes: network unreachable, apt-get update failed or stopped: 0, as before. Upgrade stopped or failed: 1, which run logs as failed and then goes on to the next hook.

Tests

tests/test-secupdates.bats gains 12 tests with fake apt-gets that hang, fail or succeed: each hang is stopped within its limit (timed, under an outer timeout so a regression fails instead of hanging the suite), dpkg is configured after a stopped upgrade, the one log line names cron-apt, and three tests go through the real run to show the hook after 95secupdates still runs (hung upgrade, failed upgrade, offline). Against the old hook, 10 of them fail and the hung run test times out.

Coverage: 95secupdates 110/111 (the Hub status call is the one line not run), shell total 99.71. The changelog entry is 2.3.6+keel23, added on top.

95secupdates ran apt-get update and the upgrade with no limit, so a
stalled mirror or a hung maintainer script held every hook after it.
apt-get update now runs within SEC_UPDATES_UPDATE_TIMEOUT (120 s) and the
whole run within SEC_UPDATES_TIMEOUT (900 s), both overridable from the
inithooks conf. A run stopped or failed leaves dpkg configured (dpkg
--configure -a when dpkg --audit reports anything), records nothing and
writes one line to the inithooks log naming cron-apt, the daily job that
installs the updates instead. No network still exits 0; a stopped or
failed upgrade exits 1, which run logs before going on to the next hook.
@marcos-mendez
marcos-mendez merged commit 2b9501b into master Oct 3, 2026
3 checks passed
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.

1 participant