WSL icon indicating copy to clipboard operation
WSL copied to clipboard

wsl command outputs "The system cannot find the file specified."

Open omdxp opened this issue 6 years ago β€’ 55 comments

Environment

Windows build number: 10.0.19592.0

Steps to reproduce

I was working on my Ubuntu with wsl but somehow now it's not running and the output of my PowerShell is as follows:

PS C:\WINDOWS\system32> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Stopped         2
PS C:\WINDOWS\system32> wsl -d Ubuntu
The system cannot find the file specified.

WSL logs: https://aka.ms/AA9maq4

Expected behavior

I was using Ubuntu distribution using WSL very often, but now it cannot even run.

Actual behavior

Somehow the distribution cannot run.

omdxp avatar Sep 11 '20 17:09 omdxp

Look like the log is empty.

could you please dir %systemroot%\system32\lxss\tools\kernel to check if kernel exits? If not, please install the kernel

licanhua avatar Sep 11 '20 19:09 licanhua

Look like the log is empty.

could you please dir %systemroot%\system32\lxss\tools\kernel to check if kernel exits? If not, please install the kernel

Here's the output:

C:\Users\asusi>dir %systemroot%\system32\lxss\tools\kernel
 Volume in drive C has no label.
 Volume Serial Number is 8005-36CF

 Directory of C:\WINDOWS\system32\lxss\tools

22/03/2020  23:29        60.754.360 kernel
               1 File(s)     60.754.360 bytes
               0 Dir(s)  15.577.899.008 bytes free

omdxp avatar Sep 11 '20 19:09 omdxp

Reinstalling the linux kernel and uninstalling other virtualization softwares(VirtualBox and VMware) solved it for me.

spashii avatar Sep 14 '20 15:09 spashii

Piggybacking on this as I'm seeing the same issue, however, spashii's success did not work for me. My WSL is dead. :(

Logs: https://aka.ms/AA9p6ej

  • The kernel exists, but I attempted a reinstallation
  • Removing VMware player did not solve the issue, and no other virtualization is active
  • Removing WSL from the features list, rebooting, adding it, rebooting did not solve it
  • Attempting to remove Hyper-V failed and rolled back, despite removing all other feature dependencies and removing the network interface from device manager.

nmelnick avatar Sep 17 '20 03:09 nmelnick

Piggybacking on this as I'm seeing the same issue, however, spashii's success did not work for me. My WSL is dead. :(

Logs: https://aka.ms/AA9p6ej

  • The kernel exists, but I attempted a reinstallation
  • Removing VMware player did not solve the issue, and no other virtualization is active
  • Removing WSL from the features list, rebooting, adding it, rebooting did not solve it
  • Attempting to remove Hyper-V failed and rolled back, despite removing all other feature dependencies and removing the network interface from device manager.

Honestly, it didn't work for me as well, now I'm not even working on WSL because of this issue. Why something great as WSL is full of bugs? πŸ˜‘πŸ˜£

omdxp avatar Sep 17 '20 17:09 omdxp

From Logs https://aka.ms/AA9p6ej, the error is from HcnCreateNetwork. Likely it's Hyper-V issue

licanhua avatar Sep 21 '20 21:09 licanhua

Thanks, @licanhua . It looks like my Windows installation had an issue configuring network adapters, and that was one of the reasons that Hyper-V wouldn't uninstall so I could refresh it. Creating a new virtual switch in the Hyper-V Manager also failed miserably. Naturally, I went through the normal Windows steps of using sfc and dism to attempt to restore my system, but both found no issues. I attempted to uninstall all of my network adapters, but they would give me a code 56 every time they reappeared, even brand new ones.. Once I uninstalled the drivers for them, my HID devices also became unable to do class configuration, which left me without a keyboard. Feeling both desperate and stupid, I grabbed the release preview ISO of the 20H2 release of Windows 10 and did an in place upgrade with my working mouse, and shockingly, I'm now up and running again with working network adapters, Hyper-V, and WSL.

Β―\(Β°_o)/Β―

nmelnick avatar Sep 22 '20 14:09 nmelnick

If your Windows is 19041.508(@nmelnick was hitting), I believe it's related to the known issue: kb4571756-breaks-hyper-v-synthetic-ethernet-port. You can check if windows\System32\VmSynthNic.dll exits or not, if not, follow above thread to workaround the problem.

licanhua avatar Sep 22 '20 20:09 licanhua

I'm facing the same issue, and I'm thinking of resetting windows, but on wsl I have really important files, can I somehow export files or something else?

sk0le avatar May 10 '21 20:05 sk0le

I'm facing the same issue, and I'm thinking of resetting windows, but on wsl I have really important files, can I somehow export files or something else?

Check if hyper-V is selected in Turn Windows features on or off

omdxp avatar May 10 '21 23:05 omdxp

I did fix my problem.

I was not able to run wsl2 anymore, and not able to convert wsl 1 to 2.

PS C:\Users\bap> wsl --set-version kali-linux 2

For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The system cannot find the file specified.

wsl was not able to pick up the kernel from .wslconfig, which did not exist anymore. https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig image

Nice improvement on wsl CLI @benhillis, @craigloewen-msft

bplasmeijer avatar Jul 01 '21 21:07 bplasmeijer

if you install linux wsl on another disk and the disk not connected.. error occured

MasturFYC avatar Aug 23 '21 05:08 MasturFYC

Still present. Using WSL preview.

Default Distribution: Ubuntu
Default Version: 2
WSL version: 0.48.2.0
Kernel version: 5.10.60.1
WSLg version: 1.0.29
Windows version: 10.0.22000.282

Since there are possibilities that VM software is involved here, I do remember installing and uninstalling virtualbox between a working WSL and now a broken WSL. However, I cannot confirm that because I did not find a way to bring WSL back up and try to reproduce the problem yet.


Edit: Tried disabling WSL and adding it back. No luck.


Edit: Tried uninstalling VMWare. No luck. Tried doing network reset from system Settings / Network & Internet / Advanced network settings / Network Reset. No luck at first, a bunch of Hyper-V adapters left behind. However, after letting it sit there over night, these Hyper-V adapters disappears and now I am able to successfully boot WSL. Now I have no Hyper-V adapters at all.

ziruizhuang avatar Nov 08 '21 09:11 ziruizhuang

I installed Ubuntu for VSL, from the Store, on Windows 11 some time ago and was using it happily. However, I messed up a node and npm upgrade inside Ubuntu and decided to uninstall and reinstall from the store. Uninstall and reinstall went smoothly, but now I get "The system cannot find the file specified" when I try to run Ubuntu in Terminal, and I'm thrown back into PowerShell. I haven't touched or opened Hyper-V between the uninstall and the reinstall of Ubuntu.

Jaifroid avatar Nov 10 '21 07:11 Jaifroid

OK, after uninstalling again, I noticed that there was still a profile for Ubuntu in Windows Terminal. So I went into Terminal and removed that profile. Then I rebooted the Windows machine for good measure, reinstalled Ubuntu from the store, and now it runs fine in Terminal. So at least one issue seems to be that uninstalling a WSL doesn't remove the corresponding profile in Terminal, which it should do.

Jaifroid avatar Nov 10 '21 07:11 Jaifroid

I'm also having this issue.

TylerJaacks avatar Dec 30 '21 02:12 TylerJaacks

I'm having the same issue, but it seems to be only a windows terminal issue. If I run the exact same command configured in the windows terminal profile directly in powershell, it works. vs code also can still connect to the wsl instance without problem.

I have no idea of the root cause because it just started happening today without having installed/uninstalled/reconfigured anything. Maybe something auto updated somewhere, who knows.

Update: it's the "starting directory" in the windows terminal profile, which was set to ~ (which never worked anyway, the shell always launched into some windows directory). Apparently windows terminal tries to access it as a windows path and doesn't find it.

LiterallyAClown avatar Feb 06 '22 13:02 LiterallyAClown

I also have had this issue after no installations/uninstallations/anything. Worked fine ~12 hours ago

image

Changing the directory from the default value fixed it, to %USERPROFILE%.

SamJoan avatar Feb 06 '22 19:02 SamJoan

I also have had this issue after no installations/uninstallations/anything. Worked fine ~12 hours ago

image

Changing the directory from the default value fixed it, to %USERPROFILE%.

Yep, I have the exact same error. I have had no recent updates installed, had Hyper-V installed for the longest time with a working WSL. Just went to update my distribution given the latest security updates for various distros, and got this error for Ubuntu. The default Starting directory is ~, but as @SamJoan points out, setting this to %USERPROFILE% allowed the distro to start. Then on a whim, I tried setting the Starting directory to /home/my-wsl-username and got the same error again. I don't think there's anything special about using %USERPROFILE%. Something is just broken in Windows Terminal when using a starting directory somewhere within the WSL distro. I'm fairly certain this is a Windows Terminal issue for two reasons:

  1. If I open the Ubunto WSL distribution from the start menu not using WT, but using the standard CMD host, it works just fine.
  2. Because I haven't had any Windows update in over a yearβ€”long story, but a Microsoft Windows Update in late 2019, and again two more times in early 2020 completely ERASED ALL my personal files (i.e. My Documents, Downloads, etc.) on my work laptop; so yeah, I haven't been updating!

HTH someone else out there. There's a bug for this in the Windows Terminal project here.

fourpastmidnight avatar Feb 14 '22 22:02 fourpastmidnight

I also have had this issue after no installations/uninstallations/anything. Worked fine ~12 hours ago

image

Changing the directory from the default value fixed it, to %USERPROFILE%.

Hey I am facing the same problem, how did you change the directory?

shraddha-sheshadri avatar Feb 22 '22 05:02 shraddha-sheshadri