move-wsl icon indicating copy to clipboard operation
move-wsl copied to clipboard

The process cannot access the file because it is being used by another process

Open sisrfeng opened this issue 2 years ago • 8 comments

Describe the bug

After this: image

There was E:\wsl\ext4.vhdx When I issued wsl, a window flashed out and I could not get into ubuntu. I issued wsl --list --verbose and could find ubuntu, but its state was "stop".

Then I try wsl --unregister Ubuntu

Now wsl --list shows nothing, but E:\wsl\ext4.vhdx is still there. How can I use the E:\wsl\ext4.vhdx? I have important files in that ubuntu distro

In pwsh.exe:

PS C:\Users\MeMeMe> wsl --import Ubuntu E:\wsl E:\wsl\ext4.vhdx The process cannot access the file because it is being used by another process

sisrfeng avatar Jul 18 '22 12:07 sisrfeng

Was there no output by the script? Why did you run wsl --unregister Ubuntu? I don't think you can import ext4.vhdx only *.tar files

I would try to re-register the WSL distro via Registry.

pxlrbt avatar Jul 18 '22 14:07 pxlrbt

I think I tried to fix something like this in #32

SayakMukhopadhyay avatar Jul 18 '22 14:07 SayakMukhopadhyay

We don't know, as they didn't provide any logs or steps.

pxlrbt avatar Jul 18 '22 14:07 pxlrbt

Was there no output by the script? Why did you run wsl --unregister Ubuntu? I don't think you can import ext4.vhdx only *.tar files

I would try to re-register the WSL distro via Registry.

The output of move-wsl.ps1 is : Done!

Then I thought everything was OK, and wanted to start using my ubuntu. I issued wsl, then a window flashed out and I could not get into ubuntu.

I searched with keywords "wsl state stop", and found an issue in wsl official repo, and a comment adviced using wsl --unregister Ubuntu. Now I think that comment is misleading.

"re-register the WSL distro via Registry" Today I read https://github.com/microsoft/WSL/issues/4591#issuecomment-541293155 and here is my HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss: image

Should I do this and press OK now ? image

sisrfeng avatar Jul 19 '22 01:07 sisrfeng

Sorry, I am not on Windows anymore, so I cannot test. Either this or that: https://github.com/microsoft/WSL/issues/4591#issuecomment-653617982

pxlrbt avatar Jul 19 '22 07:07 pxlrbt

@sisrfeng please dont change registry settings without you knowing what they do or you trust the source. I will get back to you once I figure out the root cause for this.

SayakMukhopadhyay avatar Jul 19 '22 07:07 SayakMukhopadhyay

Hi, any update? Many thanks~

sisrfeng avatar Jul 23 '22 03:07 sisrfeng

Hi, @SayakMukhopadhyay, any update? Many thanks

sisrfeng avatar Sep 13 '22 09:09 sisrfeng