Skip to content

sys-apps/systemd: sysupdate do not fail - #4118

Open
tormath1 wants to merge 5 commits into
mainfrom
tormath1/sysupdate
Open

sys-apps/systemd: sysupdate do not fail#4118
tormath1 wants to merge 5 commits into
mainfrom
tormath1/sysupdate

Conversation

@tormath1

@tormath1 tormath1 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Attempt to solve: flatcar/Flatcar#1979 with an upstream approach.

TODO:

core@localhost ~ $ sudo find / -type f -name "noop*"
find: '/proc/2334/task/2334/net': Invalid argument
find: '/proc/2334/net': Invalid argument
core@localhost ~ $ sudo systemctl start systemd-sysupdate.service systemd-sysupdate-reboot.service
core@localhost ~ $ systemctl status systemd-sysupdate.service systemd-sysupdate-reboot.service
○ systemd-sysupdate.service - Automatic System Update
     Loaded: loaded (/usr/lib/systemd/system/systemd-sysupdate.service; indirect; preset: disabled)
     Active: inactive (dead) since Thu 2026-06-25 07:27:00 UTC; 6s ago
   Duration: 32ms
 Invocation: e0bd6fe29bdf447ba4343fb7732b3292
TriggeredBy: ● systemd-sysupdate.timer
       Docs: man:systemd-sysupdate.service(8)
    Process: 2378 ExecStart=/usr/lib/systemd/systemd-sysupdate update (code=exited, status=0/SUCCESS)
   Main PID: 2378 (code=exited, status=0/SUCCESS)
   Mem peak: 2.2M
        CPU: 22ms

Jun 25 07:27:00 localhost systemd[1]: Started systemd-sysupdate.service - Automatic System Update.
Jun 25 07:27:00 localhost systemd-sysupdate[2378]: No transfer definitions found.
Jun 25 07:27:00 localhost systemd-sysupdate[2378]: Discovering installed instances…
Jun 25 07:27:00 localhost systemd-sysupdate[2378]: Discovering available instances…
Jun 25 07:27:00 localhost systemd-sysupdate[2378]: Determining installed update sets…
Jun 25 07:27:00 localhost systemd-sysupdate[2378]: Determining available update sets…
Jun 25 07:27:00 localhost systemd-sysupdate[2378]: No update needed.
Jun 25 07:27:00 localhost systemd[1]: systemd-sysupdate.service: Deactivated successfully.

○ systemd-sysupdate-reboot.service - Reboot Automatically After System Update
     Loaded: loaded (/usr/lib/systemd/system/systemd-sysupdate-reboot.service; indirect; preset: disabled)
     Active: inactive (dead) since Thu 2026-06-25 07:27:00 UTC; 6s ago
 Invocation: 2e7850cb0af84034a031f72e3082deae
TriggeredBy: ● systemd-sysupdate-reboot.timer
       Docs: man:systemd-sysupdate-reboot.service(8)
    Process: 2379 ExecStart=/usr/lib/systemd/systemd-sysupdate reboot (code=exited, status=0/SUCCESS)
   Main PID: 2379 (code=exited, status=0/SUCCESS)
   Mem peak: 1.9M
        CPU: 9ms

Jun 25 07:27:00 localhost systemd[1]: Starting systemd-sysupdate-reboot.service - Reboot Automatically After System Update...
Jun 25 07:27:00 localhost systemd-sysupdate[2379]: No transfer definitions found.
Jun 25 07:27:00 localhost systemd-sysupdate[2379]: Discovering installed instances…
Jun 25 07:27:00 localhost systemd-sysupdate[2379]: Determining installed update sets…
Jun 25 07:27:00 localhost systemd-sysupdate[2379]: Couldn't find any suitable installed versions.
Jun 25 07:27:00 localhost systemd[1]: systemd-sysupdate-reboot.service: Deactivated successfully.
Jun 25 07:27:00 localhost systemd[1]: Finished systemd-sysupdate-reboot.service - Reboot Automatically After System Update.

CI ✔️ : https://jenkins.flatcar.org/job/container/job/packages_all_arches/589/cldsv/

@tormath1 tormath1 self-assigned this Jun 23, 2026
Copilot AI lite review requested due to automatic review settings June 23, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a Gentoo user-patch for sys-apps/systemd to prevent systemd-sysupdate invocations (e.g., via timers/services) from exiting non-zero when no transfer definitions are present, addressing Flatcar issue #1979 where the resulting failed units are considered harmless noise.

Changes:

  • Introduce a systemd patch intended to downgrade “no transfer definitions” from an error to a warning while returning success.
  • Adjust src/sysupdate/sysupdate.c behavior (via patch) for the “no transfers defined” condition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings June 23, 2026 13:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment on lines +1 to +4
From f5f1ae2462f192825c5cfd050b33d093a68d8add Mon Sep 17 00:00:00 2001
From: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Date: Tue, 23 Jun 2026 14:44:49 +0200
Subject: [PATCH] sysupdate: do not fail when no transfers are defined
Comment on lines +4 to +12
Subject: [PATCH] sysupdate: do not fail when no transfers are defined

`sysupdate` operations like 'list', 'reboot', etc. should not fail when
no transfers are defined.

We can still warn but this should not fail (i.e return an exit code
different from zero).

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
@tormath1
tormath1 force-pushed the tormath1/sysupdate branch from fab43c4 to 142ed2c Compare June 23, 2026 16:29
Copilot AI review requested due to automatic review settings June 24, 2026 11:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

@tormath1
tormath1 marked this pull request as ready for review June 25, 2026 07:30
@tormath1
tormath1 requested a review from a team as a code owner June 25, 2026 07:30
@tormath1
tormath1 force-pushed the tormath1/sysupdate branch from ac11b05 to 85c642d Compare June 25, 2026 07:31
Copilot AI review requested due to automatic review settings June 25, 2026 09:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +1 to +4
From 948a3c664050d9f74b98e2b016cb810aaf4e9651 Mon Sep 17 00:00:00 2001
From: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Date: Tue, 23 Jun 2026 14:44:49 +0200
Subject: [PATCH] sysupdate: do not fail when no transfers are defined

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-apps/systemd/0001-sysupdate-do-not-fail-when-no-transfers-are-defined.patch:52

  • The patch adds context.n_transfers, but context is dereferenced as a pointer elsewhere in the same hunk (context->newest_installed). As written, this will fail to compile/apply cleanly because . is invalid on a pointer type.
-        if (!context->newest_installed)
+        if (!context->newest_installed) {
+                if (context.n_transfers == 0) {
+                        log_warning("Couldn't find any suitable installed versions.");

sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-apps/systemd/0001-sysupdate-do-not-fail-when-no-transfers-are-defined.patch:24

  • The PR description says this should follow the upstream approach (systemd/systemd#42750), but that PR changes context_read_definitions() to downgrade the “no transfer definitions” error to a warning (affecting all verbs) and only adds a small conditional in verb_pending_or_reboot(). This patch instead changes a few context_make_offline() call sites to pass 0 flags, which is a different behavior and is likely incomplete (other verbs that still pass READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS would continue to fail).
         r = context_make_offline(&context, loop_device ? loop_device->node : NULL,
-                                 READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
+                                 /* read_definition_flags= */ 0);
         if (r < 0)

Comment on lines +1 to +5
From c57f7efee706ce3bd0f12e87036c2edbde442403 Mon Sep 17 00:00:00 2001
From: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Date: Tue, 25 Aug 2026 15:05:52 +0200
Subject: [PATCH] sysupdate: do not fail when no transfers are defined

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Comment on lines +21 to +33
r = context_make_offline(&context, loop_device ? loop_device->node : NULL,
- READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
+ /* read_definition_flags= */ 0);
if (r < 0)
return r;

@@ -1642,7 +1642,7 @@ static int verb_vacuum(int argc, char *argv[], uintptr_t _data, void *userdata)
return r;

r = context_make_offline(&context, loop_device ? loop_device->node : NULL,
- READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
+ /* read_definitions_flags= */ 0);
if (r < 0)
@tormath1
tormath1 force-pushed the tormath1/sysupdate branch from 254512d to 9cb2a2d Compare August 27, 2026 07:44
Copilot AI review requested due to automatic review settings August 27, 2026 07:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.

Suppressed comments (2)

sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-apps/systemd/0001-sysupdate-do-not-fail-when-no-transfers-are-defined.patch:4

  • This patch is named 0001-…, but the same directory already contains 0001-wait-online-set-any-by-default.patch and then 0002…0008. Having two 0001 patches makes the series ordering non-obvious and can change the actual application order (lexicographic) vs the intended sequence.
From c57f7efee706ce3bd0f12e87036c2edbde442403 Mon Sep 17 00:00:00 2001
From: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Date: Tue, 25 Aug 2026 15:05:52 +0200
Subject: [PATCH] sysupdate: do not fail when no transfers are defined

sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-apps/systemd/0001-sysupdate-do-not-fail-when-no-transfers-are-defined.patch:33

  • The added continuation line has inconsistent indentation and a slightly different parameter name in the comment (read_definitions_flags vs read_definition_flags). Since this line ends up in the patched C source, keep it consistent (or drop the comment entirely).
         r = context_make_offline(&context, loop_device ? loop_device->node : NULL,
-                                 READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
+                                /* read_definitions_flags= */ 0);
         if (r < 0)

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Copilot AI review requested due to automatic review settings September 1, 2026 07:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Suppressed comments (3)

sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-apps/systemd/0001-sysupdate-do-not-fail-when-no-transfers-are-defined.patch:34

  • This hunk changes verb_features() to call context_make_offline() with flags=0, which diverges from the upstream approach (only downgrade "no transfer definitions" to a warning) and could change behavior when transfers exist. With the context_read_definitions() adjustment, this call site can keep READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS unchanged.
         r = context_make_offline(&context, loop_device ? loop_device->node : NULL,
-                                 READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
+                                 /* read_definition_flags= */ 0);
         if (r < 0)

sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-apps/systemd/0001-sysupdate-do-not-fail-when-no-transfers-are-defined.patch:43

  • Similarly, verb_vacuum() changes context_make_offline() flags to 0. Keeping READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS and handling the no-transfer case in context_read_definitions() preserves the original call semantics while avoiding unit failures.
         r = context_make_offline(&context, loop_device ? loop_device->node : NULL,
-                                 READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
+                                /* read_definitions_flags= */ 0);
         if (r < 0)

sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-apps/systemd/0001-sysupdate-do-not-fail-when-no-transfers-are-defined.patch:52

  • verb_pending_or_reboot() drops READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS from context_make_offline(). The upstream fix keeps the original flags and just makes the "no definitions" path non-fatal (warning + exit 0). Keeping the original flags also ensures other validation behavior stays intact for setups that do have transfers.
         r = context_make_offline(&context, /* node= */ NULL,
-                                 READ_DEFINITIONS_REQUIRES_ENABLED_TRANSFERS | READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
+                                 READ_DEFINITIONS_REQUIRES_ENABLED_TRANSFERS);
         if (r < 0)

@@ -0,0 +1,72 @@
From c639c673a886933469561b30d7d00dcb233a9b68 Mon Sep 17 00:00:00 2001
Comment thread build_sysext
Comment on lines 333 to 338
systemd-repart \
--private-key="${SYSEXT_SIGNING_KEY_DIR}/sysexts.key" \
--certificate="${SYSEXT_SIGNING_KEY_DIR}/sysexts.crt" \
--make-ddi=sysext \
--sector-size=4096 \
--copy-source="${BUILD_DIR}/${FLAGS_install_root_basename}" \
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
otherwise the sysext is off by 7 * 512bytes.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Copilot AI review requested due to automatic review settings September 1, 2026 11:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Suppressed comments (2)

sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-apps/systemd/0001-sysupdate-do-not-fail-when-no-transfers-are-defined.patch:33

  • Minor typo/inconsistency in the parameter-name comment: read_definition_flags vs READ_DEFINITIONS_* and the later read_definitions_flags. Keeping the spelling consistent makes the patch easier to review and more likely to be accepted upstream.
         r = context_make_offline(&context, loop_device ? loop_device->node : NULL,
-                                 READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
+                                 /* read_definition_flags= */ 0);
         if (r < 0)

sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-apps/systemd/0001-sysupdate-do-not-fail-when-no-transfers-are-defined.patch:42

  • The continuation line indentation is off by one space compared to the surrounding wrapped call, which makes the resulting C code formatting inconsistent. Aligning it also keeps the read_definitions_flags spelling consistent with the other hunk.
         r = context_make_offline(&context, loop_device ? loop_device->node : NULL,
-                                 READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS);
+                                /* read_definitions_flags= */ 0);
         if (r < 0)

@@ -0,0 +1,71 @@
From ad4b282053189db2e1339a46d64e53993a63de65 Mon Sep 17 00:00:00 2001
Comment thread build_sysext
Comment on lines 336 to 338
--make-ddi=sysext \
--sector-size=4096 \
--copy-source="${BUILD_DIR}/${FLAGS_install_root_basename}" \
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.

3 participants