From: Luca Boccassi Date: Fri, 22 May 2026 13:07:06 +0000 (+0100) Subject: sysupdate: List default component only if transfer definition exists (#42179) X-Git-Tag: v261-rc1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86b389090de426edf7eb4672c83b138595e94e22;p=thirdparty%2Fsystemd.git sysupdate: List default component only if transfer definition exists (#42179) `sysupdate --json=short components` lists the components known to sysupdate; these are the components which something like `updatectl` will try to update. The `default` component represents the host, and is meant to be listed if transfer definitions exist in (for example) `/etc/sysupdate.d` corresponding to the host OS. This then corresponds to `TARGET_HOST` in `updatectl` and causes it to try updating that target. The logic for working out whether the `default` component was present essentially boiled down to “does `{/run,/etc,/usr/lib}/sysupdate.d` exist”, and it didn’t check whether a `.transfer` or `.conf` file actually existed in the config directory. This is quite the corner case, but becomes more evident on systems where sysupdate is being used to update a portable service but not the main OS. At that point, if `/etc/sysupdate.d` exists empty (for some reason), `updatectl` falls over because it starts trying to update the host OS without any configuration to do so. So, modify `sysupdate` to more fully load the available configuration when listing components, and query it a bit more deeply to check whether a default component exists. If `sysupdate` is called with various command line arguments to affect how its configuration is loaded, do *not* say that a default component exists, as these arguments essentially anull the possibility of a default being used in that process. Add an integration test based on the reproducer provided by the issue reporter. This test has been tested to fail if the changes to `sysupdate.c` aren’t applied — if so, the second call to `sysupdate components` would return `{"default":true,"components":["some-component"]}`. Signed-off-by: Philip Withnall Fixes: https://github.com/systemd/systemd/issues/41501 --- 86b389090de426edf7eb4672c83b138595e94e22