Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> ...data loss bugs (!) in WSL2.

Mind going into this in more detail?



I've tried for ~1 year to like and use WSL2 on a daily basis (on two different systems none the less) because I already use Windows for other stuff, so might as well try it.

But they make it really hard to rely on. From random shutdowns, GPU unreliability to data corruption and performance differences with just using Linux directly, I had to move away from it and back to Linux because I felt like I slowly losing my mind troubleshooting these issues.

Latest issue was that the virtual disk file continued to grow beyond 500GB large while Linux still reported that it was just 20% full from the inside. So, reading about things, I gave optimize-vhd a try and boom, full disk file was corrupted.

So, gave it a try, hit a bunch of issues, left and not planning to touch it again until WSL3, and I'll be much more cautious then.


Ouch. I've been using ChromeOS more lately, and Windows less, and I'm really appreciating the Linux environment within ChromeOS. I haven't experience any of the issues you noted in this environment, but it does run as a container within a VM. As a result, the performance is not as good as bare metal, but it works rather well.


Damn. I’m only using WSL 1 if anything


Now part of the issue is probably that WSL would sometimes hang and zombify, and could only be restarted by restarting the computer (in fact it typically did this any time the laptop woke up from suspend). So I didn't always get to cleanly shut down WSL. Additionally, I didn't have choice of filesystem— all my WSL guests ran ext4.

The issue seemed to be that sometimes files which the guest believed were written to disk were not actually written to the VHD file backing it, or the VHD file's changes were not actually written back to the physical disk. So sometimes upon a reboot (or after `wsl --shutdown`, which doesn't attempt safe shutdown IIRC), I'd lose files.

Generally it was only system files, and was recoverable by mounting the VHD for the guest to a new guest and repairing the OS in the worst cases, but sometimes did render the guest unbootable.

When I Googled the issue, I found people reporting similar problems on GitHub and Reddit going back years. On bare metal, the same distro I was running features atomic upgrades (on all filesystems), has survived power outages during system upgrades, etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: