News for hackers. Stuff that matters.
Re:Docker for Mac M1 RC by 600frogs on Friday March 19, 2021 @07:22AM (#26512048)
I'm definitely interested in WSL for developing, but last time I tried it a while back (WSL2 just came out I think), there was basic functionality missing e.g. I couldn't write and run my own SystemD services. Has the situation improved since then?

When you say "proper Linux distribution", I assume that's still CLI only? Do you develop with e.g. emacs, vim on WSL, or do you have some IDE with remote running and debugging into WSL? Or have a missed a trick and in fact X/Wayland applications can be run on WSL?

Re:Docker for Mac M1 RC by e12e on Friday March 19, 2021 @08:19AM (#26512407)
> still CLI only?

With openssh in windows, it's been quite easy to run an x server in windows, and use ssh with x forward for gui access.

But rdp feels more native to windows, and both x and Wayland has rdp server backends - so you can do things like: https://www.nextofwindows.com/how-to-enable-wsl2-ubuntu-gui-...

But apparently ms is working on a Wayland compositor allowing directly running gui apps - I don't think it's quite there yet:

https://www.phoronix.com/scan.php?page=news_item&px=Microsof...

https://github.com/Microsoft/WSL/issues/938#issuecomment-763...

Somewhat related: https://ltsp.org/ I'm not sure about the state of a non-x rdp server for thin clients though.

Re:Docker for Mac M1 RC by 600frogs on Friday March 19, 2021 @10:11AM (#26513533)
Thanks for the links, some interesting stuff there! I think my end goal is to have a contained development environment whilst not being forced to use specific tools (i.e. VSCode remote debugging, eugh) and not sacrificing compilation times by running in a VM that's too slow.

From the look of it, if I were to set up the WSL2 Ubuntu GUI with RDP, that'd tick all the boxes, right? And as a bonus I'd be able to access files in WSL2 from Windows.

Any idea how WSL2 interacts with VPNs? I've seen some mixed reports around the web but this is also a must-have for me, if I can't use a VPN in my dev environment it's game over.

Re:Docker for Mac M1 RC by running101 on Friday March 19, 2021 @01:54PM (#26516347)
I have it working with vpn. We have vpn at work and it is forced tunneling mode. It modifies routes on my laptop. Since wsl2 is a vm on a different network the vpn client does not know about this network and doesn’t know how to route traffic. If you follows these instructions it solves the problem https://github.com/sakai135/wsl-vpnkit
Re:Docker for Mac M1 RC by hazaskull on Friday March 19, 2021 @12:24PM (#26515218)
YMMV but for me personally with Dell Sonicwall it basically does not work (even workarounds that mess with MTU sizes are unstable). In my case the behavior is that general networking speed drops massively as soon as both VPN and WSL2 are active. I had to revert back to virtualbox, which does not have such problems and as a bonus allows me to run proper systemd (another thing missing in wsl)
Re:Docker for Mac M1 RC by 600frogs on Friday March 19, 2021 @12:44PM (#26515486)
Interesting, that might be a dealbreaker then. Have you found significant slowdowns in working in a VM vs native, both in terms of compilation and day-to-day work, or has it been negligible/unnoticeable?

P.S. thanks for making an account just for this reply :)

Re:Docker for Mac M1 RC by hazaskull on Friday March 19, 2021 @01:01PM (#26515706)
Needed to create one for a long time ;) General cpu-bound tasks seem fine in a vm; i/o is definitely slower but much to my surprise linux’s ext4 filesystem is so much more efficient (?) than ntfs for small files that even inside a vm (vbox or wsl) git actions are noticably quicker than on native Windows! I’d prefer is wsl2 for convenience over vbox if I could but my VPN is indeed the dealbreaker and corp. won’t support any other VPN software
Re:Docker for Mac M1 RC by e12e on Friday March 19, 2021 @01:33PM (#26516067)
> sacrificing compilation times by running in a VM that's too slow

Fwiw wsl2 runs in a vm now (hyper-v). AFAIK it's in order to increase fs performance "inside" Linux (so faster compiles if compiling in wsl).

It's also possible to use cifs/samba shares - but I don't know what you're compiling? Chrome/Firefox sized c++ projects?

Might be worth it to try with a tmpfs/ramdisk either way?

Re:Docker for Mac M1 RC by vetinari on Friday March 19, 2021 @07:40AM (#26512156)
> there was basic functionality missing e.g. I couldn't write and run my own SystemD services. Has the situation improved since then?

No. WSL2 uses it's own, minimal (proprietary) init, which basically launches default shell for the configured user and that's it. No service management in sight, and no equivalent of systemd's user scope or user session either.

Re:Docker for Mac M1 RC by meddlepal on Friday March 19, 2021 @08:18AM (#26512398)
You can boot the WSL vm with systemd but it requires some fiddling.

That said, I've been playing around more and more with WSL2 on a secondary machine as a current primary Fedora user (for about 10 years now) and I really haven't found a good reason why I would need systemd in the WSL2 VM vs the custom init.

Re:Docker for Mac M1 RC by aseipp on Friday March 19, 2021 @01:37PM (#26516126)
A major use case I have for WSL2 requires systemd, full stop (it's critical for the package manager I use.) It's pretty painful not having it available, and this is really something that needs improvement IMO. To be fair, this could be fixed in the software too (to some extent, not fully but working) which would also be a solution. But I suspect this isn't the only problem people encounter. There's a lot people use modern Linux for.

In practice that hasn't been a roadblock for me, because VMWare Workstation 15.5 finally supports running on top of Hyper-V, so I can have both working at once. Moving everything to a single hypervisor API has some nice benefits...

Re:Docker for Mac M1 RC by strictfp on Friday March 19, 2021 @05:29PM (#26518306)
One possible solution to this is removing systemd from all distros. That way you won't need it for your package manager anymore.
Re:Docker for Mac M1 RC by vetinari on Friday March 19, 2021 @06:14PM (#26518676)
Yeah, and let's continue with removing Win32 from Windows. That way other folks do not need to bother with Wine anymore.

/s, obviously.

Re:Docker for Mac M1 RC by stephenr on Sunday March 21, 2021 @11:28AM (#26531148)
A more realistic option is to abandon WSL as yet more crap from Microsoft.
Re:Docker for Mac M1 RC by aseipp on Friday March 19, 2021 @06:28PM (#26518776)
Please take the crybaby shit to Slashdot or something, man. It's not a good look.
Re:Docker for Mac M1 RC by vetinari on Friday March 19, 2021 @08:49AM (#26512657)
It is like Excel - most people use at most 20% of the functionality, but any competitor that implements only 20% is not usable.

Most WSL2 users use it as shell to run occasional ELF/x64 binary that runs in console; for services, they would use Docker Desktop for Windows. Anything beyond that and you will quickly find out, that it is not really a standard linux distribution.

Re:Docker for Mac M1 RC by abdusco on Friday March 19, 2021 @07:32AM (#26512108)
It's not full-on systemd, but you can run init scripts on WSL startup as of Insider Build 21286.

https://blogs.windows.com/windows-insider/2021/01/06/announc...

Re:Docker for Mac M1 RC by meddlepal on Friday March 19, 2021 @08:21AM (#26512420)
There's definitely a few quirks. My biggest annoyance right now is https://github.com/microsoft/WSL/issues/5762 .

Note this only impacts calling the Linux go toolchain from the Windows side (via the /$wsl/ path). Its not an issue inside WSL... but it comes up when you want to say configure Windows IntelliJ/GoLand to use the Go compiler hosted inside of the WSL VM.

> When you say "proper Linux distribution", I assume that's still CLI only? Do you develop with e.g. emacs, vim on WSL, or do you have some IDE with remote running and debugging into WSL? Or have a missed a trick and in fact X/Wayland applications can be run on WSL?

You can run X apps just fine in WSL2 as long as you have a display server running on the Windows side. I use X410. Important to note, Microsoft is working on native Wayland support long term. For what it is worth, I run IntelliJ/GoLand from inside of WSL and use X410 to render the GUI. This works great.

Re:Docker for Mac M1 RC by 600frogs on Friday March 19, 2021 @10:27AM (#26513720)
Your set-up sounds exactly what I'm after - from my comment to a different reply:

> I think my end goal is to have a contained development environment whilst not being forced to use specific tools (i.e. VSCode remote debugging, eugh) and not sacrificing compilation times by running in a VM that's too slow.

Are there any other gotchas to working like this? As it happens I'm a go dev using GoLand so your go-specific issues are of interest to me. I'm not too bothered about not being able to use Windows GoLand as I'd be just using it from WSL2 anyway, but I'd be interested to know if there are any other pain points. Any issues with VPNs, if you're using them?

Re:Docker for Mac M1 RC by meddlepal on Friday March 19, 2021 @10:52AM (#26513996)
I haven’t tried a VPN yet, but I have heard of some possible quirks due to how the networking is handled between Windows and Linux in HyperV

Edit: Im switching from Fedora to a WSL setup for work in the next week. Ill report on issues I encounter in that migration. I suspect VPN will come up because one of the key reasons im switching off Fedora to Windows+WSL is due to corporate VPN requirements.

Re:Docker for Mac M1 RC by running101 on Friday March 19, 2021 @02:02PM (#26516470)
This is the fix for vpn and wsl2 been running this for 6 months no issues. https://github.com/sakai135/wsl-vpnkit
Re:Docker for Mac M1 RC by 600frogs on Friday March 19, 2021 @11:05AM (#26514141)
That'd be super great if you could let me know how it goes, I'm tempted to make the same jump. Thanks!
Re:Docker for Mac M1 RC by meddlepal on Friday March 19, 2021 @11:48AM (#26514722)
I'll reply to this comment when I do know
Re:Docker for Mac M1 RC by varispeed on Sunday March 21, 2021 @09:13AM (#26530134)
I wish it was possible to use USB devices directly inside WSL e.g. for embedded development. I believe there are "tricks" like using USB over LAN, but I have not tried it yet. Once they make possible to use USB devices natively I'll be over the moon.
Re:Docker for Mac M1 RC by nickjj on Friday March 19, 2021 @07:34AM (#26512124)
> I assume that's still CLI only?

If you install an X server on Windows you can run graphical WSL apps. It runs really well too. Years ago I used to run Sublime Text straight from within WSL.

I've been using WSL / WSL 2 for a few years now for full time web development. A while back I made a video going over all the tools I use and how I have Docker, WSL 2 and a bunch of other things configured at: https://nickjanetakis.com/blog/a-linux-dev-environment-on-wi...

Re:Docker for Mac M1 RC by nwatson on Friday March 19, 2021 @11:51AM (#26514764)
I run VcXsrv X-Window on Windows (Multiple windows mode) and then from WSL2 Ubuntu I've run e.g. "terminator" and Jetbrains CLion C++/Rust GUI, Linux Version "~/bin/clion.sh &". It works very well.
Re:Docker for Mac M1 RC by nickjj on Friday March 19, 2021 @01:11PM (#26515816)
Yep, that's what I cover using in the video linked above too. VcXsrv is so good. Nowadays I mainly use it to share my clipboard between WSL and Windows so I can use native Linux tools that copy to the clipboard without resorting to any hacks.
Re:Docker for Mac M1 RC by Tenoke on Friday March 19, 2021 @07:33AM (#26512113)
>When you say "proper Linux distribution", I assume that's still CLI only? Do you develop with e.g. emacs, vim on WSL, or do you have some IDE with remote running and debugging into WSL?

VScode directly connects to WSL. You can open folders/files with 'code <folder>' from the WSL terminal, save, run whatever from VScode etc.

As for Docker, you can also use the GUI from within Windows that automatically connects to WSL but admittedly I almost never use the GUI.

Re:Docker for Mac M1 RC by 600frogs on Friday March 19, 2021 @10:31AM (#26513762)
I did try VSCode remote running and debugging, but found it fiddly to work with and half-baked. Plus, I was sorely missing IntelliJ, so I quickly stopped trying it out - maybe I'd get used to it eventually, but it didn't seem worth the onboarding cost. The RDP and X410 solutions suggested in the replies to GP seem solid though.
Re:Docker for Mac M1 RC by rcarmo on Friday March 19, 2021 @02:25PM (#26516750)
Re: CLI, there is ongoing work on getting graphics support for over a year now: https://lkml.org/lkml/2020/5/19/742
Re:Docker for Mac M1 RC by tyingq on Friday March 19, 2021 @08:11AM (#26512350)
There's this for running systemd inside WSL2: https://github.com/arkane-systems/genie