Skip to content

Modules doesn't autoload on runtime after custom build with default .config-wsl on version 6.6.87.2-microsoft-standard-WSL2 #14002

@nunorfidalgo

Description

@nunorfidalgo

Windows Version

Microsoft Windows [Version 10.0.26100.7462]

WSL Version

2.6.3.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

6.6.87.2

Distro Version

Ubuntu 24.04.3 LTS

Other Software

No response

Repro Steps

Follow steps: https://learn.microsoft.com/en-us/community/content/wsl-user-msft-kernel-v6

1- Building the Microsoft Linux kernel v6.6.x

  1. Open a WSL terminal window and launch the distro of your choice (for example: Ubuntu)
  2. Clone the Microsoft Linux kernel repository from GitHub:
    git clone https://github.com/microsoft/WSL2-Linux-Kernel.git --depth=1 -b linux-msft-wsl-6.6.y
  3. Install the required packages to build the kernel: sudo apt update && sudo apt install build-essential flex bison libssl-dev libelf-dev bc python3 pahole cpio
  4. Change directory to the kernel source code: cd WSL2-Linux-Kernel
  5. Build the kernel: make -j$(nproc) KCONFIG_CONFIG=Microsoft/config-wsl
  6. Install the kernel modules and headers: sudo make modules_install headers_install
  7. Copy the kernel image to the Windows file system: cp arch/x86/boot/bzImage /mnt/c/
  8. Exit the WSL terminal window

2 - Installing the Microsoft Linux kernel v6.6.x

  1. Create or edit the file %USERPROFILE%.wslconfig with the following: [wsl2] kernel=C:\\bzImage
  2. Open a PowerShell terminal window as Administrator
  3. Stop the WSL instance: wsl --shutdown

3 - Using the Microsoft Linux kernel v6.6.x

  1. Open a WSL terminal window and launch the distro of your choice (for example: Ubuntu): uname -r
  2. You should see the following output: 6.6.x-WSL2-Microsoft

Expected Behavior

On a clean boot with kernel version 6.6.87.2-microsoft-standard-WSL2 the list of modules is this:
Module Size Used by
xfrm_user 49152 1
xfrm_algo 16384 1 xfrm_user
xt_set 20480 0
ip_set 49152 1 xt_set
xt_addrtype 12288 4
xt_CHECKSUM 12288 1
xt_MASQUERADE 16384 5
xt_conntrack 12288 3
ipt_REJECT 12288 2
nf_reject_ipv4 12288 1 ipt_REJECT
nft_compat 16384 15
intel_rapl_msr 16384 0
intel_rapl_common 32768 1 intel_rapl_msr
kvm_intel 356352 0
crc32c_intel 16384 0
battery 20480 0
ac 16384 0
kvm 970752 1 kvm_intel
irqbypass 12288 1 kvm
sch_fq_codel 16384 1
configfs 53248 1
autofs4 45056 0
br_netfilter 28672 0
bridge 282624 1 br_netfilter
stp 12288 1 bridge
llc 12288 2 bridge,stp
ip_tables 28672 0
tun 53248 0

Actual Behavior

On a clean boot with kernel version 6.6.87.2-microsoft-standard-WSL2+ the list of modules is this:
Module Size Used by
intel_rapl_msr 16384 0
intel_rapl_common 36864 1 intel_rapl_msr
kvm_intel 385024 0
crc32c_intel 16384 0
battery 24576 0
ac 16384 0
kvm 1183744 1 kvm_intel
irqbypass 12288 1 kvm
configfs 61440 1
ip_tables 32768 0
autofs4 53248 0

And then for some network stuff I need to work like bridge and qemu_br modules I have to load this list of modules manually or by script:
##############
#!/bin/bash
modules="
garp
8021q
tun
br_netfilter

kvm_intel
crc32c_intel
sch_fq_codel

ip_tables
nf_nat
nf_tables
nft_compat
ipt_REJECT
nf_reject_ipv4
ip_set
xt_set
xfrm_user

xt_addrtype
xt_conntrack
xt_MASQUERADE
xt_mark
xt_comment
xt_multiport
xt_CHECKSUM
"

for m in $modules; do
echo "Loading module: $m"
sudo modprobe $m
done
################

Another error is: extension masquerade revision 0 not supported, missing kernel module if proper module is not loaded.

Diagnostic Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions