Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpftool can't run on Ubuntu@WSL2 #10069

Closed
1 of 2 tasks
inliquid opened this issue May 5, 2023 · 10 comments
Closed
1 of 2 tasks

bpftool can't run on Ubuntu@WSL2 #10069

inliquid opened this issue May 5, 2023 · 10 comments

Comments

@inliquid
Copy link

inliquid commented May 5, 2023

Windows Version

Version 10.0.22621.1555

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.90.1-microsoft-standard-WSL2

Distro Version

22.04

Other Software

No response

Repro Steps

  1. Run apt install linux-tools-common linux-tools-generic
  2. Run bpftool -V

Expected Behavior

bpftool printed its version

Actual Behavior

# bpftool -V
WARNING: bpftool 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

When trying to install any of above packages, apt returns an errors, such as:

# apt install linux-tools-standard-WSL2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package linux-tools-standard-WSL2

Diagnostic Logs

No response

@bobaoapae
Copy link

same problem here

@zaoying
Copy link

zaoying commented Jun 16, 2023

same problem here

I solved this problem by install bpftool manually.

git clone --recurse-submodules https://github.com/libbpf/bpftool.git
cd bpftool/src
sudo make install

@inliquid
Copy link
Author

I solved by adding a symlink with uname -r name in: /usr/lib/linux-tools:
изображение

There also has to be appropriate linux-tools-* package present.

@zaoying
Copy link

zaoying commented Jun 18, 2023

I solved by adding a symlink with uname -r name in: /usr/lib/linux-tools: изображение

There also has to be appropriate linux-tools-* package present.

you need to be more careful, because wsl has modify kernel to nat between windows localhost and linux localhost, struct ipdhr is different from the original one.

@inliquid
Copy link
Author

inliquid commented Jun 18, 2023

@zaoying yes, I'm aware. It works as I see, no issues so far in my scenarios. However, I did compile bpftrace from sources with WSL2 kernel headers, for the reason you highlighted.

Anyways, it's just a workaround.

@vincenzo-dip8
Copy link

Hi everyone, I'm trying to use your suggestions to get use of BPF, EBPF, or LinuxTC with WSL, but I'm still unable to use them. Can you help me to solve this? i will be very grateful if you can share the script to follow in a way to have your same scenario, and work also for me

@zaoying
Copy link

zaoying commented Sep 11, 2023

Would you like to share some logs?

@vincenzo-dip8
Copy link

yes, i obtain the same result of the starting of this issue report (even after trying different potential solutions):

bpftool -V

WARNING: bpftool 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

@vincenzo-dip8
Copy link

so, basically, I m trying to use LinuxTC, BPF e EPBF (and tools implementing them) on WSL2 on Windows. I m trying different code, different repositories, but they never work

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants