Live data from Hacker News

WSL2 corrupting Git repositories and shell history

github.com

11–20 of 423 posts

Re: WSL2 corrupting Git repositories and shell history

#11
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!

It's very useful for projects that require (or work better in) a linux environment. I don't want to start up a full linux VM, that sounds like a lot of overhead and I'm more likely to not bother at all. WSL is much lighter than that (we're not talking virtualbox here), if I open windows terminal its up and running, there's almost-zero start up cost.

With VSCode I can switch between working in WSL and windows easily, without needing a desktop GUI to write code in. There's no startup cost, I'm immediately in the correct environment for that project. I've found it very useful since it came out.

Re: WSL2 corrupting Git repositories and shell history

#12
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 force them to install another OS on their personal laptops. WSL is nice in that it allows them to have a bit of Linux world without being very intrusive, and runs better than virtual machines on many of their laptops.

I'm what is called a "vacataire", which means I'm also not in the position of asking the school IT departement to enable stuff on the computers for the classes…

Re: WSL2 corrupting Git repositories and shell history

#13
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 chime in. The company I work for has (after being acquired by Accenture) implemented "Endpoint Management" for all machines (read monitoring and spyware).

EPM prohibits us from creating virtual machines, but WSL2 is possible. So a lot of devs at our shop (at least the 5% or so who are using WIN) use this setup.

Personally - I do this on my private machine - I switched, because with the EPM software I wanted to separate my work machine from my private efforts, as I just do not like Accenture to be able to read all mails, read all files and install arbitrary software on a machine that I have private data on. Before we got acquired my employer allowed private use, we were admins on the machines and there was no spyware installed - so only using one machine for work and private stuff was feasible.

Re: WSL2 corrupting Git repositories and shell history

#14
MS is ridiculous, corrupting the filesystem is an OS mistake of the first order. Any systems developer should view corruption of a persistent storage system of any kind as totally unacceptable. And in this case the whole filesystem is open source! Meanwhile the open source people built a decent NTFS driver for linux years ago, I haven't seen what specs are released but I assume they needed to fill a few doc gaps to make it happen.

Also other nice people did bundle up ext3 and ext4 into an app you could run on windows to browse and copy stuff from your linux partition years ago.

Now MS finally caves and accepts the defeat of linux being a better experience for devs, so they now 'support' it and can't check that saving files always works?!?

There is no way this only happens for bash history and git repos, some people have files they don't instantly throw on the cloud, or consider half-ephemeral like bash history, in this case you wouldn't be able to just re-clone as a workaround, I'll keep running my desktop linux on my dev machine (although it's not all rosey over there either, I trust it to save my files).

Re: WSL2 corrupting Git repositories and shell history

#16

MS is ridiculous, corrupting the filesystem is an OS mistake of the first order. Any systems developer should view corruption of a persistent storage system of any kind as totally unacceptable. And in this case the whole filesystem is open source! Meanwhile the open source people built a decent NTFS driver for linux years ago, I haven't seen what specs are released but I assume they needed to fill a few doc gaps to m…

This was reported back in August and unless the people commenting yesterday just haven't updated Windows in a while it still isn't fixed.

Re: WSL2 corrupting Git repositories and shell history

#17
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.

Wild guesses:

* the kernel is not properly shutdown (and sometimes some buffers are not flushed)

* the virtual block device and/or its linux driver has bugs

Re: WSL2 corrupting Git repositories and shell history

#18
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 used to do all work on Fedora, dual booting to Windows for the Windows apps. WSL was OK when I tried long back, so hadn't bothered. But for the last few months I was forced to try WSL (now WSL2) again due to some Windows work, and have been using the Ubuntu app. I've got to say I'm now a believer and don't scoff anymore. I can now do ALL my work without problems on WSL2: mainly Go/C++/Dart, containers (podman/buildah), Flutter, GRPC, etc. The added beauty is that you can go seamlessly between Windows and Linux apps: e.g., you can just run an .exe from the BASH command line in WSL2 just as you run an Linux command. It's insane how they did it, and you have to try it to experience it.

There are some issues still: GUI apps are still a pain to set up (but they're fixing this), there are some networking issues (e.g., accessing servers running on Linux), file path issues on some apps (like I guess git here), etc. I never personally experienced any of the git issues cited, and I use it regularly from the Ubuntu command line. Overall, I very highly recommend WSL2 now, Microsoft hit a home run with VSCode with devs and IMO WSL2 is turning out into another.

Re: WSL2 corrupting Git repositories and shell history

#19
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.

That's probably the cause.

WSL2 being Linux means that, unlike WSL1 which directly uses the host NTFS filesystem, it's probably using an emulated block device to hold its filesystem. If that emulated block device doesn't correctly honor write barrier requests from the Linux kernel, it could explain the corruption.

Re: WSL2 corrupting Git repositories and shell history

#20
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…

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

Likewise for WSL2.

I hope modern computers with a capable processor are all shipped with virtualization enable at firmware level, because Hyper-V can be used for tons of things in recent Windows.

Post reply on HN