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

Optimized kernel config for better general kernel support and saner defaults #176

Closed
wants to merge 6 commits into from
Closed

Conversation

WSLUser
Copy link

@WSLUser WSLUser commented Sep 1, 2020

This configuration was originally based on Clear Linux's kernel config options toned down for general kernel usage and enabled a number of scenarios some of which that are addressed in other simpler PRs. This should make it easier to troubleshoot the Hyper-V side for bringing support to some features. USBIP has been enabled as this is a known working scenario with use of extra software installed on both Windows and WSL2. Adds ExFAT, NTFS, and IPv6 support (still needs work on the VM side). This is part of the resolution to #114. attn: @craigloewen-msft and @sashalevin. Options not supported in 5.4 should be ignored during compilation.

Microsoft/config-wsl Outdated Show resolved Hide resolved
Add the option from #163 to config to optimize security.
@haosmos
Copy link

haosmos commented Oct 3, 2020

Hi!

I compiled a linux kernel based on your fork: https://github.com/WSLUser/WSL2-Linux-Kernel/tree/WSLUser-5.8.5-config and your config: https://github.com/WSLUser/WSL2-Linux-Kernel/blob/WSLUser-5.8.5-config/Microsoft/config-wsl.

but after I specified the path to the kernel in the .wslconfig file:

[wsl2]
kernel=C:\\Users\\haosmos\\vmlinux

my wsl 2 (ubuntu-20.04) does not start — no errors are displayed, not even any command-line characters in the terminal, — just a perfectly empty terminal screen.

I did the following steps to compile the kernel:

  1. I downloaded the sources from repo: https://github.com/WSLUser/WSL2-Linux-Kernel.git.

  2. Installed packages: sudo apt install git bc build-essential flex bison libssl-dev libelf-dev

  3. mv wsl-config WSL2-Linux-Kernel/arch/x86/configs/wsl_defconfig

  4. make wsl_defconfig

After running this command, a few messages were displayed saying that the file was overwritten, but at the end of the command, the message was displayed:

configuration written to .config

  1. make -j4

After that the compilation process started and was completed successfully: Kernel: arch/x86/boot/bzImage is ready (#1).

  1. cp vmlinux /mnt/c/Users/haosmos/

  2. in the .wslconfig file I specified:

[wsl2]
kernel=C:\\Users\\haosmos\\vmlinux

The standard kernel 4.19.128 works well.

My environment:

windows (x64) 2004
build: 20226
wsl2 (ubuntu-20.04)

@WSLUser
Copy link
Author

WSLUser commented Oct 3, 2020

I didn't update the kernel, just the config. Also you are supposed to cp the bzimage file and rename it how you like in the directory you copied to. https://wsl.dev/wsl2-kernel-zfs/ has instructions

@nikitalita
Copy link

Have you tested these? I don't seem to be able to boot after compiling this.

@WSLUser
Copy link
Author

WSLUser commented Oct 6, 2020

sigh. Follow directions I linked to. I use it just fine. I will soon update to the 5.8.14 release soon so for now you may have to answer some questions. I've also cut some stuff out to try and keep config_thermal from being re-enabled locally but haven't tested those changes yet.

Adds xt_recent module, needed for iptables -m recent ..., used by Kubernetes kube-proxy to implement Services with sessionAffinity: ClientIP
@chadbrewbaker
Copy link

chadbrewbaker commented Nov 15, 2020

Should https://gist.githubusercontent.com/kruxmeier/eb4becb7ba5c16192274f6fce3a47309/raw/1300aaa38916590455c87e663af9e2732f338090/fix%2520vmwp.bat be added in the Microsoft directory? Also, when compiling under Fedora33 I got a lot of thermal config questions. Nice if the README worked for both Debian and Fedora flavor distros. https://fedoramagazine.org/wsl-fedora-33/

At least on Fedora 33 to build perf, this patch is also needed: https://src.fedoraproject.org/rpms/kernel-tools/c/589a32b62f0c12516ab7b34e3dd30d450145bfa4?branch=master

./perf --version
perf version 5.4.20.g4acc5f40bad5

https://github.com/chadbrewbaker/ebpftalk/releases/tag/4acc5 if anybody wants to noodle on the binaries.

git status
HEAD detached at 4acc5f40bad5
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   Microsoft/config-wsl
        modified:   tools/perf/Makefile.config

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Microsoft/config-wsl.old
        kernel/config_data.h

git diff

@WSLUser
Copy link
Author

WSLUser commented Nov 15, 2020

I actually compile under Clear Linux but it uses the same packages as Fedora. I haven't been able to eliminate the thermal config options yet. There is a dependency re-enabling it. I already have a 5.9 config but was hoping to update the PR after fixing it. I'll probably just push it up for now in a day or two.

@WSLUser
Copy link
Author

WSLUser commented Apr 19, 2021

Likely going to need to close this PR to target the 5.10 branch. This config will now be workable just from cloning the repo if targeting the 5.10 branch (going to the Linux kernel website directly no longer needed).

@WSLUser
Copy link
Author

WSLUser commented Apr 22, 2021

Superceded by #245 which also targets the 5.10 branch.

@WSLUser WSLUser closed this Apr 22, 2021
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

Successfully merging this pull request may close these issues.

5 participants