#1040545 systemtap: stap fails locating installed System.map

Package:
systemtap
Source:
systemtap
Description:
instrumentation system for Linux
Submitter:
Juho Kuisma
Date:
2023-07-07 14:33:04 UTC
Severity:
normal
#1040545#5
Date:
2023-07-07 14:28:22 UTC
From:
To:
Hey,

running stap on a fresh install after stap-prep will always produce
warnings, which break some of the stap functionality:

	$ stap test.stp
	WARNING: Kernel function symbol table missing [man warning::symbols]

stap looks for the symbols at:

	$ strace stap test.stp 2>&1 | grep System.map
	openat(AT_FDCWD, "/lib/modules/6.1.0-10-amd64/build/System.map", O_RDONLY) = -1 ENOENT (No such file or directory)
	openat(AT_FDCWD, "/boot/System.map-6.1.0-10-amd64", O_RDONLY) = 3

where the latter just contains:

	$ cat /boot/System.map-6.1.0-10-amd64
	ffffffffffffffff B The real System.map is in the linux-image-<version>-dbg package

i.e., the symbols are actually available at:

	$ dpkg -L linux-image-6.1.0-10-amd64-dbg | grep System.map
	/usr/lib/debug/boot/System.map-6.1.0-10-amd64

but stap does not know this. I can get this working locally with:

	$ sudo cp /proc/kallsyms /boot/System.map-$(uname -r)

But this can't be the official solution for obvious reasons. See:

https://sourceware.org/systemtap/man/warning::symbols.7stap.html
https://wiki.archlinux.org/title/SystemTap#System.map_is_missing

For reference, stap works out of the box without stap-prep on Fedora 38.
There:

	$ strace stap test.stp 2>&1 | grep System.map
	openat(AT_FDCWD, "/lib/modules/6.3.11-200.fc38.x86_64/build/System.map", O_RDONLY) = 3
	$ rpm -qf /lib/modules/6.3.11-200.fc38.x86_64/build/System.map
	kernel-devel-6.3.11-200.fc38.x86_64

Cheers,
Juho Kuisma