systemd/systemd: add patches to fix sysupdate issues

These patches are merged (or submitted) upstream and not in a release
yet.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8261>
This commit is contained in:
Clayton Craft 2026-04-02 10:18:32 -07:00 committed by The Friendly Meow (merge) Bot
parent d4c0788fb6
commit 40a5c82049
No known key found for this signature in database
5 changed files with 167 additions and 1 deletions

View file

@ -0,0 +1,44 @@
From a353bb060e79137e8d2b26a5ec030c23080d7cb6 Mon Sep 17 00:00:00 2001
From: Valentin David <me@valentindavid.com>
Date: Mon, 30 Mar 2026 09:49:13 +0200
Subject: [PATCH] sysupdate: Ignore resources that are not pending
`updatectl enable --now` systematically fails because the update phase find
resources that are not pending. So instead we should ignore them.
Fixes #41254
---
src/sysupdate/sysupdate-transfer.c | 6 ++++--
test/units/TEST-72-SYSUPDATE.sh | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/sysupdate/sysupdate-transfer.c b/src/sysupdate/sysupdate-transfer.c
index 46f3129f5d993..35c0e05083bdf 100644
--- a/src/sysupdate/sysupdate-transfer.c
+++ b/src/sysupdate/sysupdate-transfer.c
@@ -1609,8 +1609,10 @@ int transfer_process_partial_and_pending_instance(Transfer *t, Instance *i) {
/* Does this instance already exist in the target but isnt pending? */
existing = resource_find_instance(&t->target, i->metadata.version);
- if (existing && !existing->is_pending)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to acquire '%s', instance is already in the target but is not pending.", i->path);
+ if (existing && !existing->is_pending) {
+ log_info("Resource '%s' instance is already in the target but is not pending.", i->path);
+ return 0;
+ }
/* All we need to do is compute the temporary paths. We dont need to do any of the other work in
* transfer_acquire_instance(). */
diff --git a/test/units/TEST-72-SYSUPDATE.sh b/test/units/TEST-72-SYSUPDATE.sh
index fc83a42e55d66..b929485bd5b6c 100755
--- a/test/units/TEST-72-SYSUPDATE.sh
+++ b/test/units/TEST-72-SYSUPDATE.sh
@@ -352,7 +352,7 @@ EOF
mkdir "$CONFIGDIR/optional.feature.d"
echo -e "[Feature]\nEnabled=true" > "$CONFIGDIR/optional.feature.d/enable.conf"
"$SYSUPDATE" --offline list v5 | grep "incomplete" >/dev/null
- update_now "monolithic"
+ update_now "$update_type"
"$SYSUPDATE" --offline list v5 | grep -v "incomplete" >/dev/null
verify_version "$blockdev" "$sector_size" v3 1
verify_version_current "$blockdev" "$sector_size" v5 2

View file

@ -0,0 +1,29 @@
From f933badfd5250ecdf40d6ee84d96f2f618edbed4 Mon Sep 17 00:00:00 2001
From: Valentin David <me@valentindavid.com>
Date: Mon, 30 Mar 2026 09:54:38 +0200
Subject: [PATCH] discover-image: Ignore sysupdate temporary files
Sysupdate temporary file names do not match their extension-release names. So
they will always fail. That makes enabling any other sysexts/confexts fail
which has catastrophic consequences. Unfortunately since 260, sysupdate
leaves temporary files for long time instead just while downloading. So
this kind of failure now happens much more often.
---
src/shared/discover-image.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/shared/discover-image.c b/src/shared/discover-image.c
index 6b4493b960b60..6b9954913498c 100644
--- a/src/shared/discover-image.c
+++ b/src/shared/discover-image.c
@@ -1112,6 +1112,10 @@ int image_discover(
if (dot_or_dot_dot(fname))
continue;
+ /* Ignore sysupdate temporary files */
+ if (startswith(fname, ".sysupdate."))
+ continue;
+
fname_path = path_join(search_path, fname);
if (!fname_path)
return -ENOMEM;

View file

@ -0,0 +1,29 @@
From 0505651ef133d5e9b03bc12359a897d7430eaa00 Mon Sep 17 00:00:00 2001
From: Valentin David <me@valentindavid.com>
Date: Mon, 30 Mar 2026 10:07:04 +0200
Subject: [PATCH] sysupdated: Accept "current+pending" key
Since 594d0345fa997446b4c2dcfbccf3f83257bb55a3 the key for
current version might be "current+pending". So in order not to fail
we need to accept it.
Fixes #41409
---
src/sysupdate/sysupdated.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/sysupdate/sysupdated.c b/src/sysupdate/sysupdated.c
index fde6124e849dc..f387494b58051 100644
--- a/src/sysupdate/sysupdated.c
+++ b/src/sysupdate/sysupdated.c
@@ -1334,7 +1334,9 @@ static int target_method_get_version(sd_bus_message *msg, void *userdata, sd_bus
version_json = sd_json_variant_by_key(v, "current");
if (!version_json)
- return log_sysupdate_bad_json(SYNTHETIC_ERRNO(EPROTO), "list", "Missing key 'current'");
+ version_json = sd_json_variant_by_key(v, "current+pending");
+ if (!version_json)
+ return log_sysupdate_bad_json(SYNTHETIC_ERRNO(EPROTO), "list", "Missing key 'current' or 'current+pending'");
if (sd_json_variant_is_null(version_json))
return sd_bus_reply_method_return(msg, "s", "");

View file

@ -0,0 +1,55 @@
From bfb0bfeff0cc38c8b5803437c7f413199fda043d Mon Sep 17 00:00:00 2001
From: Clayton Craft <clayton@craftyguy.net>
Date: Thu, 2 Apr 2026 10:06:51 -0700
Subject: [PATCH] updatectl: fix unexpected polkit prompt on update
When running `updatectl update` since f0b2ea63, Install() was called
with the version resolved by Acquire() rather than the originally
requested (empty) version, causing the stricter update-to-version polkit
action to be used instead of the update polkit action.
---
src/sysupdate/updatectl.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/sysupdate/updatectl.c b/src/sysupdate/updatectl.c
index 86561cf1c734d..636a3f064b94f 100644
--- a/src/sysupdate/updatectl.c
+++ b/src/sysupdate/updatectl.c
@@ -75,6 +75,8 @@ typedef struct Operation {
/* Only used for Acquire()/Install() operations: */
char *acquired_version;
+ /* The version the user requested, possibly empty */
+ char *requested_version;
} Operation;
static Operation* operation_free(Operation *p) {
@@ -90,6 +92,7 @@ static Operation* operation_free(Operation *p) {
free(p->job_path);
free(p->acquired_version);
+ free(p->requested_version);
sd_event_source_disable_unref(p->job_interrupt_source);
sd_bus_slot_unref(p->job_properties_slot);
@@ -1068,7 +1071,7 @@ static int update_acquire_finished(sd_bus_message *m, void *userdata, sd_bus_err
update_install_started,
op,
"st",
- op->acquired_version,
+ op->requested_version,
0LU);
if (r < 0)
return log_bus_error(r, NULL, op->target_id, "call Install");
@@ -1246,6 +1249,11 @@ static int do_update(sd_bus *bus, char **targets) {
0LU);
if (r < 0)
return log_bus_error(r, NULL, targets[i], "call Acquire");
+
+ op->requested_version = strdup(versions[i]);
+ if (!op->requested_version)
+ return log_oom();
+
TAKE_PTR(op);
remaining++;

View file

@ -9,7 +9,7 @@ maintainer="Clayton Craft <craftyguy@postmarketos.org>"
pkgname=systemd
pkgver=260.1
_pkgver="${pkgver/_/-}"
pkgrel=2
pkgrel=3
pkgdesc="System and service manager"
url="https://github.com/systemd/systemd"
# armhf: no linux-stable
@ -157,6 +157,11 @@ subpackages="
source="$pkgname-$pkgver.tar.gz::https://github.com/systemd/systemd/archive/refs/tags/v$_pkgver.tar.gz
wired.network
bless-boot.patch
41416.patch
41418.patch
41419.patch
41483.patch
"
builddir="$srcdir/systemd-$_pkgver"
@ -520,4 +525,8 @@ sha512sums="
9f975dce6861853a817a7ceab18a24449a85d1bda6939b3a5173430c02a4d8a9a2b34ebb8cce1c51db9b0ff9078fcc65da7b0f44e3bdcbbe013b9e04bb6f0ff9 systemd-260.1.tar.gz
81c897fed8a3fbfb67ec591b2398a5d65e4af1b3ef379376c157c98d71f085b707f8ebc896d5571a94f99f8fc84fd6b43e3b879ca9b0d57fc6c4596034c7a777 wired.network
8b0360acd46f8918ccaf4bcfbf8b2e60ba0d1d6ea6c575fa51668e129b421edc3e7503db7790b6abce8d926b6c8493c02893f70eb481e3fdd935c7b90f442474 bless-boot.patch
c33c552c6b8c74d3c15f339ec0ebc6d179022f18ba13d8524ce22e9311deb4bbba369a3a737222c9954817398c44998f3169f7f55122d6ee7b96f7d3fd6bcc78 41416.patch
ca2f3a1326b3367aef0c1961c6dbbce0659b81ef39a0a546db69129b2edeba2f5141a663ae0d926bca96d7a9d1d09c7d840c63165f317f778a489b44f9b431c6 41418.patch
394fb47e88f5ae766ffcb226bd55df25771e45099ba3cbed6b034e9a36a77a13029d24b2e2f27ef6624f6dfb87f1165da4654d4043fe8b88bcd34d81f786f902 41419.patch
cb564eec45452df51eb8cbca8f8f92f1715d20867ac156c4b3d9b453862a328b8bde98948978d8de05e9c3e49a6c21b3bc5c0a128273b6d814a435ad7bd41d5c 41483.patch
"