Skip to contentSkip to conversation

systemd: drop libmount dependency and add blkid and fdisk PACKAGECONFIGs

PATCH In review Hiago De Franco 3 participants 8 messages Jul 17, 2025 – Jul 22, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

v2 cover systemd: drop libmount dependency and add blkid and fdisk PACKAGECONFIGs

From: Hiago De Franco <[email protected]>

The libmount dependency in systemd was made optional upstream [2]. This series backports that change, allowing us to drop util-linux as a build dependency for systemd. This resolves a circular dependency between util-linux and systemd when systemd PACKAGECONFIG is enabled in util-linux. Without this fix, each recipe depends on the other, triggering the circular dependency error.

Note that this alone does not fully resolve the circular dependency on util-linux-fstrim/uuid. There is another one:

glib-2.0 -> util-linux -> systemd -> shared-mime-info -> glib-2.0

But the libmount PACKAGECONFIG can be removed from glib-2.0 to break its dependency on util-linux.

In addition, according to systemd's README [2], the dependencies on libblkid and libfdisk from util-linux are optional, so add them as new PACKAGECONFIGs.

[1] https://github.com/systemd/systemd/commit/d1ee3889cf8e8a9edc82e41d306155fb4c531c8f
[2] https://github.com/systemd/systemd/blob/main/README#L216

v2:
- commit description updated on both patches.
- blkid set as default PACKAGECONFIG to fix an error where bootctl is not built anymore. See
https://lore.kernel.org/all/[email protected]/

v1:
- https://lore.kernel.org/all/[email protected]/

Hiago De Franco (2):
systemd: drop build dependency on util-linux
systemd: add libblkid and libfdisk PACKAGECONFIG options

 .../0001-meson-Add-libmount-feature.patch     | 58 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_257.6.bb    | 10 +++-
 2 files changed, 66 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-meson-Add-libmount-feature.patch
Signature · 1 line
2.39.5
#1 lore raw

PATCH v2 1/2 systemd: drop build dependency on util-linux

From: Hiago De Franco <[email protected]>

The libmount dependency was made optional on systemd upstream [1]. By backporting this upstream change, we can drop util-linux as a build dependency for systemd, making it only as a runtime dependency.

This is important to fix a circular dependency between util-linux and systemd when util-linux is built with the systemd PACKAGECONFIG enabled. Without this change, each recipe depends on the other, triggering the circular dependency error.

[1] https://github.com/systemd/systemd/commit/d1ee3889cf8e8a9edc82e41d306155fb4c531c8f

---
v1->v2:
- commit description fixed, there was a link mentioned that was not being referenced on v1.

---
 .../0001-meson-Add-libmount-feature.patch     | 58 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_257.6.bb    |  7 ++-
 2 files changed, 63 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-meson-Add-libmount-feature.patch
meta/recipes-core/systemd/systemd/0001-meson-Add-libmount-feature.patch new file +58 -0
new file mode 100644
index 000000000000..b593e5cc7d4f
@@ -0,0 +1,58 @@
+From 821c809e1e1e449f5a2fe591d6aae1343b141b6c Mon Sep 17 00:00:00 2001
+From: Daan De Meyer <[email protected]>
+Date: Thu, 5 Jun 2025 11:05:08 +0200
+Subject: [PATCH 1/2] meson: Add libmount feature
+
+Let's reduce the dependencies required to build just libsystemd by
+making libmount optional. The meson disabler feature makes this quite
+trivial.
+
+Upstream-Status: Backport [d1ee3889cf8e8a9edc82e41d306155fb4c531c8f]
+Signed-off-by: Hiago De Franco <[email protected]>
+---
+ meson.build       | 4 +++-
+ meson_options.txt | 2 ++
+ tools/oss-fuzz.sh | 2 +-
+ 3 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 957e00ecad..594fadbb37 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1179,7 +1179,9 @@ else
+ endif
+ 
+ libmount = dependency('mount',
+-                      version : fuzzer_build ? '>= 0' : '>= 2.30')
++                      version : fuzzer_build ? '>= 0' : '>= 2.30',
++                      disabler : true,
++                      required : get_option('libmount'))
+ 
+ libfdisk = dependency('fdisk',
+                       version : '>= 2.32',
+diff --git a/meson_options.txt b/meson_options.txt
+index f30b3f5238..f292732d62 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -471,6 +471,8 @@ option('dbus', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'd
+        description : 'libdbus support (for tests only)')
+ option('libarchive', type : 'feature',
+        description : 'libarchive support')
++option('libmount', type : 'feature',
++       description : 'libmount support')
+ 
+ option('bootloader', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
+        description : 'sd-boot/stub and userspace tools')
+diff --git a/tools/oss-fuzz.sh b/tools/oss-fuzz.sh
+index df3d39eba6..b7a70207df 100755
+--- a/tools/oss-fuzz.sh
++++ b/tools/oss-fuzz.sh
+@@ -32,7 +32,7 @@ meson_args=("-Db_lundef=false")
+ if [ -z "$FUZZING_ENGINE" ]; then
+     meson_args+=("-Dllvm-fuzz=true")
+ else
+-    meson_args+=("-Doss-fuzz=true" "--auto-features=disabled")
++    meson_args+=("-Doss-fuzz=true" "--auto-features=disabled" "-Dlibmount=enabled")
+ 
+     apt-get update
+     apt-get install -y gperf m4 gettext python3-pip \
meta/recipes-core/systemd/systemd_257.6.bb +5 -2
index 9092d02c5109..d73c0cfe0d8b 100644
@@ -4,7 +4,7 @@ PROVIDES = "udev"
 
 PE = "1"
 
-DEPENDS = "gperf-native libcap util-linux python3-jinja2-native"
+DEPENDS = "gperf-native libcap python3-jinja2-native"
 
 SECTION = "base/shell"
 
@@ -29,6 +29,7 @@ SRC_URI += " \
            file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0002-implment-systemd-sysv-install-for-OE.patch \
            file://0001-Do-not-create-var-log-README.patch \
+           file://0001-meson-Add-libmount-feature.patch \
            "
 
 # patches needed by musl
@@ -81,6 +82,7 @@ PACKAGECONFIG ??= " \
     idn \
     ima \
     kmod \
+    libmount \
     localed \
     logind \
     machined \
@@ -172,6 +174,7 @@ PACKAGECONFIG[kmod] = "-Dkmod=enabled,-Dkmod=disabled,kmod,libkmod"
 PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig"
 PACKAGECONFIG[libidn] = "-Dlibidn=enabled,-Dlibidn=disabled,libidn,,libidn"
 PACKAGECONFIG[libidn2] = "-Dlibidn2=enabled,-Dlibidn2=disabled,libidn2,,libidn2"
+PACKAGECONFIG[libmount] = "-Dlibmount=enabled,-Dlibmount=disabled,util-linux,util-linux-mount util-linux-umount"
 # Link udev shared with systemd helper library.
 # If enabled the udev package depends on the systemd package (which has the needed shared library).
 PACKAGECONFIG[link-udev-shared] = "-Dlink-udev-shared=true,-Dlink-udev-shared=false"
@@ -742,7 +745,7 @@ FILES:${PN} = " ${base_bindir}/* \
 
 FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
 
-RDEPENDS:${PN} += "kmod ${VIRTUAL-RUNTIME_dbus} util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck util-linux-swaponoff util-linux-mkswap"
+RDEPENDS:${PN} += "kmod ${VIRTUAL-RUNTIME_dbus} udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck util-linux-swaponoff util-linux-mkswap"
 RDEPENDS:${PN} += "systemd-serialgetty"
 RDEPENDS:${PN} += "volatile-binds"
 
Signature · 1 line
2.39.5
#2 lore raw

Re: [OE-core] [PATCH v2 1/2] systemd: drop build dependency on util-linux

Quoted 11 lines · Hiago De Franco via lists.openembedded.org

From: Hiago De Franco <[email protected]>

The libmount dependency was made optional on systemd upstream [1]. By backporting this upstream change, we can drop util-linux as a build dependency for systemd, making it only as a runtime dependency.

This is important to fix a circular dependency between util-linux and systemd when util-linux is built with the systemd PACKAGECONFIG enabled. Without this change, each recipe depends on the other, triggering the circular dependency error.

How did you test this? If I disable the libmount PACKAGECONFIG the build fails in do_install.

Also your patch moves the util-linux-mount and util-linux-umount RDEPENDS from PN to be dependent on this packageconfig. Is that correct - does disabling the use of _libmount_ also mean that systemd will _never_ call mount/umount? That sounds unlikely.

My understanding of the intention behind the upstream change, and how it’s implemented here, do not match in the slightest.

Ross

#3 lore raw

Re: [OE-core] [PATCH v2 1/2] systemd: drop build dependency on util-linux

Hi Ross,

Quoted 8 lines · Ross Burton
Quoted 7 lines · Hiago De Franco via lists.openembedded.org

From: Hiago De Franco <[email protected]>

The libmount dependency was made optional on systemd upstream [1]. By backporting this upstream change, we can drop util-linux as a build dependency for systemd, making it only as a runtime dependency.

Quoted 6 lines
Quoted 4 lines

This is important to fix a circular dependency between util-linux and systemd when util-linux is built with the systemd PACKAGECONFIG enabled. Without this change, each recipe depends on the other, triggering the circular dependency error.

How did you test this? If I disable the libmount PACKAGECONFIG the build fails in do_install.

I did a mistake on my test when I first send this patch, I am sorry.

I was able to reproduce the do_install failure and this is fixed by backporting patch a292b55980d6 ("meson: Don't fail install script if file doesn't exis"). I will update this in the next revision.

Also, there is one more issue with util-linux which I will also have to fix:

ERROR: util-linux-2.41-r0 do_package: QA Issue: util-linux:
Files/directories were installed but not shipped in any package:
/usr/lib/sysusers.d /usr/lib/systemd/system/uuidd.socket /usr/lib/systemd/system/uuidd.service /usr/lib/systemd/system/lastlog2-import.service /usr/lib/tmpfiles.d/lastlog2-tmpfiles.conf /usr/lib/tmpfiles.d/uuidd-tmpfiles.conf /usr/lib/sysusers.d/uuidd-sysusers.conf

Quoted 4 lines

Also your patch moves the util-linux-mount and util-linux-umount RDEPENDS from PN to be dependent on this packageconfig. Is that correct - does disabling the use of _libmount_ also mean that systemd will _never_ call mount/umount? That sounds unlikely.

My understanding of the intention behind the upstream change, and how it’s implemented here, do not match in the slightest.

Got it, I will also check systemd for the umount/mount and move it back to RDEPENDS then.

Quoted 2 lines

Ross

Quoted 18 lines · Ross Burton
Quoted 11 lines · Hiago De Franco via lists.openembedded.org

Introduce new PACKAGECONFIG options in systemd for both libblkid and libfdisk [1][2].

Set blkid as enabled by default because the bootctl command depends on it to be built. For example, images like core-image-sato-sdk rely on bootctl and have specific tests for it.

Previously this worked implicitly because the upstream Meson option defaulted to auto, which enabled the dependency if libblkid was present. Now, without explicitly enabling it via PACKAGECONFIG, the feature would be disabled, which triggers testimage errors.

Before this commit:

Run-time dependency fdisk found: YES 2.41.0
Run-time dependency blkid found: YES 2.41.0

Quoted 7 lines

So fdisk should be enabled too.

Further digging reveals that systemd itself will no longer call the blkid and fdisk binaries and simply uses the libraries, so the util-linux-blkid and util-linux-fdisk RDEPENDS are redundant.

Also, systemd links against libblkid and libfdisk directly so there’s no need to add RDEPENDS for those, especially not to just the systemd package when the actual linkage is in other places such as libsystemd.

I’ve sent a revert pending an iteration on these patches.

Got it, thanks for the patch and for the review. I will make sure I fix the other issues as well to propose a new version.

Quoted 2 lines

Ross

Best regards,
Hiago.

#4 lore raw

PATCH v2 2/2 systemd: add libblkid and libfdisk PACKAGECONFIG options

In reply to Hiago De Franco

From: Hiago De Franco <[email protected]>

Introduce new PACKAGECONFIG options in systemd for both libblkid and libfdisk [1][2].

Set blkid as enabled by default because the bootctl command depends on it to be built. For example, images like core-image-sato-sdk rely on bootctl and have specific tests for it.

Previously this worked implicitly because the upstream Meson option defaulted to auto, which enabled the dependency if libblkid was present. Now, without explicitly enabling it via PACKAGECONFIG, the feature would be disabled, which triggers testimage errors.

[1] https://github.com/systemd/systemd/blob/main/README#L219
[2] https://github.com/systemd/systemd/blob/main/README#L228

---
v1->2:
- blkid set as default PACKAGECONFIG to fix an error where bootctl is not built anymore.
- commit description updated with blkid information.

---
 meta/recipes-core/systemd/systemd_257.6.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-core/systemd/systemd_257.6.bb +3 -0
index d73c0cfe0d8b..0f358ea88f38 100644
@@ -76,6 +76,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit', 'link-udev-shared', d)} \
     backlight \
     binfmt \
+    blkid \
     gshadow \
     hibernate \
     hostnamed \
@@ -137,6 +138,7 @@ PACKAGECONFIG[audit] = "-Daudit=enabled,-Daudit=disabled,audit"
 PACKAGECONFIG[apparmor] = "-Dapparmor=enabled,-Dapparmor=disabled,apparmor"
 PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false"
 PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false"
+PACKAGECONFIG[blkid] = "-Dblkid=enabled,-Dblkid=disabled,util-linux,util-linux-libblkid util-linux-blkid"
 PACKAGECONFIG[bpf-framework] = "-Dbpf-framework=enabled,-Dbpf-framework=disabled,clang-native bpftool-native libbpf,libbpf"
 PACKAGECONFIG[bzip2] = "-Dbzip2=enabled,-Dbzip2=disabled,bzip2"
 PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false"
@@ -152,6 +154,7 @@ PACKAGECONFIG[default-compression-zstd] = "-Dzstd=true -Ddefault-compression=zst
 PACKAGECONFIG[dbus] = "-Ddbus=enabled,-Ddbus=disabled,dbus"
 PACKAGECONFIG[efi] = "-Defi=true -Dbootloader=enabled,-Defi=false -Dbootloader=disabled,python3-pyelftools-native"
 PACKAGECONFIG[elfutils] = "-Delfutils=enabled,-Delfutils=disabled,elfutils,,libelf libdw"
+PACKAGECONFIG[fdisk] = "-Dfdisk=enabled,-Dfdisk=disabled,util-linux,util-linux-libfdisk util-linux-fdisk"
 PACKAGECONFIG[fido] = "-Dlibfido2=enabled,-Dlibfido2=disabled,libfido2"
 PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false"
 PACKAGECONFIG[repart] = "-Drepart=enabled,-Drepart=disabled"
Signature · 1 line
2.39.5
#5 lore raw

Re: [OE-core] [PATCH v2 2/2] systemd: add libblkid and libfdisk PACKAGECONFIG options

Hi Hiago,

Quoted 5 lines · Hiago De Franco via lists.openembedded.org

From: Hiago De Franco <[email protected]>

Introduce new PACKAGECONFIG options in systemd for both libblkid and libfdisk [1][2].

Quoted 9 lines

Set blkid as enabled by default because the bootctl command depends on it to be built. For example, images like core-image-sato-sdk rely on bootctl and have specific tests for it.

Previously this worked implicitly because the upstream Meson option defaulted to auto, which enabled the dependency if libblkid was present. Now, without explicitly enabling it via PACKAGECONFIG, the feature would be disabled, which triggers testimage errors.

This seems important enough to be its own commit without the new fdisk PACKAGECONFIG so that it can be backported to stable release(s) if needed? I believe this is the result of commit 43abc59a275e ("meson: Use feature options") present in v255 (presnet in oe-core up to scarthgap apparently)?

Cheers,
Quentin

#6 lore raw

Re: [OE-core] [PATCH v2 2/2] systemd: add libblkid and libfdisk PACKAGECONFIG options

Hi Quentin,

Quoted 18 lines · Quentin Schulz

Hi Hiago,

Quoted 5 lines · Hiago De Franco via lists.openembedded.org

From: Hiago De Franco <[email protected]>

Introduce new PACKAGECONFIG options in systemd for both libblkid and libfdisk [1][2].

Quoted 9 lines

Set blkid as enabled by default because the bootctl command depends on it to be built. For example, images like core-image-sato-sdk rely on bootctl and have specific tests for it.

Previously this worked implicitly because the upstream Meson option defaulted to auto, which enabled the dependency if libblkid was present. Now, without explicitly enabling it via PACKAGECONFIG, the feature would be disabled, which triggers testimage errors.

Quoted 4 lines

This seems important enough to be its own commit without the new fdisk PACKAGECONFIG so that it can be backported to stable release(s) if needed? I believe this is the result of commit 43abc59a275e ("meson: Use feature options") present in v255 (presnet in oe-core up to scarthgap apparently)?

I agree this does make sense, yes. I can send a v3 to separate fdisk and blkid so we can later backport this to scarthgap. I will make a test first and then send the patch later, if everything goes well.

Quoted 3 lines

Cheers,
Quentin

Best regards,
Hiago.

#7 lore raw

Re: [OE-core] [PATCH v2 2/2] systemd: add libblkid and libfdisk PACKAGECONFIG options

In reply to Hiago De Franco
Quoted 11 lines · Hiago De Franco via lists.openembedded.org

Introduce new PACKAGECONFIG options in systemd for both libblkid and libfdisk [1][2].

Set blkid as enabled by default because the bootctl command depends on it to be built. For example, images like core-image-sato-sdk rely on bootctl and have specific tests for it.

Previously this worked implicitly because the upstream Meson option defaulted to auto, which enabled the dependency if libblkid was present. Now, without explicitly enabling it via PACKAGECONFIG, the feature would be disabled, which triggers testimage errors.

Before this commit:

Run-time dependency fdisk found: YES 2.41.0
Run-time dependency blkid found: YES 2.41.0

So fdisk should be enabled too.

Further digging reveals that systemd itself will no longer call the blkid and fdisk binaries and simply uses the libraries, so the util-linux-blkid and util-linux-fdisk RDEPENDS are redundant.

Also, systemd links against libblkid and libfdisk directly so there’s no need to add RDEPENDS for those, especially not to just the systemd package when the actual linkage is in other places such as libsystemd.

I’ve sent a revert pending an iteration on these patches.

Ross