Skip to content

fix(extensions): stage the whole declared set before moving any of it - #5371

Merged
mudler merged 1 commit into
kairos-io:masterfrom
ci-forks:bot/5370-extension-install-atomic
Oct 13, 2026
Merged

mudler merged 1 commit into
kairos-io:masterfrom
ci-forks:bot/5370-extension-install-atomic

Conversation

@ci-robbot

Copy link
Copy Markdown
Collaborator

InstallDeclared moved each entry into the target as soon as it had been downloaded, and only then checked the next entry's file names against the ones already taken. A clash therefore fired with the earlier images already on the node, while the error said:

extensions A and B both install X: only one of the two would survive, so nothing was installed

Those images stayed in /var/lib/kairos/extensions and were merged on the next boot, so the message named a state the node was not in. The operator was told the install did not happen and had no signal about which half of the set had landed.

Seen on a PXE-booted node during the QA of AuroraBoot#878: two declared extensions both resolved to the file name file (that part is #5369), the install was refused, and one image was left in the target.

The change

Every entry is staged first and all the names are checked against each other before anything is moved, so the refusal happens while the target is still untouched. installToStaging splits into stageOne (download, record names, reject a name an earlier entry staged) and moveStaged (rename everything in).

Peak disk use is unchanged: the images sit in the staging directories instead of the target, and the moves are still renames on one filesystem.

A rename can still fail once the moves have started, and there is no filesystem transaction to undo the ones that succeeded. That error now names what reached the target instead of claiming nothing did.

Verification

CGO_ENABLED=0 go test ./agent/pkg/extensions/... ./sdk/extensions/... ./sdk/types/extensions/...
CGO_ENABLED=0 go vet ./agent/pkg/extensions/... ./agent/pkg/action/...
gofmt -l agent/pkg/extensions/

all green. TestInstallDeclaredLeavesTheTargetEmptyWhenTwoEntriesClash is red on master with the exact leftovers:

--- FAIL: TestInstallDeclaredLeavesTheTargetEmptyWhenTwoEntriesClash
    install_test.go:430: /target/extensions holds ["first.sysext.raw" "shared.sysext.raw"],
        want nothing: the error says nothing was installed

and green with the change. The six existing TestInstallDeclared* specs pass unchanged.

Fixes #5370

πŸ€– Generated with Claude Code

InstallDeclared moved each entry into the target as soon as it had been
downloaded, and only then checked the next entry's file names against the
ones already taken. A clash therefore fired with the earlier images
already on the node, while the error it returned said

    extensions A and B both install X: only one of the two would survive,
    so nothing was installed

Those earlier images stayed in /var/lib/kairos/extensions and were merged
on the next boot, so the message named a state the node was not in and
the operator had no signal about which half of the set had landed. Seen
on a PXE-booted node where two declared extensions both resolved to the
file name "file": the install was refused and one image was left behind.

Every entry is now staged first and all the names are checked against
each other before anything is moved, so the refusal happens while the
target is still untouched. Peak disk use is unchanged: the images sit in
the staging directories instead of the target.

A rename can still fail once the moves have started, and there is no
filesystem transaction to undo the ones that succeeded. That error now
names what reached the target instead of claiming nothing did.

Fixes kairos-io#5370

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: ci-robbot <ci-robbot@users.noreply.github.com>
@mudler
mudler merged commit 5eda275 into kairos-io:master Oct 13, 2026
19 of 22 checks passed
ci-robbot pushed a commit to ci-forks/kairos that referenced this pull request Oct 13, 2026
kairos-io#5371 added a clash spec to agent/pkg/extensions/install_test.go next to the
refusal specs on this branch. Both sides only add, so both are kept.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Ettore Di Giacinto <mudler@kairos.io>
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.

InstallDeclared reports "nothing was installed" after it has already moved the earlier extensions into place

2 participants