microsoft / microsoft/WSL

simplify the creation of the vhdx image, and remove the need for sudo

Open
#13,648 4 comments 0 reactions 1 assignee View on GitHub

@chessturo is already working on this.

Since Nov 4, 2025.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

**Is your feature request related to a problem? Please describe.**
Using the loop device can be tricky or impossible in CI and you can perfectly create an ext4 image without it.

**Describe the solution you'd like**
Use the following code in the `README.me` and in `./Microsoft/scripts/gen_modules_vhdx.sh`

instead of :

```bash
# Create a blank image file of the right size
dd if=/dev/zero of="$tmp_dir/modules.img" bs=1024 count=$((modules_size / 1024))

# Set up fs and mount
lo_dev=$(losetup --find --show "$tmp_dir/modules.img")
mkfs -t ext4 "$lo_dev"
mkdir "$tmp_dir/modules_img"
mount "$lo_dev" "$tmp_dir/modules_img"
chmod a+rw "$tmp_dir/modules_img"

# Copy over the contents of $1
cp -r "$1/lib/modules/$2"/* "$tmp_dir/modules_img"
umount "$tmp_dir/modules_img"
````

just do :

```bash
mke2fs -L '' -d "$1/lib/modules/$2" -b 1024 -t ext4 $tmp_dir/modules.img $modules_size
```

**Describe alternatives you've considered**

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.