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

WSL Distro missing after updating to windows 11 preview #7136

Closed
1 of 2 tasks
rouke-broersma opened this issue Jun 30, 2021 · 29 comments
Closed
1 of 2 tasks

WSL Distro missing after updating to windows 11 preview #7136

rouke-broersma opened this issue Jun 30, 2021 · 29 comments

Comments

@rouke-broersma
Copy link

Windows Build Number

Microsoft Windows [Version 10.0.22000.51]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

?

Distro Version

Ubuntu latest (windows store without version number)

Other Software

No response

Repro Steps

Update to windows 11 preview??

Expected Behavior

I expect my wsl to be exactly like I left it

Actual Behavior

No distro's were available.

After starting docker for desktop, docker distro's were available. However the ubuntu distro is still gone.

I can still find the folder and vhdx for Ubuntu in %LocalAppData%

Diagnostic Logs

No response

@therealkenc
Copy link
Collaborator

What is the output of wsl.exe -l -v.

@tunsco2010
Copy link

What is the output of wsl.exe -l -v.

Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore

I am having the same issue and I have not been able to resolve it.

@rouke-broersma
Copy link
Author

What is the output of wsl.exe -l -v.

Before starting docker the output was as @tunsco2010 says. After starting docker the output is as follows:

PS C:\WINDOWS\system32> wsl -l -v
  NAME                   STATE           VERSION
* docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2

So it looks like the docker distro's were also deleted and are recreated when I started docker for desktop.

The microsoft store does list Ubuntu as installed but I am hesitant to start Ubuntu through the windows store as I have read in another issue that this might cause a fresh install and thus data loss. Currently the vhdx still exists so I would prefer to avoid that.

@camfulton
Copy link

camfulton commented Jul 1, 2021

Same issue, I ran ubuntu as from the store and it seems to have wiped itself.

wsl.exe -l -v shows both of my installations but both appear to be fresh installations.

e; I have absolutely no idea what is going on but after leaving this comment and relaunching ubuntu again with the intention of grabbing all my projects off github again my data is back. I did nothing between the last launch and this most recent launch.

@rouke-broersma
Copy link
Author

@therealkenc anything I can do?

@Biswa96
Copy link

Biswa96 commented Jul 5, 2021

Probably it was deleted. Reinstall the distribution.

@rouke-broersma
Copy link
Author

The vhdx is right there still..

@Biswa96
Copy link

Biswa96 commented Jul 5, 2021

I am not sure if this is a good idea but this is what I would do as workaround in that situation:

  1. Move that vhdx to a different path in that same drive.
  2. Re-install/re-register that same distribution in that same path.
  3. Shutdown wsl.
  4. Move the old vhdx to the new vhdx path.

@craigloewen-msft
Copy link
Member

@rouke-broersma do you know what Windows build you upgrade from to this version? That would help us determine what could be going on here.

As well, could you please collect feedback via Feedback Hub and post the link here? (Your repro steps can just be you starting up WSL).

As for an immediate work around, I would recommend copying the vhdx's that you have to somewhere where you can access them and then it is possible to mount them into WSL to copy off any key info.

@rouke-broersma
Copy link
Author

@craigloewen-msft thank you, I actually did already check the vhdx and it includes all my files. I am currently trying to reinstall but I get this error:

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80070050
Error: 0x80070050 The file exists

I also can't delete the existing Ubuntu filesystem because it's locked by System even if I shutdown wsl with wsl --shutdown.

I upgraded from the latest Dev channel build available to me but I do not know which version that was. Can I find that anywhere?

I submitted the feeback hub item here: https://aka.ms/AAd4j4j

@craigloewen-msft
Copy link
Member

Filing the feedback hub item will help us check if we can see what build you upgraded from, so thanks for doing that!

As for getting you unblocked, I would recommend creating a copy of the VHD somewhere on your file system to make sure your files are safe.

Then if you run wsl -l -v do you see your WSL distro? Running wsl --unregister <DistroName> will completely delete your distro and all of its contents. As well if the files still persist then uninstalling and reinstalling the store app should help remove them completely. From there you should be able to reinstall, mount your old VHD and retrieve your files.

@rouke-broersma
Copy link
Author

I don't see the distro in wsl and I tried uninstalling from the store page but I couldn't find any way to do that. I'll try to uninstall through programs later, thank you for the suggestion.

@adrastogi
Copy link
Collaborator

@rouke-broersma thanks for the feedback item. I was able to confirm that your device upgraded from 21390. WSL keeps its distro registrations under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss, but during the upgrade, there was nothing found under this key for your user. So that's at least the cause of this behavior- but, I can't immediately tell why there was no data observed there originally.

@rouke-broersma
Copy link
Author

Can I fix that?

@Hebilicious
Copy link

Having the exact same issue here, just to be clear, @craigloewen-msft your official recommendation is to back-up the .vhdx, then to --unregister, re-install and remount ?
Is there another more elegant solution ?
This is my version history :
image

@rouke-broersma
Copy link
Author

@adrastogi based on your hints with the registry keys I recreated the registry items (by guessing) for my distro and it gets recognized by wsl and windows terminal now!

image

It's complaining that the vhdx is in use though. Which is also why I cannot delete or reinstall this distro, as the filesystem is in use by 'System'.

image

image

I recreated the registry like this:

image

@Biswa96
Copy link

Biswa96 commented Jul 8, 2021

It's complaining that the vhdx is in use though.

Run wsl --shutdown or wsl --terminate <Distro> to release that file usage.

@rouke-broersma
Copy link
Author

rouke-broersma commented Jul 8, 2021

@Biswa96 it was still in use by System even after shutdown of wsl. I said that somewhere above.

What I did do was: Mark vhdx as read-only and restart system. On restart unmark as read-only and voila! I am now in my wsl distro!

It's a bit broken though...

I login straight to root instead of to my configured user and I get this message:

An error occurred mounting one of your file systems. Please run 'dmesg' for more details.

Running dmesg gives me these errors:

[   30.541974] 9pnet_virtio: no channels available for device drvfs
[   32.337053] 9pnet_virtio: no channels available for device drvfsa

I can however switch to my normal user so I think something is not entirely correct in my registry settings. Probably need to set some default user in there.

I set the default user back to my normal user with ubuntu config --default-user <username>

@craigloewen-msft
Copy link
Member

craigloewen-msft commented Jul 8, 2021

Just to reiterate on this thread, please be careful accessing and modify files in AppData or in the registry. Modifying these files can lead to data loss or putting your WSL into a bad state!

I will also reiterate our official guidance here if you find yourself in a state where you still have a VHD in the AppData folder but it isn't being recognized:

  • Copy your VHD file to a safe place on your OS
    • This will save your files and conserve your data that's inside of your WSL distro
  • Remove the VHD file and uninstall your WSL distros using wsl --unregister and uninstalling the WSL distro applications
    • Warning make sure your files are backed up by following the tests above, using the --unregister command will delete all of your files and data inside of the WSL distro
  • Now that you are in a clean state, install a WSL distro and ensure that it works
  • Use wsl --mount to mount the saved VHD into WSL and retrieve your files

This approach minimizes the amount of 'surgery' you have to do here, such as swapping out live VHDs, or changing registry values.

@Hebilicious
Copy link

In case someone has the same issue, I ended-up rolling back to windows 10, and redid the update to 11 some days after, and it worked this time (no WSL issue whatsoever).

@licanhua
Copy link
Collaborator

licanhua commented Aug 4, 2021

@rouke-broersma and @Hebilicious When did you install the WSL2 before you download and install Windows 11 update, hours or days?
one suspicious is that Windows update was happening in the backend, and you were installing WSL distro at the that time too. Those data is lost if the distro is created after windows update migrated the reg keys.

@rouke-broersma
Copy link
Author

@licanhua months before

@licanhua
Copy link
Collaborator

licanhua commented Aug 5, 2021

Thanks to confirm that.

@doles
Copy link

doles commented Nov 18, 2021

I also have the same problem.

C:\WINDOWS\system32>wsl -l -v
Windows Subsystem for Linux has no installed distributions.

Here is my feedback: https://aka.ms/AAevw7q

It's a brand new laptop, which updated to Windows 11 after activation. It's fresh system, and the only command that I run was wsl --install. App store shows Ubuntu is installed, but it cannot be launched:


Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80070050
Error: 0x80070050 The file exists.

Press any key to continue...

@11Fred11
Copy link

11Fred11 commented Feb 7, 2022

I had the same issue on Windows 11.

Steps that helped me fix the issue:

  • Restart the LxssManager Service (Windows + R => Services.msc => LxssManager => restart)
  • Go to "Add or remove programs" and uninstall the Linux distribution you have issues with.
  • Follow the manual steps here

@OhMyGodNoah
Copy link

bash seems to work

@CJTC70
Copy link

CJTC70 commented Apr 9, 2022

I'm having the same issue in Windows Terminal:
WslRegisterDistribution failed with error: 0x80070050
Error: 0x80070050 The file exists.

I notice that I can get to the instance by running Powershell, then
wsl -d instance name

So this seems to be a windows terminal issue.
Does anyone know what file it is referring to???

@rationalthinker1
Copy link

rationalthinker1 commented Apr 9, 2022

Here's what I did to to get rid of this error.

  • I downloaded WinDirStat to see where the ext4 was stored, for me it was in C:\Users\{USERNAME}\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState. I looked at what folder had the highest storage size usage.
  • I saved that file in an external hard drive
  • I removed WSL from "Add or remove programs"
  • I reinstalled in again by typing wsl --install -d Ubuntu-20.04
  • I shutdown wsl after seeing that wsl is working by typing wsl --shutdown
  • I moved the backup ext4 back to the original folder
  • On Windows Terminal, I had to go to "Add or remove programs" and click on Windows Terminal setting, and click repair and reset to see Ubuntu back there again.

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

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

No branches or pull requests