When I wanted to run perf under WSL, I met the follow question:
WARNING: perf not found for kernel 4.4.0-18362
You may need to install the following packages for this specific kernel:
linux-tools-4.4.0-18362-Microsoft
linux-cloud-tools-4.4.0-18362-Microsoft
You may also want to install one of the following packages to keep up to date:
linux-tools-Microsoft
linux-cloud-tools-Microsoft
But I can't find packages called linux-tools-4.4.0-18362-Microsoft
or linux-cloud-tools-4.4.0-18362-Microsoft
. I guess the package names are generated automatically.
I also tried to use perf in docker container. However, docker container use the same kernel as the hosts.
Is there any method to run perf under WSL?
I heard that perf can be used in WSL2. But after I upgraded to WSL2, it shows the similar error message:
WARNING: perf not found for kernel 4.19.84-microsoft
You may need to install the following packages for this specific kernel:
linux-tools-4.19.84-microsoft-standard linux-cloud-tools-4.19.84-microsoft-standard
You may also want to install one of the following packages to keep up to date:
linux-tools-standard linux-cloud-tools-standard
For the case of WSL, the required Perf backend can only be installed on WSL 2.
What is WSL? Windows Subsystem for Linux (WSL) allows users to run a Linux terminal environment, install packages from the Ubuntu archive, and run Linux applications and workflows on Windows 10.
Check which version of WSL you are running You can list your installed Linux distributions and check the version of WSL each is set to by entering the command: wsl -l -v in PowerShell or Windows Command Prompt.
WARNING: perf not found for kernel 4.19.84-microsoft
Because WSL2 uses custom Linux kernel. Its source code can be found here microsoft/WSL2-Linux-Kernel. We have to compile perf tools from it.
sudo apt install build-essential flex bison libssl-dev libelf-dev
git clone --depth=1 https://github.com/microsoft/WSL2-Linux-Kernel.git
cd WSL2-Linux-Kernel/tools/perf
make
perf
executable file will be in that folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With