okibcn/wslcompact

wsl corrupted after compacted

electroboyz opened this issue · 6 comments

compacting was successful but wsl became corrupted, cant start it anymore
tried to mount manually but every attempt failed. be careful before running this thing.

wsl became corrupted

Not a specific WSL distro / disk?

If you get an unresponsive WSL experience and commands like wsl --shutdown no longer responds this isn't necessarily corruption. It can happen when the host filesystem runs out of disk space for example. If you free up disk-space it will still be unresponsive until you reboot the host system but can work again after that.

wslcompact is just providing a convenience for you, running the same commands you could do manually.


Since it's been 2 weeks, is WSL working for you now? Did you do anything specific to make it functional again? Or did you find that restarting your system resolved it like I mentioned?

My Ubuntu 22.04 image is also corrupted after using wslcompact, resizing 466551 MB to 190242 MB.

Starting WSL gives following error:

<3>WSL (12) ERROR: CreateProcessEntryCommon:370: getpwuid(1000) failed 0
<3>WSL (12) ERROR: CreateProcessEntryCommon:374: getpwuid(0) failed 0
#

wsl --shutdown works fine, but restarting make no difference.

i fixed it by using fsck, mount the corrupted vhdx on other linux

In my case, fsck and e2fsck was not able to recover my system since wslcompact somehow corrupted necessary system script files with meaningless @^@^ strings.

Use Optimize-VHD for now. Check microsoft/WSL#10244