Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support mounting NBD disks #5968

Open
joshtriplett opened this issue Sep 22, 2020 · 21 comments
Open

Please support mounting NBD disks #5968

joshtriplett opened this issue Sep 22, 2020 · 21 comments
Labels
feature kconfig linux kernel configuration

Comments

@joshtriplett
Copy link

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.

@therealkenc therealkenc added the kconfig linux kernel configuration label Sep 22, 2020
@guilt
Copy link

guilt commented Oct 9, 2020

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.

@pojntfx
Copy link

pojntfx commented Oct 22, 2020

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.

@samliddicott
Copy link

samliddicott commented May 28, 2021

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?

@samliddicott
Copy link

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

@guilt
Copy link

guilt commented May 28, 2021

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.

@samliddicott
Copy link

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.

@NathanNZ
Copy link

NathanNZ commented Sep 2, 2021

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

@Biswa96
Copy link

Biswa96 commented Sep 2, 2021

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

@joshtriplett
Copy link
Author

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.

@samliddicott
Copy link

samliddicott commented Sep 2, 2021 via email

@ShadowJonathan
Copy link

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.

@matt-psaltis
Copy link

Just adding the annual +1 :)

@drew-viles
Copy link

drew-viles commented Oct 11, 2022

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.

¯\_(ツ)_/¯

@okibcn
Copy link

okibcn commented Feb 20, 2023

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.

@guilt
Copy link

guilt commented Feb 20, 2023

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 🚀

@okibcn
Copy link

okibcn commented Feb 22, 2023

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.

@guilt
Copy link

guilt commented Feb 22, 2023

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 😵

@okibcn
Copy link

okibcn commented Feb 22, 2023

It works quite well:
ses

@drew-viles
Copy link

drew-viles commented Feb 22, 2023

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`
``

@okibcn
Copy link

okibcn commented Feb 22, 2023

@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.

@jonylentzmc
Copy link

Anual Bump to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature kconfig linux kernel configuration
Projects
None yet
Development

No branches or pull requests