WSL icon indicating copy to clipboard operation
WSL copied to clipboard

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

Open eburghard opened this issue 2 months ago • 4 comments

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 :

# 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 :

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.

eburghard avatar Oct 29 '25 16:10 eburghard

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions in Collect WSL logs for networking issues

Once completed please upload the output files to this GitHub issue.

See Collect WSL logs (recommended method).

If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

github-actions[bot] avatar Oct 29 '25 16:10 github-actions[bot]

/feature

eburghard avatar Oct 29 '25 16:10 eburghard

Diagnostic information
Found '/feature', adding tag 'feature'

github-actions[bot] avatar Oct 29 '25 16:10 github-actions[bot]

cc @chessturo Thoughts?

sirredbeard avatar Nov 03 '25 18:11 sirredbeard