'perf version not matching with my kernel version

I'm currently working on Raspberry pi zero. When i write:

perf --version

/usr/bin/perf: line 13: exec: perf_4.14: not found E: linux-perf-4.14 is not installed.

when i do:

sudo apt-get install linux-perf

Then:

linux-perf is already the newest version (4.9+80+deb9u4+rpi1)

0 upgraded, 0 newly installed, 0 to remove and 216 not upgraded.

sudo apt-get install perf_4.14

E: Unable to locate package perf_4.14

E: Couldn't find any package by glob

'perf_4.14' E: Couldn't find any package by regex 'perf_4.14'

sudo apt-get install linux-tools-common linux-base

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package linux-tools-common

sudo apt-get install linux-tools-$(uname -r)

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package linux-tools-4.14.79

E: Couldn't find any package by glob 'linux-tools-4.14.79'

E: Couldn't find any package by regex 'linux-tools-4.14.79'

Please help me in this!

Thanks



Solution 1:[1]

I encountered the same problem in the k8s pod environment.

Install perf in Debian GNU/Linux 10:

sudo apt install linux-perf

Tried to use perf, but reported an error:

:~/perf-tools$ sudo perf -h
/usr/bin/perf: line 13: exec: perf_5.4: not found
E: linux-perf-5.4 is not installed.

After research, I found that /usr/bin/perf used uname -r to get the linux kernel version of the host instead of the version of the container.

So I solved it by renaming it.

sudo cp /usr/bin/perf_4.19 /usr/bin/perf_5.4

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Xing Qu