From c61a9a6dba42f005f94d1641022b801bc3c4347e Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 13 May 2026 23:01:41 +0200 Subject: [PATCH] repart: canonicalize node in varlink Run method Run acquire_root_devno() on the varlink-provided node so symlinks (e.g. /dev/disk/by-id/...) resolve to their canonical /dev/ path before being used. Without this, sym_fdisk_partname() produces a "-partN" symlink that udev hasn't created yet when repart calls open() on it right after BLKPG_ADD_PARTITION, failing with ENOENT. This also brings the varlink path in line with the CLI path's partition-to-whole-disk and dm-crypt-to-backing resolution. --- src/repart/repart.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/repart/repart.c b/src/repart/repart.c index 133a8e0211..8cfb798339 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -10964,7 +10964,7 @@ static int find_root(Context *context) { } else if (r < 0) return log_error_errno(r, "Failed to read symlink /run/systemd/volatile-root: %m"); else { - r = acquire_root_devno(device, NULL, open_flags, &context->node, &context->backing_fd); + r = acquire_root_devno(device, /* root= */ NULL, open_flags, &context->node, &context->backing_fd); if (r == -EUCLEAN) return btrfs_log_dev_root(LOG_ERR, r, device); if (r < 0) @@ -11389,7 +11389,9 @@ static int vl_method_run( return r; if (p.node) { - context->node = TAKE_PTR(p.node); + r = acquire_root_devno(p.node, NULL, O_CLOEXEC|context_open_mode(context), &context->node, &context->backing_fd); + if (r < 0) + return log_error_errno(r, "Failed to open file or determine backing device of %s: %m", p.node); r = context_load_partition_table(context); if (r == -EHWPOISON)