[mainline]Error while running make modules_install command

Nathan Chancellor nathan at kernel.org
Wed Nov 5 11:56:03 AEDT 2025


+ Nicolas and Alexey, just as an FYI.

Top of thread is:

https://lore.kernel.org/7fef7507-ad64-4e51-9bb8-c9fb6532e51e@linux.ibm.com/

On Tue, Nov 04, 2025 at 04:54:38PM +0530, Venkat Rao Bagalkote wrote:
> IBM CI has also reported this error.
> 
> 
> Error:
> 
> 
> depmod: ERROR: kmod_builtin_iter_next: unexpected string without modname
> prefix
>   INSTALL /boot
> depmod: ERROR: kmod_builtin_iter_next: unexpected string without modname
> prefix
> depmod: ERROR: kmod_builtin_iter_next: unexpected string without modname
> prefix
> 
> 
> Git bisect is pointing to below commit as first bad commit.
> 
> 
> d50f21091358b2b29dc06c2061106cdb0f030d03 is the first bad commit
> commit d50f21091358b2b29dc06c2061106cdb0f030d03
> Author: Dimitri John Ledkov <dimitri.ledkov at surgut.co.uk>
> Date:   Sun Oct 26 20:21:00 2025 +0000
> 
>     kbuild: align modinfo section for Secureboot Authenticode EDK2 compat

Thank you for the bisect. I can reproduce this with at least kmod 29.1,
which is the version I can see failing in drgn's CI from Ubuntu Jammy
(but I did not see it with kmod 34, which is the latest version in Arch
Linux at the moment).

Could you and Omar verify if the following diff resolves the error for
you? I think this would allow us to keep Dimitri's fix for the
Authenticode EDK2 calculation (i.e., the alignment) while keeping kmod
happy. builtin.modules.modinfo is the same after this diff as it was
before Dimitri's change for me.

Cheers,
Nathan

diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
index ced4379550d7..c3f135350d7e 100644
--- a/scripts/Makefile.vmlinux
+++ b/scripts/Makefile.vmlinux
@@ -102,11 +102,23 @@ vmlinux: vmlinux.unstripped FORCE
 # modules.builtin.modinfo
 # ---------------------------------------------------------------------------
 
+# .modinfo in vmlinux is aligned to 8 bytes for compatibility with tools that
+# expect sufficiently aligned sections but the additional NULL bytes used for
+# padding to satisfy this requirement break certain versions of kmod with
+#
+#   depmod: ERROR: kmod_builtin_iter_next: unexpected string without modname prefix
+#
+# Strip the trailing padding bytes after extracting the .modinfo sections to
+# comply with what kmod expects to parse.
+quiet_cmd_modules_builtin_modinfo = GEN     $@
+      cmd_modules_builtin_modinfo = $(cmd_objcopy); \
+                                    sed -i 's/\x00\+$$/\x00/g' $@
+
 OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
 
 targets += modules.builtin.modinfo
 modules.builtin.modinfo: vmlinux.unstripped FORCE
-	$(call if_changed,objcopy)
+	$(call if_changed,modules_builtin_modinfo)
 
 # modules.builtin
 # ---------------------------------------------------------------------------


More information about the Linuxppc-dev mailing list