Hi folks,
I have not found any information in the forums or on Google about what official package will contain the vmlinux file for the official Fedora kernel. I tried the kernel-debug
package, but it didn’t include it.
Hi folks,
I have not found any information in the forums or on Google about what official package will contain the vmlinux file for the official Fedora kernel. I tried the kernel-debug
package, but it didn’t include it.
@augenauf that package only provides vmlinuz
not vmlinux
.
Well vmlinuz
is just a compressed version of vmlinux
and there is probably no package that contains an uncompressed version.
I’m trying to understand why no packages contain it. The vmlinux image is often used for kernel debugging and profiling. The Linux tree has a script to extract a vmlinux
from a vmlinuz
, but it doesn’t work for the Fedora kernel:
./scripts/extract-vmlinux /boot/vmlinuz-6.10.6-200.fc40.x86_64
extract-vmlinux: Cannot find vmlinux.
That script works fine for me, on both that kernel version and a couple of older ones.
The script is quite simple though, and it looks like that error message would appear for more or less any problem it encounters. Double check you have the bzip2 utilities installed (sudo dnf install bzip2
), as I think it could fail with that message if you don’t.
Why bzip2? Because that appears to be how the kernel on my system was compressed:
$ file /boot/vmlinuz-6.10.6-200.fc40.x86_64
/boot/vmlinuz-6.10.6-200.fc40.x86_64: Linux kernel x86 boot executable bzImage, [...]
I had bzip2
installed but was missing zstd
. I can now extract vmlinux
from vmlinuz
. But it looks like debug symbols are stripped:
❯ file vmlinux
vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=46a6f2d671007c3541be760058f893352f10da89, stripped
❯ nm vmlinux
nm: vmlinux: no symbols
❯ readelf -S vmlinux | grep -E '.debug'
<empty result>
So, this vmlinux is not usable for debugging and profiling.
Debugging does, I think, require installing the kernel-debug* series of kernel packages so they contain the needed details for debugging.
I installed kernel-debug
which installed kernel-debug-core
. Its vmlinuz also has stripped symbols:
❯ rpm -ql 'kernel-debug-core'
/boot/.vmlinuz-6.10.6-200.fc40.x86_64+debug.hmac
/boot/System.map-6.10.6-200.fc40.x86_64+debug
/boot/config-6.10.6-200.fc40.x86_64+debug
/boot/initramfs-6.10.6-200.fc40.x86_64+debug.img
/boot/symvers-6.10.6-200.fc40.x86_64+debug.xz
/boot/vmlinuz-6.10.6-200.fc40.x86_64+debug
/lib/modules
/lib/modules/6.10.6-200.fc40.x86_64+debug
/lib/modules/6.10.6-200.fc40.x86_64+debug/.vmlinuz.hmac
/lib/modules/6.10.6-200.fc40.x86_64+debug/System.map
/lib/modules/6.10.6-200.fc40.x86_64+debug/config
/lib/modules/6.10.6-200.fc40.x86_64+debug/modules.builtin
/lib/modules/6.10.6-200.fc40.x86_64+debug/modules.builtin.modinfo
/lib/modules/6.10.6-200.fc40.x86_64+debug/symvers.xz
/lib/modules/6.10.6-200.fc40.x86_64+debug/vmlinuz
/usr/share/licenses/kernel-debug-core
/usr/share/licenses/kernel-debug-core/COPYING-6.10.6-200.fc40
❯ ./scripts/extract-vmlinux /lib/modules/6.10.6-200.fc40.x86_64+debug/vmlinuz > vmlinux
❯ nm vmlinux
nm: vmlinux: no symbols
❯ file vmlinux
vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=a8bdc67b8c5d039765c5a7d8c722c9bbe5950b58, stripped
The kernel-debuginfo
package contains the unstripped vmlinux
image.
To install it, run:
sudo dnf --enablerepo=fedora-debuginfo,updates-debuginfo install kernel-debuginfo
This will install vmlinux
here:
❯ file /usr/lib/debug/lib/modules/$(uname -r)/vmlinux
/usr/lib/debug/lib/modules/6.10.6-200.fc40.x86_64/vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=46a6f2d671007c3541be760058f893352f10da89, with debug_info, not stripped
Answer found here: Linux kernel debug - #2 by jn64
Also:
% debuginfod-find debuginfo /boot/vmlinuz-V-R-A
which some tools like perf / systemtap can do automatically under the covers.