[v3] trixie: Workaround with missing drivers in initramfs

Message ID 20260304164729.2331113-1-wzh@ilbers.de
State New
Headers show
Series [v3] trixie: Workaround with missing drivers in initramfs | expand

Commit Message

Zhihang Wei March 4, 2026, 4:47 p.m. UTC
This is a workaround for the booting issue on several Trixie
targets, which is caused by missing drivers in their initramfs.

Starting with Debian Trixie, update-initramfs invokes "dracut-install"
to collect and install required drivers into the generated initramfs.
"dracut-install" relies on fts_open() / fts_read() from glibc to
traverse directories and locate drivers.

Due to a long-standing bug [1] between qemu and glibc, the fts_*
functions may fail to find files on certain 32-bit architectures. As a
result, some required modules are not detected and not added to the
initramfs. The produced image then fails to boot.
It's known that at least these targets under Trixie are affected:
- qemuarm (missing virtio_blk)
- bananapi (missing sunxi_mmc)
- nanopi-neo (missing sunxi_mmc)

A similiar dracut bug report was filed in 2024 [2], pointing to this
upstream glibc issue reported in 2018 [1]. No upstream fix has been
applied, and the issue appears to affect only qemu builds for specific
32-bit targets.

As a temporary workaround, use a customized initramfs-hook to append
the neccessary drivers that are currently missed from the initramfs.

For a complete fix, we either need to push for an upstream glibc/qemu
fix, or convince dracut to avoid using these non-POSIX fts_* functions
and use opendir() / readdir() instead.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=23960
[2] https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1079443

Signed-off-by: Zhihang Wei <wzh@ilbers.de>
---

To apply this patch, the DTB patch and the "Add Trixie support for
various machines" patch are needed.

 .../conf/multiconfig/bananapi-trixie.conf     |  2 +
 .../conf/multiconfig/nanopi-neo-trixie.conf   |  2 +
 .../conf/multiconfig/qemuarm-trixie.conf      |  4 +-
 .../initramfs-trixie-armhf-hook_0.1.bb        | 50 +++++++++++++++++++
 4 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-initramfs/initramfs-trixie-armhf-hook/initramfs-trixie-armhf-hook_0.1.bb

Comments

Jan Kiszka March 4, 2026, 5:59 p.m. UTC | #1
On 04.03.26 17:47, Zhihang Wei wrote:
> This is a workaround for the booting issue on several Trixie
> targets, which is caused by missing drivers in their initramfs.
> 
> Starting with Debian Trixie, update-initramfs invokes "dracut-install"
> to collect and install required drivers into the generated initramfs.
> "dracut-install" relies on fts_open() / fts_read() from glibc to
> traverse directories and locate drivers.
> 
> Due to a long-standing bug [1] between qemu and glibc, the fts_*
> functions may fail to find files on certain 32-bit architectures. As a
> result, some required modules are not detected and not added to the
> initramfs. The produced image then fails to boot.
> It's known that at least these targets under Trixie are affected:
> - qemuarm (missing virtio_blk)
> - bananapi (missing sunxi_mmc)
> - nanopi-neo (missing sunxi_mmc)
> 
> A similiar dracut bug report was filed in 2024 [2], pointing to this
> upstream glibc issue reported in 2018 [1]. No upstream fix has been
> applied, and the issue appears to affect only qemu builds for specific
> 32-bit targets.
> 
> As a temporary workaround, use a customized initramfs-hook to append
> the neccessary drivers that are currently missed from the initramfs.
> 
> For a complete fix, we either need to push for an upstream glibc/qemu
> fix, or convince dracut to avoid using these non-POSIX fts_* functions
> and use opendir() / readdir() instead.
> 
> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=23960
> [2] https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1079443
> 
> Signed-off-by: Zhihang Wei <wzh@ilbers.de>
> ---
> 
> To apply this patch, the DTB patch and the "Add Trixie support for
> various machines" patch are needed.
> 
>  .../conf/multiconfig/bananapi-trixie.conf     |  2 +
>  .../conf/multiconfig/nanopi-neo-trixie.conf   |  2 +
>  .../conf/multiconfig/qemuarm-trixie.conf      |  4 +-
>  .../initramfs-trixie-armhf-hook_0.1.bb        | 50 +++++++++++++++++++
>  4 files changed, 57 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-initramfs/initramfs-trixie-armhf-hook/initramfs-trixie-armhf-hook_0.1.bb
> 
> diff --git a/meta-isar/conf/multiconfig/bananapi-trixie.conf b/meta-isar/conf/multiconfig/bananapi-trixie.conf
> index 66f9db89..c2a9c667 100644
> --- a/meta-isar/conf/multiconfig/bananapi-trixie.conf
> +++ b/meta-isar/conf/multiconfig/bananapi-trixie.conf
> @@ -3,3 +3,5 @@
>  
>  MACHINE ?= "bananapi"
>  DISTRO ?= "debian-trixie"
> +
> +IMAGE_INSTALL += "initramfs-trixie-armhf-hook"
> diff --git a/meta-isar/conf/multiconfig/nanopi-neo-trixie.conf b/meta-isar/conf/multiconfig/nanopi-neo-trixie.conf
> index 6e8f8a44..ee53e68d 100644
> --- a/meta-isar/conf/multiconfig/nanopi-neo-trixie.conf
> +++ b/meta-isar/conf/multiconfig/nanopi-neo-trixie.conf
> @@ -3,3 +3,5 @@
>  
>  MACHINE ?= "nanopi-neo"
>  DISTRO ?= "debian-trixie"
> +
> +IMAGE_INSTALL += "initramfs-trixie-armhf-hook"
> diff --git a/meta-isar/conf/multiconfig/qemuarm-trixie.conf b/meta-isar/conf/multiconfig/qemuarm-trixie.conf
> index 5600ab23..5ec903a5 100644
> --- a/meta-isar/conf/multiconfig/qemuarm-trixie.conf
> +++ b/meta-isar/conf/multiconfig/qemuarm-trixie.conf
> @@ -1,7 +1,9 @@
>  # This software is a part of Isar.
> -# Copyright (C) 2024 ilbers GmbH
> +# Copyright (C) 2024-2026 ilbers GmbH
>  #
>  # SPDX-License-Identifier: MIT
>  
>  MACHINE ?= "qemuarm"
>  DISTRO ?= "debian-trixie"
> +
> +IMAGE_INSTALL += "initramfs-trixie-armhf-hook"
> diff --git a/meta/recipes-initramfs/initramfs-trixie-armhf-hook/initramfs-trixie-armhf-hook_0.1.bb b/meta/recipes-initramfs/initramfs-trixie-armhf-hook/initramfs-trixie-armhf-hook_0.1.bb
> new file mode 100644
> index 00000000..dc923e9f
> --- /dev/null
> +++ b/meta/recipes-initramfs/initramfs-trixie-armhf-hook/initramfs-trixie-armhf-hook_0.1.bb

meta-isar/, please - you are referring to machines here which are not
known to meta/.

> @@ -0,0 +1,50 @@
> +# This software is a part of Isar.
> +# Copyright (C) 2026 ilbers GmbH
> +#
> +# SPDX-License-Identifier: MIT
> +
> +MAINTAINER = "isar-users <isar-users@googlegroups.com>"
> +
> +inherit initramfs-hook
> +
> +# -----------------------------------------------------------------------------
> +# This recipe serves as an example workaround to add missing drivers to
> +# the initramfs generated for Debian Trixie. The drivers are missing due
> +# to an upstream bug in glibc/qemu. This issue caused booting issue on
> +# several Trixie targets.
> +#
> +# Background:
> +#
> +# Starting with Debian Trixie, update-initramfs invokes "dracut-install"
> +# to collect and install required drivers into the generated initramfs.
> +# "dracut-install" relies on fts_open() / fts_read() from glibc to
> +# traverse directories and locate drivers.
> +#
> +# Due to a long-standing bug [1] between qemu and glibc, the fts_*
> +# functions may fail to find files on certain 32-bit architectures. As a
> +# result, some required modules are not detected and not added to the
> +# initramfs. The produced image then fails to boot.
> +#
> +# It's known that at least these targets under Trixie are affected: 
> +# - qemuarm (missing virtio_blk)
> +# - bananapi (missing sunxi_mmc)
> +# - nanopi-neo (missing sunxi_mmc)
> +#
> +# A similiar dracut bug report was filed in 2024 [2], pointing to this
> +# upstream glibc issue reported in 2018 [1]. No upstream fix has been
> +# applied, and the issue appears to affect only qemu builds for specific
> +# 32-bit targets.
> +#
> +# [1] https://sourceware.org/bugzilla/show_bug.cgi?id=23960
> +# [2] https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1079443
> +#
> +# Purpose of this recipe:
> +#
> +# This recipe provides a temporary workaround by using a customized
> +# initramfs hook to append drivers that are currently missing from
> +# the initramfs, allowing the target to boot.
> +# -----------------------------------------------------------------------------
> +
> +HOOK_ADD_MODULES:append:qemuarm:debian-trixie = "virtio-blk"
> +HOOK_ADD_MODULES:append:bananapi:debian-trixie = "sunxi_mmc"
> +HOOK_ADD_MODULES:append:nanopi-neo:debian-trixie = "sunxi_mmc"

So, we are ignoring the dracut-native initramfs case. Please document
that at least because users can still configure that.

Jan

Patch

diff --git a/meta-isar/conf/multiconfig/bananapi-trixie.conf b/meta-isar/conf/multiconfig/bananapi-trixie.conf
index 66f9db89..c2a9c667 100644
--- a/meta-isar/conf/multiconfig/bananapi-trixie.conf
+++ b/meta-isar/conf/multiconfig/bananapi-trixie.conf
@@ -3,3 +3,5 @@ 
 
 MACHINE ?= "bananapi"
 DISTRO ?= "debian-trixie"
+
+IMAGE_INSTALL += "initramfs-trixie-armhf-hook"
diff --git a/meta-isar/conf/multiconfig/nanopi-neo-trixie.conf b/meta-isar/conf/multiconfig/nanopi-neo-trixie.conf
index 6e8f8a44..ee53e68d 100644
--- a/meta-isar/conf/multiconfig/nanopi-neo-trixie.conf
+++ b/meta-isar/conf/multiconfig/nanopi-neo-trixie.conf
@@ -3,3 +3,5 @@ 
 
 MACHINE ?= "nanopi-neo"
 DISTRO ?= "debian-trixie"
+
+IMAGE_INSTALL += "initramfs-trixie-armhf-hook"
diff --git a/meta-isar/conf/multiconfig/qemuarm-trixie.conf b/meta-isar/conf/multiconfig/qemuarm-trixie.conf
index 5600ab23..5ec903a5 100644
--- a/meta-isar/conf/multiconfig/qemuarm-trixie.conf
+++ b/meta-isar/conf/multiconfig/qemuarm-trixie.conf
@@ -1,7 +1,9 @@ 
 # This software is a part of Isar.
-# Copyright (C) 2024 ilbers GmbH
+# Copyright (C) 2024-2026 ilbers GmbH
 #
 # SPDX-License-Identifier: MIT
 
 MACHINE ?= "qemuarm"
 DISTRO ?= "debian-trixie"
+
+IMAGE_INSTALL += "initramfs-trixie-armhf-hook"
diff --git a/meta/recipes-initramfs/initramfs-trixie-armhf-hook/initramfs-trixie-armhf-hook_0.1.bb b/meta/recipes-initramfs/initramfs-trixie-armhf-hook/initramfs-trixie-armhf-hook_0.1.bb
new file mode 100644
index 00000000..dc923e9f
--- /dev/null
+++ b/meta/recipes-initramfs/initramfs-trixie-armhf-hook/initramfs-trixie-armhf-hook_0.1.bb
@@ -0,0 +1,50 @@ 
+# This software is a part of Isar.
+# Copyright (C) 2026 ilbers GmbH
+#
+# SPDX-License-Identifier: MIT
+
+MAINTAINER = "isar-users <isar-users@googlegroups.com>"
+
+inherit initramfs-hook
+
+# -----------------------------------------------------------------------------
+# This recipe serves as an example workaround to add missing drivers to
+# the initramfs generated for Debian Trixie. The drivers are missing due
+# to an upstream bug in glibc/qemu. This issue caused booting issue on
+# several Trixie targets.
+#
+# Background:
+#
+# Starting with Debian Trixie, update-initramfs invokes "dracut-install"
+# to collect and install required drivers into the generated initramfs.
+# "dracut-install" relies on fts_open() / fts_read() from glibc to
+# traverse directories and locate drivers.
+#
+# Due to a long-standing bug [1] between qemu and glibc, the fts_*
+# functions may fail to find files on certain 32-bit architectures. As a
+# result, some required modules are not detected and not added to the
+# initramfs. The produced image then fails to boot.
+#
+# It's known that at least these targets under Trixie are affected: 
+# - qemuarm (missing virtio_blk)
+# - bananapi (missing sunxi_mmc)
+# - nanopi-neo (missing sunxi_mmc)
+#
+# A similiar dracut bug report was filed in 2024 [2], pointing to this
+# upstream glibc issue reported in 2018 [1]. No upstream fix has been
+# applied, and the issue appears to affect only qemu builds for specific
+# 32-bit targets.
+#
+# [1] https://sourceware.org/bugzilla/show_bug.cgi?id=23960
+# [2] https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1079443
+#
+# Purpose of this recipe:
+#
+# This recipe provides a temporary workaround by using a customized
+# initramfs hook to append drivers that are currently missing from
+# the initramfs, allowing the target to boot.
+# -----------------------------------------------------------------------------
+
+HOOK_ADD_MODULES:append:qemuarm:debian-trixie = "virtio-blk"
+HOOK_ADD_MODULES:append:bananapi:debian-trixie = "sunxi_mmc"
+HOOK_ADD_MODULES:append:nanopi-neo:debian-trixie = "sunxi_mmc"