microsoft / WSL

Issues found on WSL

Home Page:https://docs.microsoft.com/windows/wsl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please support mounting NBD disks

joshtriplett opened this issue · comments

The Linux kernel supports Network Block Device (NBD) disks. I'd like to be able to mount such disks, containing any filesystem Linux supports, and access them from both Linux and Windows.

This is a capability easily available on a native Linux system, and it would be helpful to have the same capability on WSL2.

Please enable it. I use BUSE for testing block corruption, and this would be very helpful.

CONFIG_BLK_DEV_NBD=y needs to be set, so that needs to go in for nbd-client and nbd-server to work. I've manually put together a kernel so I can do this, but would really appreciate this to be out of the box.

I second this. Docker now uses WSL2 by default, and tools such as alpimager start to fail on Docker for Windows because nbd support is lacking.

This was going to be my way to get around wsl --mount limitation:

  • At this time, only entire disks can be attached to WSL 2, meaning that it's not possible to attach only a partition. Concretely, this means that it's not possible to use wsl --mount to read a partition on the boot device, because that device can't be detached from Windows.

I want to access my dual-boot linux /home partition

Am I now going to have to somehow map the partition as a file under windows and then use that via 9p + losetup?

Work-around in the meantime; build your own kernel: https://blog.dan.drown.org/replacing-the-wsl-kernel/

I've been building my own for a while now. This is about really enabling NBD out of the box; Same with EBPF; Would like both out of the box.

It ought the be practically the same as the Ubuntu kernel right out of the box.

I'm now stuck on accessing the windows NBD server from Ubuntu.

Any progress on this? Would be great to have CONFIG_BLK_DEV_NBD set to "y" by default!

You can compile and use your own Linux kernel in WSL2 with that config enabled.

Building a custom kernel has been mentioned multiple times in this issue, and people asking for this know that that's an option. It would be helpful to have NBD work out of the box.

Why is this not yet supported? Today i had to quickly verify a qcow2 image on a WD Passport disk (which only supports windows or mac), which is only mountable via nbd, and I couldn't do this, because WSL2 doesn't support this.

Just adding the annual +1 :)

I came here hoping to find, well, some movement of any kind on this since it's been open for 2 years 😞

I guess it's back to dual-booting or running Linux in a VM until Microsoft add some basic features that most Linux admins would love to see in WSL to prevent said dual booting &/or VMs.

It was nice knowing ya WSL, but you ain't quite what I'm looking for in a partner.

¯\_(ツ)_/¯

commented

Why does changing the default config file for building the wsl2 kernel take that long?

That setting works and it is handy for mounting qcow2 images quickly.

Why does changing the default config file for building the wsl2 kernel take that long?

If only the world 😒 worked this way, we'd all be in the year 3000 🚀

commented

If you are interested in having the latest kernel with nbd enabled and always updated to the latest release, you can get it from https://github.com/okibcn/WSL2-linux-kernel/releases/latest

I have added another configuration for enabling settings to run Anbox. The Zip includes all the 3 kernels and an installer/uninstaller. I created this for myself so I didn't have to manually build it after each update. I also created a scoop manifest to help me get it updated easily. Just search for wsl2kernel in scoop.sh.

It is sad Microsoft didn't have it enabled and I had to do this.

It is sad Microsoft didn't have it enabled and I had to do this.

We really just wish this is out of the box. I've tested this before. There is another chance we could
get NBD working with the new IO Uring code and there's a full userspace only implementation of the NBD
driver available. Anyway, this ticket is as good as dead now 😵

commented

It works quite well:
ses

This is it, it's absolutely doable - I presume this is your own from your GitHub repo linked above?

Ideally this should be implemented in the standard one so we don't have to go adding basic features into the kernel and then be responsible for manually upgrading every time a new one rolls out. Microsoft could easily enable this for use but for some reason, don't.

~# uname -a
Linux Drew-PC 5.15.79.1-microsoft-standard-WSL2 #1 SMP Wed Nov 23 01:01:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

~# ls /dev/nbd*
ls: cannot access '/dev/nbd*': No such file or directory`
``

commented

@drew-viles yes, it is my repo. I automated a workflow to build a new nbd version of the kernel as soon as official sources are released by Microsoft. I have been doing it manually before.
I can now mount qcow2 images with qemu-nbd in WSL without any issues and without having to manually compile the kernel.

It is just a setting, nothing complicated. Really, MS could enable this as it works with WSL without any side effects.