2

I've just formatted my PC and tried to reinstall my Debian distro.

Before formatting, I ran wsl --export to get a TAR file for Debian. After installing Windows again, I enabled WSL in the Option Features GUI, rebooted, and then ran wsl --import.

Now, it seems like the imported distro isn't properly recognised.

PS C:\Users\username> wsl -l -v
  NAME                   STATE           VERSION
* Debain                 Stopped         2
  docker-desktop-data    Stopped         2
  docker-desktop         Running         2
PS C:\Users\username> wsl --unregister debian
Unregistering.
There is no distribution with the supplied name.
Error code: Wsl/Service/WSL_E_DISTRO_NOT_FOUND
PS C:\Users\username> wsl --unregister Debian
Unregistering.
There is no distribution with the supplied name.
Error code: Wsl/Service/WSL_E_DISTRO_NOT_FOUND
PS C:\Users\username> wsl
Failed to attach disk 'E:\vm\wsl\debian\ext4.vhdx' to WSL2: The system cannot find the path specified.
Error code: Wsl/Service/CreateInstance/MountVhd/ERROR_PATH_NOT_FOUND

I've tried rebooting Windows in between too. I've also tried just unchecking the WSL box in Optional Features, rebooting Windows, rechecking it, and then rebooting Windows again. Nothing helps.

System info (ThinkPad E14, Gen 4):

Device name [REDACTED]
Processor   12th Gen Intel(R) Core(TM) i7-1260P   2.10 GHz
Installed RAM   24.0 GB (23.7 GB usable)
Device ID   [REDACTED]
Product ID  [REDACTED]
System type 64-bit operating system, x64-based processor
Pen and touch   No pen or touch input is available for this display
Edition Windows 11 Pro
Version 22H2
Installed on    ‎12/‎02/‎2023
OS build    22621.1105
Experience  Windows Feature Experience Pack 1000.22638.1000.0
9
  • 2
    Uhm because your WSL name is "Debain"?
    – Tom Yan
    Feb 12, 2023 at 19:47
  • @TomYan: He tried both names.
    – harrymc
    Feb 12, 2023 at 20:12
  • @eccentricOrange: Try running PowerShell as Administrator. If it still happens, try using a Command Prompt (cmd) as Administrator.
    – harrymc
    Feb 12, 2023 at 20:13
  • @harrymc No, he tried Debian and debian, not "Debain"
    – Tom Yan
    Feb 13, 2023 at 0:53
  • 1
    @eccentricOrange I was talking about misspelling.
    – Tom Yan
    Feb 13, 2023 at 7:42

1 Answer 1

1

While (from the comments) the problem in this case turned out to be a misspelling of "Debian" (as "Debain") when using wsl --import, I'm going to point out that this was a good accident.

In general, I recommend not using wsl --import with a WSL distribution named Debian, or any "stock" name that might be used by an existing distribution that can be installed from the Store (i.e. "ubuntu", "ubuntu-22.04", "Kali-Linux", "Alpine", etc.).

The "Debian"-named distribution should be reserved for the one actually created by the Debian installer (which is based on a common WSL-distro-launcher reference implementation). This distribution has a few key differences from an --imported distro:

  • There are additional registry keys which are automatically generated by the installer.
  • The installer (and uninstaller, in previous releases) fixes the location of the distribution in the C:\Users\<username>\AppData\Local\Packages\<PackageName> directory.
  • The installer application creates some additional metadata in that package folder.

While the reference distro-launcher may handle the corner case of a "distro-launcher-distro" being where it isn't "expected" to be, I believe it's safer to use a different distro name when wsl --importing.

For instance, I preface my user-distros with ntd_ (for NotTheDr01ds), so my "working" Ubuntu is called:

ntd_Ubuntu_22.04_WSL2

This also means that I can spin up a temporary "distro-launcher" version of Ubuntu 22.04 simply by running:

ubuntu2204.exe

I can use it as a test for some new software or configuration, then I can "throw it away" when done with wsl --unregister ....

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .