From 1d977838284fa341edd2747c36d749eb685748f8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 2 Nov 2026 10:59:25 +0100 Subject: [PATCH] sysupdate: take the tags snapshot before the first update pass We loop over enable-suggested/update until the machine tags stop changing so that a confext that ships machine-tags.d files gets its features installed in the same run. The problem is that we took the "before" snapshot of the tags after the first update pass. But sysupdate already refreshes the confexts when it installs one and with the confext now having EXTENSION_RELOAD_OR_RESTART_UNITS=systemd-machine-tags.service the tags are applied right there. So the snapshot already contained the new tags, nothing changed after our own refresh and we only picked up the new features on the next timer run. This commit moves the snapshot before the first pass. Signed-off-by: Michael Vogt --- cmd/quarry-sysupdate/update.go | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/cmd/quarry-sysupdate/update.go b/cmd/quarry-sysupdate/update.go index 5fb482c..9d178dc 100644 --- a/cmd/quarry-sysupdate/update.go +++ b/cmd/quarry-sysupdate/update.go @@ -102,6 +102,20 @@ var updateCommand = withExtensionDirFlag(withQuarryUserFlag(withQuarryProxyFlag( // the extension application, clean up the successfully installed // components, and force-downgrade to the old versions. + // A refreshed confext may ship machine-tags.d(5) files, and features gated on + // those tags were evaluated against the old tags. Loop until the tags + // settle. + // TODO: The real signal to stop looping is whether the set of + // installable features stopped changing (rather than the tags), but + // there isn't a really nice way for us to detect that so we use tags + // as a proxy. In future, sysupdate will handle the loop for us (and + // thus be responsible for this detection) so this can all be removed + // then. + tags, err := hostnamed.CurrentTags(ctx, "") + if err != nil { + return fmt.Errorf("fetch machine tags before update: %w", err) + } + // Pick up tags the user set by hand, not only ones a confext ships. if err := enableSuggested(ctx); err != nil { return err @@ -114,19 +128,6 @@ var updateCommand = withExtensionDirFlag(withQuarryUserFlag(withQuarryProxyFlag( return fmt.Errorf("post-update extension cleanup: %w", err) } - // A refreshed confext may ship tags.d(5) files, and features gated on - // those tags were evaluated against the old tags. Loop until the tags - // settle. - // TODO: The real signal to stop looping is whether the set of - // installable features stopped changing (rather than the tags), but - // there isn't a really nice way for us to detect that so we use tags - // as a proxy. In future, sysupdate will handle the loop for us (and - // thus be responsible for this detection) so this can all be removed - // then. - tags, err := hostnamed.CurrentTags(ctx, "") - if err != nil { - return fmt.Errorf("fetch machine tags before refresh: %w", err) - } for iteration := 1; ; iteration++ { // Do online-reload of sysexts and confexts. slog.Info("Trigger online-reload of new components.")