Public bug reported: After https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2051560, the linux-tools-<version> package started shipping the perf module, at least for the generic kernel:
$ dpkg -L linux-tools-6.8.0-38|grep perf\.cpython /usr/lib/python3/dist-packages/linux-tools-6.8.0-38/perf.cpython-312-x86_64-linux-gnu.so For the AWS kernel, the linux-tools-6.8.0-1009-aws package does not ship the perf module: $ dpkg -L linux-tools-$(uname -r)|grep perf /usr/lib/linux-tools/6.8.0-1009-aws/libperf-jvmti.so /usr/lib/linux-tools/6.8.0-1009-aws/perf /usr/lib/linux-tools/6.8.0-1009-aws/x86_energy_perf_policy There is no linux-tools-6.8.0-1009 package without the "-aws" suffix (which would then match the output of uname -r). The layout for cloud kernels seems a bit different. $ uname -r 6.8.0-1009-aws $ python3 -c "import perf" Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python3/dist-packages/perf/__init__.py", line 24, in <module> raise KernelNotFoundError() perf.KernelNotFoundError: WARNING: python perf module not found for kernel 6.8.0-1009-aws You may need to install the following packages for this specific kernel: linux-tools-6.8.0-1009-aws-generic You may also want to install of the following package to keep up to date: linux-tools-generic The badly named linux-tools package in the suggestion above was filed as https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2073117 I installed apt-file, and searched the archive for "perf.cpython", and these were the only matches: linux-ibm-tools-6.8.0-1006: /usr/lib/python3/dist-packages/linux-ibm-tools-6.8.0-1006/perf.cpython-312-x86_64-linux-gnu.so linux-ibm-tools-6.8.0-1007: /usr/lib/python3/dist-packages/linux-ibm-tools-6.8.0-1007/perf.cpython-312-x86_64-linux-gnu.so linux-ibm-tools-6.8.0-1008: /usr/lib/python3/dist-packages/linux-ibm-tools-6.8.0-1008/perf.cpython-312-x86_64-linux-gnu.so linux-nvidia-lowlatency-tools-6.8.0-1009: /usr/lib/python3/dist-packages/linux-nvidia-lowlatency-tools-6.8.0-1009/perf.cpython-312-x86_64-linux-gnu.so linux-nvidia-tools-6.8.0-1007: /usr/lib/python3/dist-packages/linux-nvidia-tools-6.8.0-1007/perf.cpython-312-x86_64-linux-gnu.so linux-nvidia-tools-6.8.0-1008: /usr/lib/python3/dist-packages/linux-nvidia-tools-6.8.0-1008/perf.cpython-312-x86_64-linux-gnu.so linux-nvidia-tools-6.8.0-1009: /usr/lib/python3/dist-packages/linux-nvidia-tools-6.8.0-1009/perf.cpython-312-x86_64-linux-gnu.so linux-tools-6.8.0-35: /usr/lib/python3/dist-packages/linux-tools-6.8.0-35/perf.cpython-312-x86_64-linux-gnu.so linux-tools-6.8.0-36: /usr/lib/python3/dist-packages/linux-tools-6.8.0-36/perf.cpython-312-x86_64-linux-gnu.so linux-tools-6.8.0-38: /usr/lib/python3/dist-packages/linux-tools-6.8.0-38/perf.cpython-312-x86_64-linux-gnu.so So it looks like not all kernel flavors have the perf python module. This was checked on noble. ** Affects: linux (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2073121 Title: Not all linux-tools-<version> package flavors have the perf python module To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2073121/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs