News for hackers. Stuff that matters.
Re:WSL2 corrupting Git repositories and shell history by madeofpalk on Saturday January 02, 2021 @03:22PM (#25616117)
Opposite anecdata - I got a gaming PC and i migrated all my development to it and WSL(2) has been a godsend. VS Code has a "WSL Remote" mode that works really well (where a vscode server runs in Linux and the windows GUI access it "remotely"). I even use the Windows Github app for the occasional GUI-assisted commit, and apart from being slow its fine.

I've had only two problems with this set up:

- Occasionally VS Code Typescript features slow down, but it fixes itself a few days later (maybe after a restart). I presume this is due to the WSL Remote, but not certain.

- The occasional line endings snafu, but this is more of a tooling issue.

Re:WSL2 corrupting Git repositories and shell history by gavinray on Saturday January 02, 2021 @04:01PM (#25616483)
Also opposite anecdote, I switched from Pop!_OS to Windows after getting into music production recently as a hobby (MIDI controller driver software doesn't always play well, even with WINE-devel) after over a decade on Linux.

I expected to hate it, but I'm asking myself why I didn't do this sooner.

It's the same sort of scenario as before -- I have Windows running the games I occasionally play, and music stuff, and I do all of my code stuff in WSL2/Ubuntu.

But this way, I never have to fiddle with weird WINE patches or googling bugs, everything "just works". Asking myself why I didn't do this sooner to be honest.

I had one big complaint which is that copying files from Windows to WSL2 would create ".ZoneInfo" file copies of every file, that was downloaded from the web, but they patched this recently too.

With the support for Linux GUI apps that launched with Windows Insider Preview recently, I have a hard time making arguments against it now. The taste of crow is a little bitter, eh.

Linux + WINE/Proton basically felt like shittier, more bug-ridden Windows + WSL2. With the one notable exception that as an OS/host, Windows 10 "feels" a bit slower in general.

Re:WSL2 corrupting Git repositories and shell history by kalium-xyz on Saturday January 02, 2021 @05:57PM (#25617430)
I've recently come across the same issue with DAWs. Settled on having multiple machines and switching the drives if I need to reuse a workstation for something else. Most of the time you can dedicate cheap systems to specific utilizations, it will save you time and effort. e.g. There is no reason for your DAW machine to also be your gaming machine as the hardware requirements are pretty different.
Re:WSL2 corrupting Git repositories and shell history by qppo on Saturday January 02, 2021 @09:23PM (#25618747)
It seems fairly expensive to have different machines for gaming and music production/recording when the only substantial difference is relative investment into CPU and GPU cycles.
Re:WSL2 corrupting Git repositories and shell history by kalium-xyz on Monday January 04, 2021 @05:02AM (#25629405)
You dont need new computers for everything. Older machines are often super cheap and saving them from getting scrapped reduces ewaste.
Re:WSL2 corrupting Git repositories and shell history by iakov on Sunday January 03, 2021 @10:40AM (#25622345)
There is no reason to have multiple computers, apart from a laptop and workstation for people who need to be able to work on the go. Not only upfront cost, but license costs, update management, hardware replacement and finally disposal and recycling are piling up. I fail to see the upside, honestly.
Re:WSL2 corrupting Git repositories and shell history by bashwizard on Monday January 04, 2021 @03:23AM (#25628863)
When you're starting out making music having just one computer for everything is fine but once you've reached the point where you spend a lot of your time on it, it quickly becomes a no brainer to at least have a dedicated computer for just that. It's about putting yourself in a productive setting where you only focus on creating and you have minimal distractions.

Besides, a dedicated computer for music production has a low entry cost since you basically only need a decent amount of ram. My studio computer has an old i7, 32 GB ram and it doesn't even have a GPU and the price was less than $500 a few years ago. It's going to outlast my current gaming rig and probably my next one as well.

Re:WSL2 corrupting Git repositories and shell history by iakov on Monday January 04, 2021 @07:56AM (#25630694)
I'm making music for a few years, and for at least two years my Windows workstation has been the main piece of gear.

I totally get what you mean by productive setting. I achieve that with two user profiles - one for music (dark colors, only DAW and GuitarPro, no social networks or messengers), another for fun (brighter colors, steam and battlenet). It is a much cheaper - free! - than $500, and I get to save some space at home.

In the end different strokes for different folks I guess. If your setup works for you - keep it up!

Re:WSL2 corrupting Git repositories and shell history by nijaru on Saturday January 02, 2021 @05:52PM (#25617391)
I’ve always solved this issue by keeping windows on one drive and linux on another. It does have an upfront cost, but keeping my dev work / linux environment setup has always worked well for me. Lately I’ve thought of trying WSL, but I don’t see any real benefit over my current setup
Re:WSL2 corrupting Git repositories and shell history by kalium-xyz on Saturday January 02, 2021 @06:01PM (#25617447)
IMHO dedicated environments encourage mindsets specific to those environments thus make you more productive. Would not switch to not having them.
Re:WSL2 corrupting Git repositories and shell history by gavinray on Saturday January 02, 2021 @04:11PM (#25616576)
Oh you need to fucking disable Window's Defender though, or add exclusions for your Linux distro/WSL2 folder, because when installing "node_modules" it will attempt to do realtime scans for threat-protection which absolutely cripples the speed.

https://www.cicoria.com/improving-windows-subsystem-for-linu...

https://www.reddit.com/r/bashonubuntuonwindows/comments/eok7...

"I noticed a significant performance difference after adding exclusions to the Windows Defender. My Rails server and NPM installs sped up dramatically (I mean like 4x faster, no joke)."

Stupid.

Re:WSL2 corrupting Git repositories and shell history by ubercow13 on Saturday January 02, 2021 @04:29PM (#25616724)
This is nothing specific to WSL though, Windows has always had this problem. I expect there are many Windows developers who have no idea how much time they spend waiting for their code to be virus scanned every day.
Re:WSL2 corrupting Git repositories and shell history by glandium on Saturday January 02, 2021 @06:43PM (#25617797)
To give an idea how bad it is, building Firefox on a Threadripper 3970X on Windows takes slightly over 12 minutes if you don't disable Defender and somewhere around 7 minutes if you do.
Re:WSL2 corrupting Git repositories and shell history by samb1729 on Saturday January 02, 2021 @07:07PM (#25617973)
What a horrible amount of overhead. Why does Defender need to scan the contents of a bunch of non-executable files? I suspect the answer runs deep and is at least somewhat horrifying.
Re:WSL2 corrupting Git repositories and shell history by magicalhippo on Sunday January 03, 2021 @08:17AM (#25621601)
> Why does Defender need to scan the contents of a bunch of non-executable files?

While I agree the overhead is atrocious, buffer overflows and similar bugs can turn an "innocent" non-executable file into an executable, like this[1] JPEG file parser issue affecting a large number of applications using GDI+.

That said, I'd be surprised if it couldn't be smarter about this.

[1]: https://us-cert.cisa.gov/ncas/archives/alerts/TA04-260A

Re:WSL2 corrupting Git repositories and shell history by jan6 on Saturday January 02, 2021 @07:17PM (#25618045)
because windows has no concept of an executable bit, so a rename could make it runnable? or a benign looking program has a built-in interpreter run code from external file?
Re:WSL2 corrupting Git repositories and shell history by dataflow on Saturday January 02, 2021 @08:23PM (#25618452)
> windows has no concept of an executable bit

Sure it does. Execution is a permission you can set in the security tab.

> a rename could make it runnable

This is more likely why.

Re:WSL2 corrupting Git repositories and shell history by samb1729 on Sunday January 03, 2021 @04:02AM (#25620594)
> because windows has no concept of an executable bit, so a rename could make it runnable

This much I understand - but why can something so tightly integrated into the OS not instead intercept a file rename event and scan at that point?

I seem to be lacking sufficient information as to what specifically about Windows necessitates scanning everything on the filesystem when macOS and the various common Linux distros seem to do fine without it. It's not as if Windows is the only OS with interpreters, either.

Re:WSL2 corrupting Git repositories and shell history by mmis1000 on Saturday January 02, 2021 @07:21PM (#25618073)
Virus do abuse non executables like js, vbs, or whatever script file. Antivirus can't really know if it is the case without open it.
Re:WSL2 corrupting Git repositories and shell history by samb1729 on Sunday January 03, 2021 @04:11AM (#25620628)
What is it about Windows that makes this a problem where macOS and Linux seem to be fine? The same mechanisms exist in all three major operating systems, which is to say that technically any executable I choose to run on my computer can load a file and interpret it.

Is it really just that Windows users download and run random junk? It's been so long that I've seen a virus of any kind anywhere at all that I genuinely have no clue how people become infected with them or indeed whether it still really happens at all.

It certainly feels to me that the era of random toolbars and clearly visible desktop malware is over, but at the same time I live in a different bubble than in the past.

Re:WSL2 corrupting Git repositories and shell history by mkr-hn on Sunday January 03, 2021 @08:43AM (#25621706)
It's possible you don't see random toolbars and malware now because Defender works. Microsoft could be smarter and offer default exclusions for some things.
Re:WSL2 corrupting Git repositories and shell history by mmis1000 on Monday January 04, 2021 @01:46AM (#25628457)
But even file type that you think it is pretty safe (jpg, wav and some other media foramt) can abuse parser bug in viewers / explore.exe to result in code execution. And how do you prevent the malware just name its .js as .jpg and execute it with some interpreter? Some interpreters definitively don't care about file extensions.
Re:WSL2 corrupting Git repositories and shell history by Demiurge on Sunday January 03, 2021 @10:20AM (#25622227)
If that was the default, wouldn’t it be immediately exploited?
Re:WSL2 corrupting Git repositories and shell history by Shared404 on Monday January 04, 2021 @03:56AM (#25629017)
> I genuinely have no clue how people become infected with them or indeed whether it still really happens at all.

I'm a bit late to the conversation, but can confirm that yes, people do still get infected.

We almost always turn something up while doing virus scans at the repair shop I work at, and we mostly use off the shelf products, along with a couple other tricks.

Re:WSL2 corrupting Git repositories and shell history by 0x138d5 on Saturday January 02, 2021 @05:10PM (#25617034)
Some IDEs have started warning about this performance hit. IntelliJ + Gradle for example, but I'm guessing other Jetbrains products do the same.
Re:WSL2 corrupting Git repositories and shell history by Roritharr on Sunday January 03, 2021 @02:30AM (#25620229)
That's what made me aware of the problem. Now I need a comfortable gui for managing just those folders.
Re:WSL2 corrupting Git repositories and shell history by CamperBob2 on Saturday January 02, 2021 @08:00PM (#25618319)
Try "every compile." If you wonder why your .exe takes a couple of extra seconds to start up the first time you run it after a build, well, this is why.
Re:WSL2 corrupting Git repositories and shell history by searchableguy on Saturday January 02, 2021 @05:59PM (#25617440)
Tip: Add a separate SSD and format it as ext4. Mount it to wsl2 and do all your work there.

https://docs.microsoft.com/en-us/windows/wsl/wsl2-mount-disk

Currently, the mount is not automatic so you can make a startup.ps script and run it on start through group policy.

Re:WSL2 corrupting Git repositories and shell history by gavinray on Saturday January 02, 2021 @06:16PM (#25617581)
Ah this is a great tip, I will have to try this one -- thank you!
Re:WSL2 corrupting Git repositories and shell history by qwantim1 on Saturday January 02, 2021 @09:21PM (#25618744)
It may be a great tip but Windows users shouldn’t have to do this. Microsoft needs to fix their shit.
Re:WSL2 corrupting Git repositories and shell history by mst on Saturday January 02, 2021 @07:50PM (#25618254)
I see you this, and I raise you "the package repository I was mirroring contained an AV module that had a copy of EICAR in its test suite".

AAAAAAAAAAAAAAAAAAAAAAAAAAAARGH.

Re:WSL2 corrupting Git repositories and shell history by pwr22 on Sunday January 03, 2021 @01:15AM (#25619930)
Oh god yes, I know this pain!
Re:WSL2 corrupting Git repositories and shell history by BlueGh0st on Saturday January 02, 2021 @06:29PM (#25617694)
Thanks for this tip! I've already been running into Defender problems myself.

Defender kept trying to quarantine my Windows hosts file so I had to add it as an exception but then 3 weeks later it started doing the same to my WSL2 Ubuntu's unmodified hosts file.

I'm glad I opted for Ubuntu and manually installing tools that I need instead of using the Kali subsystem. I couldn't imagine the headache that'd have created.

Re:WSL2 corrupting Git repositories and shell history by lmz on Saturday January 02, 2021 @08:11PM (#25618378)
Surely this is only a problem if your files live in the Windows filesystem (i.e. inside /mnt/$drive on WSL2)? I can't imagine Windows Defender scanning inside a disk image (/home on WSL2).
Re:WSL2 corrupting Git repositories and shell history by aksss on Sunday January 03, 2021 @02:56PM (#25624642)
I was wondering about the same thing.
Re:WSL2 corrupting Git repositories and shell history by 29athrowaway on Sunday January 03, 2021 @12:53AM (#25619837)
Why do you even need a Windows workstation as a Ruby or Node developer? That doesn't make any sense.
Re:WSL2 corrupting Git repositories and shell history by foepys on Sunday January 03, 2021 @04:50AM (#25620781)
You don't need it but it's 1/3 the price of an Apple workstation and just runs with all hardware compared to Linux.

Plus, some people just like Windows and/or don't like macOS.

Re:WSL2 corrupting Git repositories and shell history by 29athrowaway on Sunday January 03, 2021 @05:15AM (#25620873)
> runs with all hardware compared to Linux.

No, it doesn't. Linux runs on more architectures than Windows. Linux supports a wider range of machine specs than Windows does. There has never been an operating system in human history having hardware support as vast Linux. The television in your living room might be running Linux. Your refrigerator might be running Linux. Your car might be running Linux. Linux is everywhere.

When it comes to hardware support for laptops, the choice of distro is important. Enterprise linux distros ship with ancient kernels and you do not want to install that on a laptop.

Most hardware compatibility issues come from WiFi cards, and there are solutions for that other than looking for a driver and installing it manually. You can tether WiFi from your phone, or you can get a USB WiFi adapter for like $5 on Amazon.

Re:WSL2 corrupting Git repositories and shell history by foepys on Sunday January 03, 2021 @05:34AM (#25620950)
Windows can run on ARM and x86(-64). Both are the widest used architectures for desktop computing. I don't want to develop on MIPS or Atmel.

> When it comes to hardware support for laptops, the choice of distro is important.

I don't care. I just want to develop my programs. Each minute I need to invest into searching for compatible hardware or drivers is costing me money or my free time.

I'm using Linux at home and on servers but for workstations I don't care for it, at all.

Re:WSL2 corrupting Git repositories and shell history by simonh on Monday January 04, 2021 @07:39AM (#25630544)
The question was specifically about workstations for Ruby and Node development. You're not going to do that on a refrigerator.
Re:WSL2 corrupting Git repositories and shell history by mmgutz on Saturday January 02, 2021 @09:02PM (#25618657)
I also work mainly from a gaming desktop PC.

WSL2 linux distros are not equal to bare metal linux distros. WSL2 Debian doesn't have systemd installed and what a fvckery it is trying to get it to work. That means sshd, docker, k3s don't work as expected on reboot. Some apps do not install properly becasue scripts expect systemd. Windows networking is PITA too just to do something simple like SSH into a WSL2 instance.

I don't get why deep Windows integration is so important. It's not something I would use on a production box. I just want Hyper-V to work like VMware and VirtualBox. As you say, VSCode remote makes it all seamless anyway.

I had to go back to VMware 15.5.2 (version before hyper-v layer) and disable hyper-v completely.

Re:WSL2 corrupting Git repositories and shell history by mkr-hn on Sunday January 03, 2021 @08:30AM (#25621654)
code . is some dark WSL magic that turned learning to develop on Windows from an endless headache to an intermittent headache. I always ran into some weird/inscrutable issue trying to follow tutorials with Windows ports of things.
Re:WSL2 corrupting Git repositories and shell history by waheoo on Saturday January 02, 2021 @07:27PM (#25618106)
I don't really know if you can call running a remote vs code setup on localhost as opposite anecdata.

Isn't that just more of the same bullshit hoop jumping?

Everytime I hear about how great someone's wsl setup is I roll my eyes because it inevitably involves some rediculously convoluted wrangling to the nth level for something that is relatively basic on native Linux.

And these people rarely have an excuse for why they prefer windows over say fedora which has been a better than windows windows experience since windows 8.

Edit, wow even this thread people are suggesting the most drastic of things, let's run an entirely separate hard drive, oh but you need to fiddle with startup scripts because it couldn't be automatic.

Re:WSL2 corrupting Git repositories and shell history by madeofpalk on Saturday January 02, 2021 @09:21PM (#25618741)
> Isn't that just more of the same bullshit hoop jumping?

But it’s not jumping through hoops? I just either run `code .` (like I did on macOS) or select recent folder from within VS Code. It all just works fairly well, identical to ‘natively’ within Windows (except the occasional ts slowdown I mentioned before).

> And these people rarely have an excuse for why they prefer windows

Not that anyone needs an ‘excuse’ for their personal preference, but I would actually prefer macOS. But I got a Windows PC to use software that only runs on Windows (games) and then the whole wfh thing happened and here we are. I’m not interested in rebooting between different operating systems when I switch tasks, especially when they overlap (developing for games).

Convince Bungie to port their game to macOS and I’ll buy a Mac Pro to be back home on a Mac full time :)

Re:WSL2 corrupting Git repositories and shell history by eyelidlessness on Saturday January 02, 2021 @09:39PM (#25618830)
> Not that anyone needs an ‘excuse’ for their personal preference

No kidding. But on this site I’ve been lectured about the “consequences” of my personal preferences (when they in no way make alternatives less viable) and told my conscious tradeoffs are actually ignorant of the things I’m trading off even after I explicitly stated them. Tech communities love to talk about choice and freedom and love to try to Jedi mind trick people out of it in the same breath.

Re:WSL2 corrupting Git repositories and shell history by aksss on Sunday January 03, 2021 @03:14PM (#25624820)
>> convoluted wrangling

With good humor, his describes my experience with Linux distros since I first started using them. Doing just about anything seems to require some convoluted wrangling. :)