microsoft / microsoft/WSL

Unable to use perf on WSL2 Ubuntu 20.04

Open
#10,734 5 comments 0 reactions 0 assignees View on GitHub
kconfig
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

Microsoft Windows [Version 10.0.22631.2506]

### WSL Version

1.2.5.0

### Are you using WSL 1 or WSL 2?

- [X] WSL 2
- [ ] WSL 1

### Kernel Version

5.15.90.1

### Distro Version

Ubuntu 20.04

### Other Software

`perf`

### Repro Steps

In terminal, run `perf -v`

### Expected Behavior

Information regarding the version of `perf` available on my system should be returned.

### Actual Behavior

I get the following error:

```
WARNING: perf not found for kernel 5.15.90.1-microsoft

You may need to install the following packages for this specific kernel:
linux-tools-5.15.90.1-microsoft-standard-WSL2
linux-cloud-tools-5.15.90.1-microsoft-standard-WSL2

You may also want to install one of the following packages to keep up to date:
linux-tools-standard-WSL2
linux-cloud-tools-standard-WSL2
```

### Diagnostic Logs

I installed `perf` using `sudo apt install linux-tools-generic`, and can see that it was installed to `/usr/lib/linux-tools/5.4.0-166-generic/perf` (although it seems to be the wrong version for my kernel).

I've also tried running `sudo apt install linux-tools-5.15.90.1-microsoft-standard-WSL2` and `sudo apt install linux-tools-standard-WSL2`, as directed by the warning mentioned above, but get the following errors:

```
E: Unable to locate package linux-tools-5.15.90.1-microsoft-standard-WSL2
E: Couldn't find any package by glob 'linux-tools-5.15.90.1-microsoft-standard-WSL2'
```
and
```
E: Unable to locate package linux-tools-standard-WSL2
```
respectively.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `perf -v` on WSL 2 with Ubuntu 20.04 and kernel 5.15.90.1-microsoft-standard-WSL2. Check how WSL handles the `linux-tools` package names and the installed `/usr/lib/linux-tools/5.4.0-166-generic/perf`. Done means identifying a supported way to provide or invoke a matching perf binary, with the reported package-install errors resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, ubuntu
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.