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

Trying to compile a kernel results in "FAILED: load BTF from vmlinux: No such file or directory" #10299

Closed
1 of 2 tasks
ReneNyffenegger opened this issue Jul 16, 2023 · 4 comments

Comments

@ReneNyffenegger
Copy link

Windows Version

Microsoft Windows [Version 10.0.22621.1992]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Linux version 5.15.90.1-microsoft-standard-WSL2

Distro Version

Debian 11 (lsb_release is not available as command)

Other Software

No response

Repro Steps

git clone https://github.com/microsoft/WSL2-Linux-Kernel
cd WSL2-Linux-Kernel
cp Microsoft/config-wsl .config
make -j 4

Expected Behavior

The kernel would be built

Actual Behavior

The build process ends with the error message

FAILED: load BTF from vmlinux: No such file or directory

Diagnostic Logs

No response

@OneBlue
Copy link
Collaborator

OneBlue commented Jul 25, 2023

Thank you for reporting this @ReneNyffenegger. Do you see the same error by following the build instructions ?

$ sudo apt install build-essential flex bison dwarves libssl-dev libelf-dev
$ make KCONFIG_CONFIG=Microsoft/config-wsl

?

@ReneNyffenegger
Copy link
Author

ReneNyffenegger commented Jul 26, 2023

It turned out I had quite a few packages not installed: flex, bison, dwarves, libssl-dev and libelf-dev.

After installing them with the proposed sudo apt install... command and building it with make KCONFIG..., I got

/bin/sh: 1: bc: not found

after also nstalleding bc ...

sudo apt install -y bc

... the build went on without further problems (I did not yet try to install the new built kernel)

@OneBlue
Copy link
Collaborator

OneBlue commented Jul 26, 2023

Nice ! Thank you for confirming.

Closing since the issue is resolved.

@OneBlue OneBlue closed this as completed Jul 26, 2023
@okineadev
Copy link

okineadev commented Apr 24, 2024

I found the cause of the problem on Stack Exchange - https://unix.stackexchange.com/a/616479/608997

I ran into the same issue today, for me the issue was that pahole ran out of memory (peak memory usage of pahole was around 2.5GB).

In order to solve this problem, I removed the RAM limit in .wslconfig:

[wsl2]
# memory=3GB

After that I compiled the WSL kernel without any problems

You can learn more about .wslconfig and memory limits at this link- https://learn.microsoft.com/en-us/windows/wsl/wsl-config#main-wsl-settings

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

3 participants