Live data from Hacker News

WSL2 corrupting Git repositories and shell history

github.com

21–30 of 423 posts

Re: WSL2 corrupting Git repositories and shell history

#21
post #3

I don't really understand the use case for WSL. What are the advantages? You could run a full Linux VM and do everything on it on any machine these days. Which is what I do, but I'm just an old school hack. Anyone who uses WSL care to enlighten me? Thanks!

I can pop open an Ubuntu tab in Microsoft Terminal and use *nix utilities as though they were made for Windows. For example: I could chain some scripts and commands together to process and produce reports on my Ableton Live sets without fussing with host extensions in a VM.

Re: WSL2 corrupting Git repositories and shell history

#22
post #4
post #2

More: - WSL2 sometime corrupt .zsh_history and git https://github.com/microsoft/WSL/issues/5026 - WSL2 corrupts ext4 filesystem https://github.com/microsoft/WSL/issues/5895

But why? WSL1 was something like wine but reverse, but WSL2 is actually linux.

The problem is likely not in the Ext4 code, but in the block I/O driver (which is Hyper-V specific, IIRC) or even in Hyper-V itself. Several reports mention Windows shutdowns, sleep or hibernation, so it may be a simple unclean shutdown of the VM.

A bigger problem would be if Hyper-V is either ignoring memory barriers, or caching writes to the disk and losing them when the Hyper-V service is shutdown. But that would likely affect more than just WSL, so we'd have seen the problem sooner (or so I vehemently hope).

Re: WSL2 corrupting Git repositories and shell history

#23
I think calling it WSL2 was a mistake.

The predecessor, WSL, "just worked" and it was more a less a linux experience for most practical purposes-- and certainly better than hoary old cygwin.

This caused a lot of people to believe they could just transition to WSL2, lead on by the promise of an even more performant linux experience. The documentation didn't say anything about complications from attempting this, so a lot of people just tried it as soon as they could, thinking it would go as smoothly as when they tried WSL. But nope... it many cases, it doesn't just work out of the box. There's network configuration and gateway issues, snags with vpn, and now this git repo corruption. When you look on git issues, it's just people randomly shot-gunning suggestions, some of which work, some of which don't. I think WSL2 was rushed out too early, or at least it's lacking a comprehensive troubleshooting guide to get it up and running.

Re: WSL2 corrupting Git repositories and shell history

#24
post #6
post #3

I don't really understand the use case for WSL. What are the advantages? You could run a full Linux VM and do everything on it on any machine these days. Which is what I do, but I'm just an old school hack. Anyone who uses WSL care to enlighten me? Thanks!

To sell Windows laptops to the same crowd that buys Apple laptops to develop GNU/Linux software, instead of supporting Linux OEMs, and are unhappy that Apple only cares about developers on Apple ecosystem. Microsoft understood that they only care about having some kind of POSIX support, and nowadays being Linux compatible is more relevant than straight POSIX, as the BSDs and IllumniOS also found out with their compat…

Or, alternatively, a crowd whose needs aren’t completely met by Linux.

Re: WSL2 corrupting Git repositories and shell history

#25
post #3

I don't really understand the use case for WSL. What are the advantages? You could run a full Linux VM and do everything on it on any machine these days. Which is what I do, but I'm just an old school hack. Anyone who uses WSL care to enlighten me? Thanks!

I use a mix of WSL2, and VMs. WSL2 has a few nice properties for some use cases:

a) It comes default with some network binding magic (ok, just configuration) that makes your WSL env almost actually behave like localhost. I know you can configure this yourself, but it's nice out of the box. (on the other hand, sometimes is this exactly the opposite of what you want...)

b) My main machine is a bit RAM constrained, and WSL2 will "magically" reclaim RAM when I close the consoles (unless I left something running...). Once again, not the biggest win, especially if you spec'd out your machine to run VMs, but still nice.

I think WSL2's biggest wins are not for 'full out development'. But it's nice when you need want to jump in and poke at something quickly in Linux land. The startup time for the console/VM is fast enough (~1-2 seconds), and the cleanup is good enough I can quickly jump between, without having a VM actually hanging around all the time.

I'm sure the file system integration is useful for some usecases... classic one would be if someone emails you data files or something. You download in your browser in Windows and then can access pretty seamlessly from WSL.

I think I would summarize WSL's advantages as being a bunch of little quality of life advantages that are very much suited for Windows dominant workflows that periodically jump into Linux.

There are all sorts of other disadvantages though - I would not recommend anyone who has a comfortable VM based workflow to ditch for WSL. An example of an uncomfortably stupid rough edge would be periodically time-desyncing: https://github.com/microsoft/WSL/issues/4149 . I shit you not, my workaround is to manually adjust my linux time forward and back with `sudo date --set "${INCREMENT} seconds" until it gets close enough that OAuth doesn't shit itself.

Re: WSL2 corrupting Git repositories and shell history

#26
post #3

I don't really understand the use case for WSL. What are the advantages? You could run a full Linux VM and do everything on it on any machine these days. Which is what I do, but I'm just an old school hack. Anyone who uses WSL care to enlighten me? Thanks!

I have been teaching computer related classes to uni students for some time. Most of them run Windows. Running a virtual machine often means accessing the UEFI to be sure they have virtualization extensions enabled. And many of them have shitty personal laptops, which means running a VM will really slow the "Linux" experience. Sharing files between the host and the guest is also sometimes tricky, and I don't want to…

unning a virtual machine often means accessing the UEFI to be sure they have virtualization extensions enabled

Note that this benefit applies to the deprecated WSL 1 only, WSL2 actually runs a VM underneath so it requires the same hoops that a VM would require.

Re: WSL2 corrupting Git repositories and shell history

#27

I think calling it WSL2 was a mistake. The predecessor, WSL, "just worked" and it was more a less a linux experience for most practical purposes-- and certainly better than hoary old cygwin. This caused a lot of people to believe they could just transition to WSL2, lead on by the promise of an even more performant linux experience. The documentation didn't say anything about complications from attempting this, so a l…

Same difference in my experience - WSL1 git screwed up git repos for me, broke git lfs, +++. I guess it’s more of the same-ish on WSL2, just different edge cases due to different edges.

Re: WSL2 corrupting Git repositories and shell history

#28

I think calling it WSL2 was a mistake. The predecessor, WSL, "just worked" and it was more a less a linux experience for most practical purposes-- and certainly better than hoary old cygwin. This caused a lot of people to believe they could just transition to WSL2, lead on by the promise of an even more performant linux experience. The documentation didn't say anything about complications from attempting this, so a l…

I agree. I tried wsl2, and while it's nice, it has issues wsl1 didn't have. For instance, networking almost never worked until I applied a common workaround of resetting the ip stack. Wsl1 always worked fine for that. It's just not ready for primetime yet.

Re: WSL2 corrupting Git repositories and shell history

#29
post #3

I don't really understand the use case for WSL. What are the advantages? You could run a full Linux VM and do everything on it on any machine these days. Which is what I do, but I'm just an old school hack. Anyone who uses WSL care to enlighten me? Thanks!

I do not use WSL but see a good reason for WSL. The benefits for the users are superficial but the really big thing is on the business side for Microsoft. With WSL they try to trap more and more Linux developers into their ecosystem. It is all about getting more control of the most talented and fruitful developer minds. In the end Microsoft and its shareholder will benefit if it keeps its hands on this crowd.

Re: WSL2 corrupting Git repositories and shell history

#30

I think calling it WSL2 was a mistake. The predecessor, WSL, "just worked" and it was more a less a linux experience for most practical purposes-- and certainly better than hoary old cygwin. This caused a lot of people to believe they could just transition to WSL2, lead on by the promise of an even more performant linux experience. The documentation didn't say anything about complications from attempting this, so a l…

File system corruption is unforgivable mistake, but FS work is really hard to get right. Even stuff like VMware corrupts shared folders ... wherever they try to bypass a driver translation layer. Just Google for “vmware shared folder corruption”
Post reply on HN