1

I have multiple WSL2 distributions of Linux running side-by-side.

I also have this particular Linux distribution that only comes in the form of a bootable USB drive. I can install that distribution on bare metal by booting from that USB drive. I only tried a BIOS (not UEFI) system.

The full contents of the USB drive is this:

Folder PATH listing for volume EFI-SYSTEM
Volume serial number is D779-97A5
D:\
├───efi
│   └───boot
│           bootx64.efi
│           bootia32.efi
│           grubx64.efi
│           grubia32.efi
│           grub.cfg
│
└───syslinux
        syslinux.cfg
        default.cfg
        usb.A.cfg
        root.A.cfg
        root.B.cfg
        README
        vmlinuz.A
        vmlinuz.B

Is it possible to install this Linux distribution in WLS2 from the content of the USB drive?

ixe013
  • 930
  • 9
  • 19
  • "Is it possible to install this Linux distribution in WLS2 from the content of the USB drive?" - No; While you can take literally any Linux kernel and make it into a WSL distribution, you must be the author of the kernel in question, to perform the necessary work required to do so. – Ramhound Aug 09 '22 at 03:11

1 Answers1

1

Perhaps. It's difficult to say without being able to examine it myself, but here's my guess based on the contents you show.

The full contents of the USB drive is

My guess is that this isn't the case. This appears to be a Syslinux bootloader, which is designed to boot from a FAT filesystem.

I think it's more likely that you are seeing only the bootloader partition of the drive that is formatted FAT (the only filesystem on the drive you can access directly in Windows). There's probably another partition that can only be read after the kernel is loaded by the bootloader, probably formatted with an ext-based filesystem that Windows can't see.

It's on that partition that you'll probably find the rootfs image payload that you could wsl --import into a new WSL distribution.

So you'll need some way of accessing the Linux filesystem on that drive. This could be done from Windows/WSL if you have Windows 11 (Update note: Can now be done on Windows 10 as well. See this answer for a different feature) using:

wsl --mount <DiskPath> --partition <PartitionNumber> --type <Filesystem>

See the Mounting a partitioned disk in the WSL --mount documentation for details.

If you can't run Windows 11, then you could probably access it through a Linux virtual machine on your system.

Once you have access to that partition, look for some type of rootfs image, perhaps in a tar.gz/tgz package. If you can find that, then you can copy it off to your Windows drive /mnt/c/... and then use wsl --import on it.

Now here's the big caveat. Most Linux images will work fine this way, but I have a suspicion based on some Googling of the filenames you provided that your installer may be Chrome/Chromium OS-based. I believe that Chrome OS, like WSL2, has its own kernel customizations. If that's the case, then I don't know how well it will run under the WSL kernel. I'd be curious (if it is Chrome OS-based) to hear whether it does or not.

NotTheDr01ds
  • 17,574
  • 4
  • 44
  • 81
  • 1
    It is ChromeOS Flex, indeed. My hope is that with WLS2 talking straight to the hypervisor, its hardware abstraction would make the OS work out of the box. I'll give it a shot and come back to you. – ixe013 Aug 09 '22 at 13:48
  • The drive looks like it is EFI-GPT. [This WSL bug](https://github.com/microsoft/WSL/issues/6011) prevents me from mounting the drive in WSL2, but I was able to browse it with [Christophe Grenier's testdisk for windows](https://www.cgsecurity.org/wiki/TestDisk). I found a "Linux filesys. data" partition (?) with a large file named `encrypted.block`, next to a 48 bytes file named `encrypted.key`. So I'll mark the question as answered, with a very detailled "No, you can't boot a WSL2 image from a USB stick". Thanks! – ixe013 Aug 18 '22 at 18:53