Skip to contentSkip to conversation

kbuild: rpm-pkg: Address -debuginfo build regression with RPM < 4.20.0

PATCH In review Nathan Chancellor 4 participants 13 messages Feb 10 – Feb 18

Subsystems (2)
lore
Share & tools
lore

Nathan Chancellor

author maintainer
#0 lore raw

cover kbuild: rpm-pkg: Address -debuginfo build regression with RPM < 4.20.0

Steve reported a build issue with commit 62089b804895 ("kbuild: rpm-pkg:
Generate debuginfo package manually") on RHEL9, which has an older version of RPM than what I tested. Turns out that RPM 4.20.0 fixed an issue with specifying %files for a -debuginfo subpackage.

The first patch restricts the new -debuginfo package generation process to CONFIG_MODULE_SIG=y and RPM >= 4.20.0 to ensure it is actually necessary and working. The second patch restores the original -debuginfo package generation process from commit a7c699d090a1 ("kbuild: rpm-pkg:
build a debuginfo RPM") when CONFIG_MODULE_SIG is disabled to keep the -debuginfo package around for older versions of RPM.

---
Nathan Chancellor (2):
kbuild: rpm-pkg: Restrict manual debug package creation
kernel: rpm-pkg: Restore find-debuginfo.sh approach to -debuginfo package

 scripts/package/kernel.spec | 57 +++++++++++++++++++++++++++++++++++++++------
 scripts/package/mkspec      | 38 +++++++++++++++++++++++++++---
 2 files changed, 85 insertions(+), 10 deletions(-)

---
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
change-id: 20260209-kbuild-fix-debuginfo-rpm-718f81dbcaa6

Best regards,

Signature · 1 line
Nathan Chancellor <[email protected]>
author maintainer
#1 lore raw

PATCH 1/2 kbuild: rpm-pkg: Restrict manual debug package creation

Commit 62089b804895 ("kbuild: rpm-pkg: Generate debuginfo package manually") moved away from the built-in RPM machinery for generating -debuginfo packages to a more manual way to be compatible with module signing, as the built-in machinery strips the modules after the installation process, breaking the signatures.

Unfortunately, prior to rpm 4.20.0, there is a bug where a custom %files directive is ignored for a -debuginfo subpackage [1], meaning builds using older versions of RPM (such as on RHEL9 or RHEL10) fail with:

Checking for unpackaged file(s): /usr/lib/rpm/check-files .../rpmbuild/BUILDROOT/kernel-6.19.0_dirty-1.x86_64
error: Installed (but unpackaged) file(s) found:

     /debuginfo.list
     /usr/lib/debug/.build-id/09/748c214974bfba1522d434a7e0a02e2fd7f29b.debug
     /usr/lib/debug/.build-id/0b/b96dd9c7d3689d82e56d2e73b46f53103cc6c7.debug
     /usr/lib/debug/.build-id/0e/979a2f34967c7437fd30aabb41de1f0c8b6a66.debug
    ...

To workaround this, restrict the manual debug info package creation process to when it is necessary (CONFIG_MODULE_SIG=y) and possible (when using RPM >= 4.20.0). A follow up change will restore the RPM debuginfo creation process using a separate internal flag to allow the package to be built in more situations, as RPM 4.20.0 is a fairly recent version and the built-in -debuginfo generation works fine when module signing is disabled.

---
 scripts/package/kernel.spec |  9 +++++----
 scripts/package/mkspec      | 33 ++++++++++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 7 deletions(-)
scripts/package/kernel.spec +5 -4
index 0f1c8de1bd95..b7deb159f404 100644
@@ -47,12 +47,13 @@ This package provides kernel headers and makefiles sufficient to build modules
 against the %{version} kernel package.
 %endif
 
-%if %{with_debuginfo}
+%if %{with_debuginfo_manual}
 %package debuginfo
 Summary: Debug information package for the Linux kernel
 %description debuginfo
 This package provides debug information for the kernel image and modules from the
 %{version} package.
+%define install_mod_strip 1
 %endif
 
 %prep
@@ -67,7 +68,7 @@ patch -p1 < %{SOURCE2}
 mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE}
 cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz
 # DEPMOD=true makes depmod no-op. We do not package depmod-generated files.
-%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} INSTALL_MOD_STRIP=1 DEPMOD=true modules_install
+%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} %{?install_mod_strip:INSTALL_MOD_STRIP=1} DEPMOD=true modules_install
 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
 cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
 cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
@@ -98,7 +99,7 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
 	echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
 } > %{buildroot}/kernel.list
 
-%if %{with_debuginfo}
+%if %{with_debuginfo_manual}
 # copying vmlinux directly to the debug directory means it will not get
 # stripped (but its source paths will still be collected + fixed up)
 mkdir -p %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}
@@ -162,7 +163,7 @@ fi
 /lib/modules/%{KERNELRELEASE}/build
 %endif
 
-%if %{with_debuginfo}
+%if %{with_debuginfo_manual}
 %files -f %{buildroot}/debuginfo.list debuginfo
 %defattr (-, root, root)
 %exclude /debuginfo.list
scripts/package/mkspec +30 -3
index c7375bfc25a9..1080395ca0e1 100755
@@ -23,15 +23,42 @@ else
 echo '%define with_devel 0'
 fi
 
+# manually generate -debuginfo package
+with_debuginfo_manual=0
 # debuginfo package generation uses find-debuginfo.sh under the hood,
 # which only works on uncompressed modules that contain debuginfo
 if grep -q CONFIG_DEBUG_INFO=y include/config/auto.conf &&
    (! grep -q CONFIG_MODULE_COMPRESS=y include/config/auto.conf) &&
    (! grep -q CONFIG_DEBUG_INFO_SPLIT=y include/config/auto.conf); then
-echo '%define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1}'
-else
-echo '%define with_debuginfo 0'
+	# If module signing is enabled (which may be required to boot with
+	# lockdown enabled), the find-debuginfo.sh machinery cannot be used
+	# because the signatures will be stripped off the modules. However, due
+	# to an rpm bug in versions prior to 4.20.0
+	#
+	#     https://github.com/rpm-software-management/rpm/issues/3057
+	#     https://github.com/rpm-software-management/rpm/commit/49f906998f3cf1f4152162ca61ac0869251c380f
+	#
+	# We cannot provide our own debuginfo package because it does not listen
+	# to our custom files list, failing the build due to unpackaged files.
+	# Manually generate the debug info package if using rpm 4.20.0. If not
+	# using rpm 4.20.0, avoid generating a -debuginfo package altogether,
+	# as it is not safe.
+	if grep -q CONFIG_MODULE_SIG=y include/config/auto.conf; then
+		rpm_ver_str=$(rpm --version 2>/dev/null)
+		# Split the version on spaces
+		IFS=' '
+		set -- $rpm_ver_str
+		if [ "${1:-}" = RPM -a "${2:-}" = version ]; then
+			IFS=.
+			set -- $3
+			rpm_ver=$(( 1000000 * $1 + 10000 * $2 + 100 * $3 + ${4:-0} ))
+			if [ "$rpm_ver" -ge 4200000 ]; then
+				with_debuginfo_manual='%{?_without_debuginfo:0}%{?!_without_debuginfo:1}'
+			fi
+		fi
+	fi
 fi
+echo "%define with_debuginfo_manual $with_debuginfo_manual"
 
 cat<<EOF
 %define ARCH ${ARCH}
Signature · 1 line
2.53.0
author maintainer
#2 lore raw

PATCH 2/2 kernel: rpm-pkg: Restore find-debuginfo.sh approach to -debuginfo package

In reply to Nathan Chancellor

Commit 62089b804895 ("kbuild: rpm-pkg: Generate debuginfo package manually") effectively reverted commit a7c699d090a1 ("kbuild: rpm-pkg:
build a debuginfo RPM") but the approach it took is not safe for older RPM releases. Restore commit a7c699d090a1 ("kbuild: rpm-pkg: build a debuginfo RPM") for the !CONFIG_MODULE_SIG case to allow more environments and configurations to take advantage of the separate debug information package process.

Fixes 62089b804895 ("kbuild: rpm-pkg: Generate debuginfo package manually")
---
 scripts/package/kernel.spec | 50 +++++++++++++++++++++++++++++++++++++++++----
 scripts/package/mkspec      |  5 +++++
 2 files changed, 51 insertions(+), 4 deletions(-)
scripts/package/kernel.spec +46 -4
index b7deb159f404..af682a705477 100644
@@ -2,8 +2,6 @@
 %{!?_arch: %define _arch dummy}
 %{!?make: %define make make}
 %define makeflags %{?_smp_mflags} ARCH=%{ARCH}
-%define __spec_install_post /usr/lib/rpm/brp-compress || :
-%define debug_package %{nil}
 
 Name: kernel
 Summary: The Linux Kernel
@@ -56,6 +54,38 @@ This package provides debug information for the kernel image and modules from th
 %define install_mod_strip 1
 %endif
 
+%if %{with_debuginfo_rpm}
+# list of debuginfo-related options taken from distribution kernel.spec
+# files
+%undefine _include_minidebuginfo
+%undefine _find_debuginfo_dwz_opts
+%undefine _unique_build_ids
+%undefine _unique_debug_names
+%undefine _unique_debug_srcs
+%undefine _debugsource_packages
+%undefine _debuginfo_subpackages
+%global _find_debuginfo_opts -r
+%global _missing_build_ids_terminate_build 1
+%global _no_recompute_build_ids 1
+%{debug_package}
+
+# later, we make all modules executable so that find-debuginfo.sh strips
+# them up. but they don't actually need to be executable, so remove the
+# executable bit, taking care to do it _after_ find-debuginfo.sh has run
+%define __spec_install_post \
+	%{?__debug_package:%{__debug_install_post}} \
+	%{__arch_install_post} \
+	%{__os_install_post} \
+	find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \\\
+		| xargs --no-run-if-empty chmod u-x
+%else
+%define __spec_install_post /usr/lib/rpm/brp-compress || :
+%endif
+# some (but not all) versions of rpmbuild emit %%debug_package with
+# %%install. since we've already emitted it manually, that would cause
+# a package redefinition error. ensure that doesn't happen
+%define debug_package %{nil}
+
 %prep
 %setup -q -n linux
 cp %{SOURCE1} .config
@@ -99,14 +129,22 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
 	echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
 } > %{buildroot}/kernel.list
 
-%if %{with_debuginfo_manual}
+%if 0%{with_debuginfo_manual}%{with_debuginfo_rpm} > 0
 # copying vmlinux directly to the debug directory means it will not get
 # stripped (but its source paths will still be collected + fixed up)
 mkdir -p %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}
 cp vmlinux %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}
+%endif
 
-echo /usr/lib/debug/lib/modules/%{KERNELRELEASE}/vmlinux > %{buildroot}/debuginfo.list
+%if %{with_debuginfo_rpm}
+# make modules executable so that find-debuginfo.sh strips them. this
+# will be undone later in %%__spec_install_post
+find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \
+	| xargs --no-run-if-empty chmod u+x
+%endif
 
+%if %{with_debuginfo_manual}
+echo /usr/lib/debug/lib/modules/%{KERNELRELEASE}/vmlinux > %{buildroot}/debuginfo.list
 while read -r mod; do
 	mod="${mod%.o}.ko"
 	dbg="%{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}/kernel/${mod}"
@@ -124,6 +162,10 @@ done < modules.order
 
 %clean
 rm -rf %{buildroot}
+%if %{with_debuginfo_rpm}
+rm -f debugfiles.list debuglinks.list debugsourcefiles.list debugsources.list \
+	elfbins.list
+%endif
 
 %post
 if [ -x /usr/bin/kernel-install ]; then
scripts/package/mkspec +5 -0
index 1080395ca0e1..c604f8c174e2 100755
@@ -23,6 +23,8 @@ else
 echo '%define with_devel 0'
 fi
 
+# use %{debug_package} machinery to generate -debuginfo
+with_debuginfo_rpm=0
 # manually generate -debuginfo package
 with_debuginfo_manual=0
 # debuginfo package generation uses find-debuginfo.sh under the hood,
@@ -56,9 +58,12 @@ if grep -q CONFIG_DEBUG_INFO=y include/config/auto.conf &&
 				with_debuginfo_manual='%{?_without_debuginfo:0}%{?!_without_debuginfo:1}'
 			fi
 		fi
+	else
+		with_debuginfo_rpm='%{?_without_debuginfo:0}%{?!_without_debuginfo:1}'
 	fi
 fi
 echo "%define with_debuginfo_manual $with_debuginfo_manual"
+echo "%define with_debuginfo_rpm $with_debuginfo_rpm"
 
 cat<<EOF
 %define ARCH ${ARCH}
Signature · 1 line
2.53.0
maintainer Acked-by on the v1 series
#3 lore raw
In reply to Nathan Chancellor
Quoted 17 lines · Nathan Chancellor

Steve reported a build issue with commit 62089b804895 ("kbuild: rpm-pkg:
Generate debuginfo package manually") on RHEL9, which has an older version of RPM than what I tested. Turns out that RPM 4.20.0 fixed an issue with specifying %files for a -debuginfo subpackage.

The first patch restricts the new -debuginfo package generation process to CONFIG_MODULE_SIG=y and RPM >= 4.20.0 to ensure it is actually necessary and working. The second patch restores the original -debuginfo package generation process from commit a7c699d090a1 ("kbuild: rpm-pkg:
build a debuginfo RPM") when CONFIG_MODULE_SIG is disabled to keep the -debuginfo package around for older versions of RPM.

---
Nathan Chancellor (2):
kbuild: rpm-pkg: Restrict manual debug package creation
kernel: rpm-pkg: Restore find-debuginfo.sh approach to -debuginfo package

Quoted 11 lines
 scripts/package/kernel.spec | 57 +++++++++++++++++++++++++++++++++++++++------
 scripts/package/mkspec      | 38 +++++++++++++++++++++++++++---
 2 files changed, 85 insertions(+), 10 deletions(-)

---
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
change-id: 20260209-kbuild-fix-debuginfo-rpm-718f81dbcaa6

Best regards,

Signature · 1 line
Nathan Chancellor <[email protected]>

Thanks!

I cannot test this properly right now, but the changes look good to me.

Signature · 1 line
Nicolas
Tested-by on the v1 series
#4 lore raw
In reply to Nathan Chancellor
Quoted 11 lines · Nathan Chancellor

Steve reported a build issue with commit 62089b804895 ("kbuild: rpm-pkg:
Generate debuginfo package manually") on RHEL9, which has an older version of RPM than what I tested. Turns out that RPM 4.20.0 fixed an issue with specifying %files for a -debuginfo subpackage.

The first patch restricts the new -debuginfo package generation process to CONFIG_MODULE_SIG=y and RPM >= 4.20.0 to ensure it is actually necessary and working. The second patch restores the original -debuginfo package generation process from commit a7c699d090a1 ("kbuild: rpm-pkg:
build a debuginfo RPM") when CONFIG_MODULE_SIG is disabled to keep the -debuginfo package around for older versions of RPM.

Yeah, I had similar issue on Fedora 42 (RPM version 4.20.1) and this series fixed my issue.

Quoted 6 lines

---
Nathan Chancellor (2):
kbuild: rpm-pkg: Restrict manual debug package creation
kernel: rpm-pkg: Restore find-debuginfo.sh approach to -debuginfo package

Quoted 6 lines

scripts/package/kernel.spec | 57 +++++++++++++++++++++++++++++++++++++++------
scripts/package/mkspec | 38 +++++++++++++++++++++++++++---

2 files changed, 85 insertions(+), 10 deletions(-)

---
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
change-id: 20260209-kbuild-fix-debuginfo-rpm-718f81dbcaa6

Thanks,
Stefano

#5 lore raw

Can also add Tested-by: Steve French <[email protected]>

Quoted 35 lines · Stefano Garzarella
Quoted 11 lines · Nathan Chancellor

Steve reported a build issue with commit 62089b804895 ("kbuild: rpm-pkg:
Generate debuginfo package manually") on RHEL9, which has an older version of RPM than what I tested. Turns out that RPM 4.20.0 fixed an issue with specifying %files for a -debuginfo subpackage.

The first patch restricts the new -debuginfo package generation process to CONFIG_MODULE_SIG=y and RPM >= 4.20.0 to ensure it is actually necessary and working. The second patch restores the original -debuginfo package generation process from commit a7c699d090a1 ("kbuild: rpm-pkg:
build a debuginfo RPM") when CONFIG_MODULE_SIG is disabled to keep the -debuginfo package around for older versions of RPM.

Yeah, I had similar issue on Fedora 42 (RPM version 4.20.1) and this series fixed my issue.

Quoted 6 lines

---
Nathan Chancellor (2):
kbuild: rpm-pkg: Restrict manual debug package creation
kernel: rpm-pkg: Restore find-debuginfo.sh approach to -debuginfo package

Quoted 6 lines

scripts/package/kernel.spec | 57 +++++++++++++++++++++++++++++++++++++++------
scripts/package/mkspec | 38 +++++++++++++++++++++++++++---

2 files changed, 85 insertions(+), 10 deletions(-)

---
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
change-id: 20260209-kbuild-fix-debuginfo-rpm-718f81dbcaa6

Thanks,
Stefano

Signature · 3 lines
Thanks,

Steve
author maintainer
#6 lore raw
In reply to Stefano Garzarella

Hi Stefano,

Quoted 13 lines · Stefano Garzarella
Quoted 11 lines · Nathan Chancellor

Steve reported a build issue with commit 62089b804895 ("kbuild: rpm-pkg:
Generate debuginfo package manually") on RHEL9, which has an older version of RPM than what I tested. Turns out that RPM 4.20.0 fixed an issue with specifying %files for a -debuginfo subpackage.

The first patch restricts the new -debuginfo package generation process to CONFIG_MODULE_SIG=y and RPM >= 4.20.0 to ensure it is actually necessary and working. The second patch restores the original -debuginfo package generation process from commit a7c699d090a1 ("kbuild: rpm-pkg:
build a debuginfo RPM") when CONFIG_MODULE_SIG is disabled to keep the -debuginfo package around for older versions of RPM.

Quoted 2 lines

Yeah, I had similar issue on Fedora 42 (RPM version 4.20.1) and this series fixed my issue.

Thanks for testing! I find that a little odd though since I tested 62089b804895 in Fedora 42 during my investigation of the problem and it worked fine without these changes. Nevertheless, I will add your tags to this series when I apply it.

Cheers,
Nathan

#7 lore raw
Quoted 17 lines · Nathan Chancellor

Hi Stefano,

Quoted 13 lines · Stefano Garzarella
Quoted 11 lines · Nathan Chancellor

Steve reported a build issue with commit 62089b804895 ("kbuild: rpm-pkg:
Generate debuginfo package manually") on RHEL9, which has an older version of RPM than what I tested. Turns out that RPM 4.20.0 fixed an issue with specifying %files for a -debuginfo subpackage.

The first patch restricts the new -debuginfo package generation process to CONFIG_MODULE_SIG=y and RPM >= 4.20.0 to ensure it is actually necessary and working. The second patch restores the original -debuginfo package generation process from commit a7c699d090a1 ("kbuild: rpm-pkg:
build a debuginfo RPM") when CONFIG_MODULE_SIG is disabled to keep the -debuginfo package around for older versions of RPM.

Quoted 7 lines
Quoted 2 lines

Yeah, I had similar issue on Fedora 42 (RPM version 4.20.1) and this series fixed my issue.

Thanks for testing! I find that a little odd though since I tested 62089b804895 in Fedora 42 during my investigation of the problem and it worked fine without these changes. Nevertheless, I will add your tags to this series when I apply it.

mmm, that it's odd indeed.
Without this series applied, I had issues on Fedora 42 (RPM version 4.20.1), but it worked on Fedora 43 (RPM version 6.0.1).

I just retried on Fedora 42 to build commit cee73b1e840c ("Merge tag 'riscv-for-linus-7.0-mw1' of
git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux") and I have the following errors:

RPM build errors:

    Dependency tokens must begin with alpha-numeric, '_' or '/': #�) = 0x0d000002
    Dependency tokens must begin with alpha-numeric, '_' or '/': �) = 0x0d000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x7c0e000000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x47161b0700
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x339b1a000ac0
    Dependency tokens must begin with alpha-numeric, '_' or '/': �) = 0x36000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x7508200000000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x2e76000000000400
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x803ab2b00000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x1a00000000005e00
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x125590000000060
    Dependency tokens must begin with alpha-numeric, '_' or '/': = 0x03080000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x818000000003600
    Dependency tokens must begin with alpha-numeric, '_' or '/': �) = 0x0d000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x7c0e000000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': $) = 0x1c01040000004d00
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x63c300000000000
    Illegal char '?' (0xffffffd8) in: 3�
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x1320f691700
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x2e17101500
    Version required: ksym(g) =
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': p) = 0x3875480000005c
    Dependency tokens must begin with alpha-numeric, '_' or '/': ]) = 0xfc22000000003000
    Dependency tokens must begin with alpha-numeric, '_' or '/': 2) = 0x5d0d03cc22
    Dependency tokens must begin with alpha-numeric, '_' or '/': ]) = 0x32042c1c
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x1c11a3d1b00
    Version required: ksym(�) =
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3220312e322e3400
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x322e353120295400
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x2029554e47282000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Illegal char ')' (0x29) in: (GNU)
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': #) = 0x031c0000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x570d03ea11
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x4000000520d03c0
    Dependency tokens must begin with alpha-numeric, '_' or '/': C) = 0x690d03cf33
    Dependency tokens must begin with alpha-numeric, '_' or '/': �l) = 0x102000001471140
    Dependency tokens must begin with alpha-numeric, '_' or '/': i) = 0x4a00000000011000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x2e00000000240000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x42111503a533
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0xea1303bb33000000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000

But if I apply this series on top, everything is fine.

Thanks,
Stefano

author maintainer
#8 lore raw
Quoted 68 lines · Stefano Garzarella

mmm, that it's odd indeed.
Without this series applied, I had issues on Fedora 42 (RPM version 4.20.1), but it worked on Fedora 43 (RPM version 6.0.1).

I just retried on Fedora 42 to build commit cee73b1e840c ("Merge tag 'riscv-for-linus-7.0-mw1' of
git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux") and I have the following errors:

RPM build errors:

    Dependency tokens must begin with alpha-numeric, '_' or '/': #�) = 0x0d000002
    Dependency tokens must begin with alpha-numeric, '_' or '/': �) = 0x0d000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x7c0e000000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x47161b0700
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x339b1a000ac0
    Dependency tokens must begin with alpha-numeric, '_' or '/': �) = 0x36000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x7508200000000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x2e76000000000400
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x803ab2b00000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x1a00000000005e00
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x125590000000060
    Dependency tokens must begin with alpha-numeric, '_' or '/': = 0x03080000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x818000000003600
    Dependency tokens must begin with alpha-numeric, '_' or '/': �) = 0x0d000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x7c0e000000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': $) = 0x1c01040000004d00
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x63c300000000000
    Illegal char '?' (0xffffffd8) in: 3�
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x1320f691700
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x2e17101500
    Version required: ksym(g) =
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': p) = 0x3875480000005c
    Dependency tokens must begin with alpha-numeric, '_' or '/': ]) = 0xfc22000000003000
    Dependency tokens must begin with alpha-numeric, '_' or '/': 2) = 0x5d0d03cc22
    Dependency tokens must begin with alpha-numeric, '_' or '/': ]) = 0x32042c1c
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x1c11a3d1b00
    Version required: ksym(�) =
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3220312e322e3400
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x322e353120295400
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x2029554e47282000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Illegal char ')' (0x29) in: (GNU)
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': #) = 0x031c0000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x570d03ea11
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x4000000520d03c0
    Dependency tokens must begin with alpha-numeric, '_' or '/': C) = 0x690d03cf33
    Dependency tokens must begin with alpha-numeric, '_' or '/': �l) = 0x102000001471140
    Dependency tokens must begin with alpha-numeric, '_' or '/': i) = 0x4a00000000011000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x2e00000000240000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x42111503a533
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0xea1303bb33000000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
Quoted 1 line

But if I apply this series on top, everything is fine.

Okay interesting! I have not seen that error yet... I wonder if adding 'AutoReqProv: no' to the kernel-debuginfo subpackage (like the kernel-devel subpackage) would avoid that for rpm 4.20.0... Probably not that big of a deal if it is resolved with rpm 6.0.1 but it would be good to avoid as many corner cases as possible.

Cheers,
Nathan

#9 lore raw
Quoted 70 lines · Nathan Chancellor
Quoted 69 lines · Stefano Garzarella

mmm, that it's odd indeed.
Without this series applied, I had issues on Fedora 42 (RPM version 4.20.1), but it worked on Fedora 43 (RPM version 6.0.1).

I just retried on Fedora 42 to build commit cee73b1e840c ("Merge tag 'riscv-for-linus-7.0-mw1' of
git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux") and I have the following errors:

RPM build errors:

    Dependency tokens must begin with alpha-numeric, '_' or '/': #�) = 0x0d000002
    Dependency tokens must begin with alpha-numeric, '_' or '/': �) = 0x0d000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x7c0e000000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x47161b0700
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x339b1a000ac0
    Dependency tokens must begin with alpha-numeric, '_' or '/': �) = 0x36000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x7508200000000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x2e76000000000400
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x803ab2b00000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x1a00000000005e00
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x125590000000060
    Dependency tokens must begin with alpha-numeric, '_' or '/': = 0x03080000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x818000000003600
    Dependency tokens must begin with alpha-numeric, '_' or '/': �) = 0x0d000000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x7c0e000000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': $) = 0x1c01040000004d00
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x63c300000000000
    Illegal char '?' (0xffffffd8) in: 3�
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x1320f691700
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x2e17101500
    Version required: ksym(g) =
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': p) = 0x3875480000005c
    Dependency tokens must begin with alpha-numeric, '_' or '/': ]) = 0xfc22000000003000
    Dependency tokens must begin with alpha-numeric, '_' or '/': 2) = 0x5d0d03cc22
    Dependency tokens must begin with alpha-numeric, '_' or '/': ]) = 0x32042c1c
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x1c11a3d1b00
    Version required: ksym(�) =
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3220312e322e3400
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x322e353120295400
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x2029554e47282000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Illegal char ')' (0x29) in: (GNU)
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': #) = 0x031c0000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x570d03ea11
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x4728203a43434800
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 
    0x4000000520d03c0
    Dependency tokens must begin with alpha-numeric, '_' or '/': C) = 0x690d03cf33
    Dependency tokens must begin with alpha-numeric, '_' or '/': �l) = 0x102000001471140
    Dependency tokens must begin with alpha-numeric, '_' or '/': i) = 0x4a00000000011000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x2e00000000240000
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0x42111503a533
    Dependency tokens must begin with alpha-numeric, '_' or '/': ) = 0xea1303bb33000000
    Unknown rich dependency op 'Hat': (Red Hat 15.2.1-7)) = 0x3130363230322000
Quoted 7 lines
Quoted 1 line

But if I apply this series on top, everything is fine.

Okay interesting! I have not seen that error yet... I wonder if adding 'AutoReqProv: no' to the kernel-debuginfo subpackage (like the kernel-devel subpackage) would avoid that for rpm 4.20.0... Probably not that big of a deal if it is resolved with rpm 6.0.1 but it would be good to avoid as many corner cases as possible.

Oh, yeah, I just tried the following change on top of commit cee73b1e840c ("Merge tag 'riscv-for-linus-7.0-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux"), so without this series applied:

scripts/package/kernel.spec +1 -0
index 0f1c8de1bd95..86ca327ebccf 100644
@@ -50,6 +50,7 @@ against the %{version} kernel package.
 %if %{with_debuginfo}
 %package debuginfo
 Summary: Debug information package for the Linux kernel
+AutoReqProv: no
 %description debuginfo
 This package provides debug information for the kernel image and modules from the
 %{version} package.

And I'm able to generate RPMs too without errors!

Thanks,
Stefano

author maintainer
#10 lore raw
Quoted 18 lines · Stefano Garzarella

Oh, yeah, I just tried the following change on top of commit cee73b1e840c ("Merge tag 'riscv-for-linus-7.0-mw1' of
git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux"), so without this series applied:

scripts/package/kernel.spec +1 -0
index 0f1c8de1bd95..86ca327ebccf 100644
@@ -50,6 +50,7 @@ against the %{version} kernel package.
 %if %{with_debuginfo}
 %package debuginfo
 Summary: Debug information package for the Linux kernel
+AutoReqProv: no
 %description debuginfo
 This package provides debug information for the kernel image and modules from the
 %{version} package.
Quoted 1 line

And I'm able to generate RPMs too without errors!

Great, thanks for confirming! Does it still work with:

AutoReq: 0
AutoProv: 1

as I notice that is what the %_debuginfo_template in /usr/lib/rpm/macros uses by default. I suspect that the automatic requires is where things explodes and I think we do want the automatic provides because I believe that is how the "this package provides this debug build ID" generation happens.

Cheers,
Nathan

#11 lore raw
Quoted 19 lines · Nathan Chancellor
Quoted 18 lines · Stefano Garzarella

Oh, yeah, I just tried the following change on top of commit cee73b1e840c ("Merge tag 'riscv-for-linus-7.0-mw1' of
git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux"), so without this series applied:

scripts/package/kernel.spec +1 -0
index 0f1c8de1bd95..86ca327ebccf 100644
@@ -50,6 +50,7 @@ against the %{version} kernel package.
 %if %{with_debuginfo}
 %package debuginfo
 Summary: Debug information package for the Linux kernel
+AutoReqProv: no
 %description debuginfo
 This package provides debug information for the kernel image and modules from the
 %{version} package.
Quoted 6 lines
Quoted 1 line

And I'm able to generate RPMs too without errors!

Great, thanks for confirming! Does it still work with:

AutoReq: 0
AutoProv: 1

Yep, I tried this (compared to the previous email, just to be sure I get you):

scripts/package/kernel.spec +2 -1
index 86ca327ebccf..f5d0fa34c51b 100644
@@ -50,7 +50,8 @@ against the %{version} kernel package.
 %if %{with_debuginfo}
 %package debuginfo
 Summary: Debug information package for the Linux kernel
-AutoReqProv: no
+AutoReq: 0
+AutoProv: 1
 %description debuginfo
 This package provides debug information for the kernel image and modules from the
 %{version} package.

And I'm able to generate RPMs without errors.

Quoted 6 lines

as I notice that is what the %_debuginfo_template in /usr/lib/rpm/macros uses by default. I suspect that the automatic requires is where things explodes and I think we do want the automatic provides because I believe that is how the "this package provides this debug build ID" generation happens.

Oh I see, I also have:

    #	Template for debug information sub-package.
    %_debuginfo_template \
    %package debuginfo\
    Summary: Debug information for package %{name}\
    Group: Development/Debug\
    AutoReq: 0\
    AutoProv: 1\
    %description debuginfo\
    This package provides debug information for package %{name}.\
    Debug information is useful when developing applications that use this\
    package or when debugging this package.\
    %files debuginfo -f debugfiles.list\
    %{nil}

So I guess I tested the right thing and it works ;-)

Thanks,
Stefano

author maintainer
#12 lore raw
In reply to Nathan Chancellor
Quoted 5 lines · Nathan Chancellor

Steve reported a build issue with commit 62089b804895 ("kbuild: rpm-pkg:
Generate debuginfo package manually") on RHEL9, which has an older version of RPM than what I tested. Turns out that RPM 4.20.0 fixed an issue with specifying %files for a -debuginfo subpackage.

Quoted 8 lines

The first patch restricts the new -debuginfo package generation process to CONFIG_MODULE_SIG=y and RPM >= 4.20.0 to ensure it is actually necessary and working. The second patch restores the original -debuginfo package generation process from commit a7c699d090a1 ("kbuild: rpm-pkg:
build a debuginfo RPM") when CONFIG_MODULE_SIG is disabled to keep the -debuginfo package around for older versions of RPM.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-fixes

Thanks!

[1/2] kbuild: rpm-pkg: Restrict manual debug package creation

      https://git.kernel.org/kbuild/c/6d6b8b0e28c46
[2/2] kernel: rpm-pkg: Restore find-debuginfo.sh approach to -debuginfo package
      https://git.kernel.org/kbuild/c/ffe9ac1ad56df

Please look out for regression or issue reports or other follow up comments, as they may result in the patch/series getting dropped or reverted. Patches applied to an "unstable" branch are accepted pending wider testing in -next and any post-commit review; they will generally be moved to the main branch in a week if no issues are found.

Best regards,

Signature · 1 line
Nathan Chancellor <[email protected]>