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

Compact failed #14

Open
Robula opened this issue May 9, 2023 · 2 comments
Open

Compact failed #14

Robula opened this issue May 9, 2023 · 2 comments

Comments

@Robula
Copy link

Robula commented May 9, 2023

Problem with the final copy commands:

Move-Item: An object at the specified path C:\Users\RD2A7~1.FIN does not exist.
Get-Item: Cannot find path 'C:\Users\RD2A7~1.FIN\AppData\Local\Temp\wslcompact\Ubuntu.vhdx' because it does not exist.

Full output:

wslcompact -c 
 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\Robula\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
 Current size:   69524 MB
 Estimated size: 43648 +/- 1065 MB
 The estimated process time using an SSD is about 11 minutes.
 NOTE: You can safely cancel at any time by pressing Ctrl-C
 Import in progress, this may take a few minutes.
The operation completed successfully.
Move-Item: An object at the specified path C:\Users\RD2A7~1.FIN does not exist.
Get-Item: Cannot find path 'C:\Users\RD2A7~1.FIN\AppData\Local\Temp\wslcompact\Ubuntu.vhdx' because it does not exist.
 New Image compacted from 69524 MB to 0 MB
 Do you want to apply changes and use the new image (y/N): n

Here is my $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.4
PSEdition                      Core
GitCommitId                    7.3.4
OS                             Microsoft Windows 10.0.23430
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@okibcn
Copy link
Owner

okibcn commented May 9, 2023

It is quite interesting that the local temp file is not C:\Users\Robula\AppData\Local\Temp\wslcompact\Ubuntu.vhdx

It seems that your temp folder is not under your user folder tree. wslcompact uses the TEMP variable. Can you check it by typing this in powershell:

ls env:T*

In normal conditions it should return something like:

Name                           Value
----                           -----
TMP                            C:\Users\Username\AppData\Local\Temp
TEMP                           C:\Users\Username\AppData\Local\Temp

I don't know what could be happening in your system, a virus, a software changing the temp folder, or an unknown problem with your Windows 11. The command above could bring some light on this issue.

@lachiewalker
Copy link

I have been having the same problem (when trying to compact my docker-desktop-data data image). I have successfully compacted this image before, however, I now cannot get past the above messages. I have tried:

  • wsl --shutdown prior to wslcompact
  • running wslcompact immediately after startup (wsl does not open at startup on my machine)
  • changing TMP and TEMP locations to a different drive (external HDD)
  • Editing the wslcompact code to run line 100 (wsl --unregister wslcompact | Out-Null) before line 99 (Move-Item...)
  • Further editing the above to run wsl --shutdown and a 5 second sleep, after the unregister command, before attempting Move-Item...

Every time I got the same pair of errors: Move-Item... failed, causing line 101 $size2 = (Get-Item... to fail.

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

3 participants