-
Notifications
You must be signed in to change notification settings - Fork 816
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
WSL2 Register Command #4762
Comments
I like this idea, let me play with it a bit. |
It might also be cool if you could specify a UID to set the default user when doing this. |
@therealkenc the issue is I don't have the export like @rwilliams to import. How can I "import" from the existing ext4.vhdx file? |
You can create a registry entry for the vhdx though it's not recommended to mess with the registry. |
@synergies sent you an email. |
Thanks @rwilliams for the registry file! For anyone that runs into this issue, below is the registry file I used to "import" the existing ext4.vhdx to show up properly as a WSL distro:
Below are the items you need to update in the registry script above:
Hopefully this will help anyone stuck in a similar situation as myself. Good luck! |
@synergies Third time i lost my wsl due to a windows update (i guess) |
In my case, I just have to write the path without escaping... If I escape them I got an error of incorrect path or the one referenced here #4860 I check other distro installations in the same registry folder, and in the other, there was no escaping |
I've just done the same, had to to reset my PC because of DCOM errors. WSL was wiped however I still have the |
@Robula You can re-register the ext4.vhdx using the following #4762 (comment) , though this method is not officially supported. I don't believe there is a way to use the |
I've found this solution https://www.reddit.com/r/bashonubuntuonwindows/comments/gdiubo/wsl2_import_existing_ext4_image/ It says "Solved this by installing a new Ubuntu instance, removing its EXT4 image, and replacing with the EXT4 image from my old install." and it really worked for me rather than the script mentioned above. |
I struggle with this example. How exactly do you open the ext4.vdhx to then move the files over to the localstate. I am unable to find the new installations ext4.vdhx anywhere |
@Jirubizu I can't speak to the steps on the reddit link. However, the process I commented above worked for me. Did that not work for you? |
The escaping part is confusing because in the |
In case anyone else finds this page and has the same question as @Jirubizu... the "hard drives" for WSL distros will be a .vdhx if WSL version 2, but will be a regular directory of files if WSL version 1. So I'd posit that whoever said "Solved this by installing a new Ubuntu instance, removing its EXT4 image, ..." probably has their WSL set to version 2 by default. But on a freshly-installed Windows 10 (as of May 2022), the default is still version 1. So, do one of the following:
|
For newer come to here like me reinstall window 10 but keep files and you still have ext4.vhdx then you can go to register and make smt like this You can follow synergies answer above #4762 (comment) |
Thanks for this, kind of solved my issue.
|
I have error "Deny ACCESS", Any Solution for it? |
working with ubuntu 20.04.6 on Win 11 host and I didn't have any issue with everything that has been described here. I just replaced .vhdx backup and everything worked seamlessly. I just used the same distro, same name and password I was using on the previews installation. |
Command |
Indeed this is now possible via |
Is your feature request related to a problem? Please describe.
#4591 I recently refreshed Windows install after a hardware upgrade so my WSL distros were deleted from the registry but I still had the .vhdx files. I also exported my distro with the plan of importing it when I re-installed windows. When I tried to import with WSL2 as the default type I get #4530
after quite a few minutes has elapsed. I had to import as WSL1 and then convert to WSL2 after the import. It took ~2.5 hours for a 50gb image on a fast workstation. Even if the import worked directly with WSL2 the process is still very long.
Describe the solution you'd like
It would be nice if you could just run something like
WSL --register
with the same options as--import
(except it looks for a vhdx and not an archive) and have it properly register the distro image in the registry and do anything else that needs to be done. This would allow just backing up the vhdx directly without the need to use import and export.Describe alternatives you've considered
Right now import/export is terribly slow and maybe broken on WSL2 so I don't think it's a good alternative.
The text was updated successfully, but these errors were encountered: