Score:0

Driver support for virtual installations

uy flag

This question was about installing F2FS, which is supported by Ubuntu via a module in the default kernel of version 22.04. However, it was discovered that the question pertained to a WSL2 installation, which uses a different kernel that does not appear to include F2FS support (which makes sense from my point of view).

When Ubuntu is virtualized, the hardware drivers of the host are used. Are some drivers, such as WiFi and filesystems, only supported in non-virtualized installations?

cn flag
"Are some drivers, such as WiFi and filesystems, only supported in non-virtualized installations?" Yes. Not a good question if all you want to know that ;)
Score:0
vn flag

In editing your question, I couldn't quite tell if you are asking about WSL2 specifically (based on the referenced question), or virtualized systems in general. The answer is slightly different for the two different environments.

Virtual machines

When running Ubuntu in a virtual machine (VM), Ubuntu's kernel is used. This means that any filesystems and drivers that are in the stock Ubuntu kernel are at least enabled. However, yes, the hardware itself may not be directly accessible, so the device driver may not be able to even access the device.

However, many VM systems offer some type of passthrough for certain hardware interfaces, such as USB. So it's typically going to be possible to access something like a flash drive "indirectly", without the need for additional configuration.

Likewise, a USB-based WiFi device can also be used, with most drivers already available in the Ubuntu kernel (or installable via module).

Some VM's support PCI passthrough for access to the graphics card (especially the GPU). On those systems, the GPU drivers can be installed and accessed directly.

WSL2

When running in WSL2, Ubuntu is not actually running in a virtual machine. It's running in a container running inside a VM. This is why the Ubuntu kernel (and it's built-in features and drivers) aren't actually used in WSL2.

WSL2 uses its own kernel. This kernel is:

  • Shared amongst all the distributions running in WSL2
  • Running in the "managed, host VM" (a Hyper-V VM) inside which the Ubuntu container is running.
  • A standard Linux kernel, with some specific optimizations for WSL2/Hyper-V
  • Open source (repo here)
  • Updated regularly from the upstream kernel.

Part of the optimization is that modules that aren't necessarily useful (or tested) inside the WSL2/Hyper-V environment may not be enabled, which is why you don't find F2F2 there by default.

That said, it's entirely possible to build your own kernel from the WSL2 sources and add in support for devices that you need, as long as those drivers can access the hardware in WSL2.

And, as with VM's, WSL2 offers:

  • USB passthrough, through USB/IP, that can allow hardware access to devices connected via USB.

    WiFi drivers can be used via this method for USB WiFi devices.

  • The ability to mount, create filesystems on, and access raw drives.

With this in mind, I did find this Hacker News comment that mentions that F2FS support works when compiled in. I don't have any details beyond that. It's possible that it was tested on a mounted drive, or it might have been a device accessed over USB/IP.

Note that WSL2 takes a bit of a different approach to GPU support. AFAIK, PCI passthrough isn't used. Instead, WSL2 makes use of the Windows GPU driver with a kernel mode driver that can communicate with the Windows driver.

Finally, keep in mind that it's rarely just one additional driver that has to be enabled in the WSL2 kernel for a new device to work. Often there are multiple dependencies that need to be enabled. The challenge can be in finding the right mix of modules.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.