microsoft / microsoft/WSL

Not able to install kernel object using `insmod`

Open
#13,259 10 comments 0 reactions 0 assignees View on GitHub
kernel
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

10.0.26100.4652

### WSL Version

2.5.9.0

### Are you using WSL 1 or WSL 2?

- [x] WSL 2
- [ ] WSL 1

### Kernel Version

6.6.87.2

### Distro Version

Ubuntu 20.04 and Ubuntu 24.04

### Other Software

_No response_

### Repro Steps

1. To clone the repo:
```
git clone https://github.com/microsoft/WSL2-Linux-Kernel.git .
git checkout linux-msft-wsl-${KERNEL_VERSION}
```
2. To configure and build the kernel:
```
cp Microsoft/config-wsl .config
make olddefconfig
make modules_prepare
make -j$(nproc) modules
```
3. Insert any kernel object or build any custom kernel object and try inserting it
Ex: sudo insmod drivers/i2c/i2c-smbus.ko

Results in the error:
insmod: ERROR: could not insert module drivers/i2c/i2c-smbus.ko: Invalid module format

### Expected Behavior

Successful installation of kernel object same has to be listed in the /dev/

### Actual Behavior

Insmod result in following error:
insmod: ERROR: could not insert module drivers/i2c/i2c-smbus.ko: Invalid module format

in dmesg log says: disagrees about version of symbol module_layout

### Diagnostic Logs

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the reported build sequence using Microsoft/config-wsl and the linux-msft-wsl-${KERNEL_VERSION} checkout. Reproduce the module build for drivers/i2c/i2c-smbus. Compare the resulting module with the running kernel and dmesg output; done means identifying why module_layout disagrees and documenting or correcting the compatible build/load path.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, linux, ubuntu
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.