updated together in a synchronous fashion. Simply define multiple transfer files within the same
<filename>sysupdate.d/</filename> directory for these cases.</para>
- <para>This option may not be combined with <option>--definitions=</option>.</para>
+ <para>This option may not be combined with <option>--definitions=</option>, nor with the
+ <command>pending</command> and <command>reboot</command> commands or the <option>--reboot</option>
+ switch, which only apply to the booted OS version.</para>
<xi:include href="version-info.xml" xpointer="v251"/></listitem>
</varlistentry>
<term><option>--reboot</option></term>
<listitem><para>When used in combination with the <command>update</command> commands and a new version is
- installed, automatically reboots the system immediately afterwards.</para>
+ installed, automatically reboots the system immediately afterwards. This switch may not be combined with
+ <option>--component=</option>, as it only applies to the booted OS version.</para>
<xi:include href="version-info.xml" xpointer="v251"/></listitem>
</varlistentry>
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"The --instances-max argument must be >= 2 while updating");
+ if (arg_reboot && arg_component)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "The --reboot switch may not be combined with --component=, as automatic reboots only apply to the booted OS version.");
+
if (arg_reboot) {
/* If automatic reboot on completion is requested, let's first determine the currently booted image */
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"The --root=/--image= switches may not be combined with the '%s' operation.", argv[0]);
+ if (arg_component)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "The --component= switch may not be combined with the '%s' operation, which only applies to the booted OS version.", argv[0]);
+
r = context_make_offline(&context, /* node= */ NULL,
READ_DEFINITIONS_REQUIRES_ENABLED_TRANSFERS | READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
if (r < 0)
mkdir /run/sysupdate.d
"$SYSUPDATE" --json=short components | grep -F '{"default":false,"components":["some-component"]}' >/dev/null
+# Regression test for https://github.com/systemd/systemd/issues/42330 — the
+# 'pending'/'reboot' verbs and the '--reboot' switch compare the newest installed
+# version against the booted OS version (IMAGE_VERSION= from os-release), which is
+# unrelated to component versions. Selecting a component must therefore be refused
+# rather than silently performing a bogus comparison.
+(! "$SYSUPDATE" --component=some-component pending)
+(! "$SYSUPDATE" --component=some-component reboot)
+(! "$SYSUPDATE" --component=some-component update --reboot)
+
# Clean up regression test
rmdir /run/sysupdate.d
rm -rf /run/sysupdate.some-component.d