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

File being used by another process error #15

Open
da4089 opened this issue May 19, 2023 · 0 comments
Open

File being used by another process error #15

da4089 opened this issue May 19, 2023 · 0 comments

Comments

@da4089
Copy link

da4089 commented May 19, 2023

I'm getting the following error trying to compact my WSL:

C:\Users\darnold> wsl --shutdown
C:\Users\darnold> wslcompact -c Ubuntu
 WslCompact v8.7 2023.03.01
 (C) 2023 Oscar Lopez
 wslcompact -h for help. For more information visit: https://github.com/okibcn/wslcompact

 Distro's name:  Ubuntu
 Image file:     C:\Users\darnold\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
 Current size:   42943 MB
 Estimated size: 2609 +/- 64 MB
 The estimated process time using an SSD is about 1 minutes.
 NOTE: You can safely cancel at any time by pressing Ctrl-C
 Move-Item : The process cannot access the file because it is being used by another process.
At C:\Users\darnold\Documents\WindowsPowerShell\Modules\WslCompact\WslCompact.psm1:99 char:25
+ ...             Move-Item "$tmp_folder/ext4.vhdx" "$tmp_folder/$wsl_distr ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\darnol...mpact\ext4.vhdx:FileInfo) [Move-Item], IOException
    + FullyQualifiedErrorId : MoveFileInfoItemIOError,Microsoft.PowerShell.Commands.MoveItemCommand

Get-Item : Cannot find path 'C:\Users\darnold\AppData\Local\Temp\wslcompact\Ubuntu.vhdx' because it does not exist.
At C:\Users\darnold\Documents\WindowsPowerShell\Modules\WslCompact\WslCompact.psm1:101 char:35
+ ...       $size2 = (Get-Item -Path "$tmp_folder/$wsl_distro.vhdx").Length ...
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\darnol...act\Ubuntu.vhdx:String) [Get-Item], ItemNotFoundExcep
   tion
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

 New Image compacted from 42943 MB to 0 MB
 Do you want to apply changes and use the new image (y/N): n

C:\Users\darnold>

I tried a reboot, in case something might have been using WSL, but it made no difference.

Any suggestions appreciated!

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

1 participant