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

linux-msft-wsl-5.10.93.2 kernel fails to compile #8045

Closed
1 of 2 tasks
johnvranos opened this issue Feb 11, 2022 · 15 comments
Closed
1 of 2 tasks

linux-msft-wsl-5.10.93.2 kernel fails to compile #8045

johnvranos opened this issue Feb 11, 2022 · 15 comments

Comments

@johnvranos
Copy link

johnvranos commented Feb 11, 2022

Version

Microsoft Windows [Version 10.0.22000.493]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.60.1-microsoft-standard-WSL2

Distro Version

Ubuntu 21.10, installed in WSL 2, with Distrod (https://github.com/nullpo-head/wsl-distrod).

Other Software

No response

Repro Steps

The steps described in https://github.com/microsoft/WSL2-Linux-Kernel:

Build Instructions

Instructions for building an x86_64 WSL2 kernel with an Ubuntu distribution are as follows:

Install the build dependencies:
$ sudo apt install build-essential flex bison dwarves libssl-dev libelf-dev

Build the kernel using the WSL2 kernel configuration:
$ make KCONFIG_CONFIG=Microsoft/config-wsl

Expected Behavior

The kernel compiles successfully.

Actual Behavior

The kernel fails to compile with error:

make[2]: *** No rule to make target 'net/netfilter/xt_HL.o', needed by 'net/netfilter/built-in.a'. Stop.
make[1]: *** [scripts/Makefile.build:497: net/netfilter] Error 2
make: *** [Makefile:1822: net] Error 2

Diagnostic Logs

s

The image shows what is the error message.

@benhillis
Copy link
Member

@tyhicks - is something missing from the readme?

@tyhicks
Copy link
Collaborator

tyhicks commented Feb 11, 2022

I don't think so as I'm having no problems on Ubuntu 20.04 LTS.

@johnvranos are you patching the kernel or modifying the config?

@johnvranos
Copy link
Author

johnvranos commented Feb 11, 2022

No, I am not modifying the configuration and I do not patch the kernel.

I run:

tar -xf WSL2-Linux-Kernel-linux-msft-wsl-5.10.93.2.tar.gz

and then I run:

make KCONFIG_CONFIG=Microsoft/config-wsl

Then it asks one question:

KCSAN: dynamic data race detector (KCSAN) [N/y/?] (NEW)

where I press N

Then it continues with the compilation, and after some time the compilation produces the error.

@johnvranos
Copy link
Author

johnvranos commented Feb 11, 2022

I am trying to compile in Ubuntu 21.10, NOT in Ubuntu 20.04.

Now I am trying to compile the previous version of the kernel, 5.10.81.1.

I will let you know if it works.

@tyhicks
Copy link
Collaborator

tyhicks commented Feb 11, 2022

Could you run these commands and paste their results?

$ sha1sum net/netfilter/Makefile
$ grep NETFILTER_XT_TARGET_HL Microsoft/config-wsl

@johnvranos
Copy link
Author

johnvranos commented Feb 11, 2022

Could you run these commands and paste their results?

$ sha1sum net/netfilter/Makefile
$ grep NETFILTER_XT_TARGET_HL Microsoft/config-wsl

john@DESKTOP-3D1NDUV:/mnt/c/Users/John/Downloads/test$ sha1sum net/netfilter/Makefile
65a2b1bc090fa4924bf82186e2ebd3faafc006ef net/netfilter/Makefile
john@DESKTOP-3D1NDUV:/mnt/c/Users/John/Downloads/test$
john@DESKTOP-3D1NDUV:/mnt/c/Users/John/Downloads/test$
john@DESKTOP-3D1NDUV:/mnt/c/Users/John/Downloads/test$
john@DESKTOP-3D1NDUV:/mnt/c/Users/John/Downloads/test$ grep NETFILTER_XT_TARGET_HL Microsoft/config-wsl
CONFIG_NETFILTER_XT_TARGET_HL=y
john@DESKTOP-3D1NDUV:/mnt/c/Users/John/Downloads/test$

@johnvranos
Copy link
Author

johnvranos commented Feb 11, 2022

It is my first time I compiled the Linux kernel, do you know what is the name of the WSL 2 kernel image?

I can not find any file named vmlinuz, or bzimage, in the source code directories.

Thank you a lot.

@tyhicks
Copy link
Collaborator

tyhicks commented Feb 11, 2022

I'm a bit stumped. I don't have any problem building linux-msft-wsl-5.10.93.2, using the same commands that you listed in this issue, inside of a 21.10 LXD container. Everything works fine here.

@tyhicks
Copy link
Collaborator

tyhicks commented Feb 11, 2022

I can not find any file named vmlinuz, or bzimage, in the source code directories.

You should have a vmlinux file sitting in the top-level source directory.

@johnvranos
Copy link
Author

I'm a bit stumped. I don't have any problem building linux-msft-wsl-5.10.93.2, using the same commands that you listed in this issue, inside of a 21.10 LXD container. Everything works fine here.

I have Ubuntu 21.10 and Ubuntu MATE 21.10 as two virtual machines in Hyper-V, I will try to compile the latest WSL 2 kernel in the first one.

@johnvranos
Copy link
Author

johnvranos commented Feb 11, 2022

The official Ubuntu 21.10 desktop release I have in Hyper-V, is of low quality, I get dependency errors when I try to do:

sudo apt install build-essential flex bison dwarves libssl-dev libelf-dev

I will do more tests tomorrow.

@johnvranos
Copy link
Author

johnvranos commented Feb 12, 2022

Well, this is what I did today.

My OS is Windows 11 Pro.

  1. I installed Ubuntu-20.04 instance in WSL 2, with wsl --install -d Ubuntu-20.04.

  2. I installed Ubuntu 21.10 and 20.04 with Distrod.

https://github.com/nullpo-head/wsl-distrod

Distrod downloads and uses Linux distribution containers from linuxcontainers.org.

https://linuxcontainers.org

  1. I have various Linux virtual machines in Hyper-V. One of them is a Manjaro MATE virtual machine.

Manjaro is a rolling-release distribution, is based on Arch Linux, and has the latest available software in all categories.

All of the above have the latest updates installed.

In all WSL 2 distributions (cases 1. and 2.), I tried to compile WSL 2 kernel versions 5.10.81.1 and 5.10.93.2 (this is the most recent version).

In all cases, compilation failed (including Ubuntu-20.04 from Microsoft Store), for both versions of the kernel.

In the Manjaro MATE virtual machine (case 3.), I tried compiling the latest version of the kernel (version 5.10.93.2), and it succeeded.

Manjaro's success:

manjaro

Ubuntus' failures:

s1

s2

s3

s4

s5

I got the new compiled kernel I wanted, from the Manjaro virtual machine.

I do not know why the compilation fails in Ubuntu 20.04 and 21.10 WSL 2 instances.

@onomatopellan
Copy link

onomatopellan commented Feb 12, 2022

@johnvranos You are compiling the kernel in a /mnt/* folder which can be problematic due to filename case-insensibility. Better extract and compile the kernel in a /home/user/* linux folder instead.

@johnvranos
Copy link
Author

johnvranos commented Feb 12, 2022

@johnvranos You are compiling the kernel in a /mnt/* folder which can be problematic due to filename case-insensibility. Better extract and compile the kernel in a /home/user/* linux folder instead.

You are right!

I extracted to ~ (/home/john, in my case), and the compilation completed successfully, both in Ubuntu 21.10 (installed with Distrod), and Ubuntu-20.04 (installed from Microsoft Store).

s

Also the compilation was a lot faster, it took many hours previously.

So, I think the solution to this issue, is an additional instruction in the Build Instructions of https://github.com/microsoft/WSL2-Linux-Kernel, something like this:

If you are building the kernel in Windows WSL, do not build it in any /mnt subdirectory.

@drokka
Copy link

drokka commented Jan 30, 2024

I had the same build error re xt_HL.o target. I noticed the corresponding code file was xt_hl.c. So the default build rule failed.
I edited the Makefile replacing target xt_HL.o by xt_hl.o. It got past that target but failed on another xt_.o target.
Yes I am building on a /mnt directory due to limited C drive space. The file name case insensitivity may be impacting if the build is renaming source files? In any case this does seem like an avoidable build issue. I'll see if repeating gets me through the build...

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

5 participants