I'd like to use the perf tool on my 2016-02-09 Raspbian Jessie operating system. For that, I have installed the linux-tools package (which contains perf). The kernel version in use on that image is 4.1.17+.

The Linux kernel and it's tools need to have the same version:

root@raspberrypi:/home/pi# perf
/usr/bin/perf: line 24: exec: perf_4.1: not found
E: linux-tools-4.1 is not installed.

Unfortunately there is no 4.1 version for the linux-tools:

root@raspberrypi:/home/pi# aptitude search linux-tools
i   linux-tools                     - Performance analysis tools for Linux (meta
p   linux-tools-3.10                - Performance analysis tools for Linux 3.10 
p   linux-tools-3.12                - Performance analysis tools for Linux 3.12 
i A linux-tools-3.16                - Performance analysis tools for Linux 3.16 
p   linux-tools-3.18                - Performance analysis tools for Linux 3.18 
p   linux-tools-3.6                 - Performance analysis tools for Linux 3.6

Does anyone know how this is supposed to work?

  • See this thread: raspberrypi.org/forums/viewtopic.php?f=29&t=117547 It looks that there's no package for the new kernel yet, but in the thread you can find a link for the perf utility built by one of the users. – nsilent22 Feb 28 '16 at 18:48
  • Dropbox link is now dead, and any guides I can find online don't seem to work for actually compiling perf. – onaclov2000 Nov 15 '17 at 9:31

I was able to install the perf package using sudo apt-get install linux-perf-4.9. Use uname-r to find your kernel version, and apt-cache search linux-tools to find the proper package name.

  • 3
    That's cool, but there is no perf package built for the current kernel. – Matthias Urlichs Nov 15 '18 at 19:45
  • @MatthiasUrlichs: maybe try to update it to the latest kernel via sudo rpi-update. – jojek Feb 26 '19 at 16:55

I couldn't find good answer, this works for me and now

#sudo nano /usr/bin/perf

then change

#exec "perf_$version" "$@"
exec "perf_4.9" "$@"
  • 2
    There is a reason why perf enforces the version check, so one must understand the implications of faking the version number. For one, don't forget to mention this when asking about such problems as nobody will be able to reproduce them otherwise. – Dmitry Grigoryev Sep 26 '19 at 13:11

There's a potential workaround listed at https://github.com/RPi-Distro/repo/issues/159:

"the package found at https://packages.debian.org/buster/armhf/linux-perf-4.19/download seems like it might work."

  • The Debian package appeared to work for me on a Pi 3 but it does not work on a Pi Zero. – Chad Clark Jul 8 '20 at 17:19
  • 1
    Pi Zero is not armhf architecture, try Debian armel architecture instead. wiki.debian.org/RaspberryPi – mhansen Jul 15 '20 at 11:55

If perf coming with Raspbian is outdated, there's always the option to install a newer version from Debian repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.