2

The best part of Windows 11 is a revamped Windows Subsystem for Linux

 2 years ago
source link: https://arstechnica.com/gadgets/2021/10/the-best-part-of-windows-11-is-a-revamped-windows-subsystem-for-linux/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

you got your windows in my linux —

The best part of Windows 11 is a revamped Windows Subsystem for Linux

WSL is finally easy to install—and offers automatic sound/graphics support.

Jim Salter - 10/7/2021, 10:45 AM

Installing and using the Windows Subsystem for Linux is easier and more productive under Windows 11 than it was under Windows 10.

Enlarge / Installing and using the Windows Subsystem for Linux is easier and more productive under Windows 11 than it was under Windows 10.
Jim Salter


In our main Windows 11 review posted earlier this week, we covered the majority of new features and design decisions in Microsoft's newest consumer OS—and it feels reasonable to characterize the overall impression given there as "lukewarm." The good news is that we still hadn't covered the best part of Windows 11: Linux.

For years now, Windows 10's Windows Subsystem for Linux has been making life easier for developers, sysadmins, and hobbyists who have one foot in the Windows world and one foot in the Linux world. But WSL, handy as it is, has been hobbled by several things it could not do. Installing WSL has never been as easy as it should be—and getting graphical apps to work has historically been possible but also a pain in the butt that required some fairly obscure third-party software.

Windows 11 finally fixes both of those problems. The Windows Subsystem for Linux isn't perfect on Windows 11, but it's a huge improvement over what came before.

Installing WSL on Windows 11

  • You can't install WSL from a standard CMD prompt—you need an elevated one.
  • From within an elevated CMD, wsl --install is all it takes. One reboot later, you have WSL with audio and graphics support baked right in!

Microsoft has traditionally made installing WSL more of a hassle than it should be, but the company finally got the process right in Windows 10 build 2004. Just open an elevated Command prompt (start --> type cmd --> click Run as Administrator), type wsl --install at the prompt, and you're good to go. Windows 11, thankfully, carries this process forward unchanged.

A simple wsl --install with no further arguments gets you Hyper-V and the other underpinnings of WSL, along with the current version of Ubuntu. If you aren't an Ubuntu fan, you can see what other easily installable distributions are available with the command wsl --list --online. If you decide you'd prefer a different distro, you can install it instead with—for example—wsl --install -d openSUSE-42.

Advertisement

If you're not sure which distribution you prefer, don't fret. You can install as many as you like, simply by repeating wsl --list --online to enumerate your options and wsl --install -d distroname to install whichever you like.

Installing a second distribution doesn't uninstall the first; it creates a separate environment, independent of any others. You can run as many of these installed environments as you like simultaneously, without fear of one messing up another.

WSL now supports graphics and sound

In addition to easy installation, WSL on Windows 11 brings support for both graphics and audio in WSL apps. This isn't exactly a first—Microsoft debuted WSLg in April, with Windows 10 Insider Build 21364. But Windows 11 is the first production Windows build with WSLg support.

If this is your first time hearing of WSLg, the short version is simple: you can install GUI apps—for example, Firefox—from your Ubuntu (or other distro) command line, and they'll work as expected, including sound. When I installed WSLg on Windows 11 on the Framework laptop, running firefox from the Ubuntu terminal popped up the iconic browser automatically. Heading to YouTube in it worked perfectly, too, with neither frame drops in the video nor glitches in the audio.

If you're looking for how WSLg works, we can get you started there also: Microsoft decided to go future-forward and build using the Wayland protocol rather than the increasingly elderly X11/xorg. To make it all work, this meant building the graphical interface on the Weston reference compositor for Wayland, hitched to XWayland to support X clients, with FreeRDP providing connectivity between the native Windows system and the X/Wayland apps running under WSLg.

If you want to dig further into the hairy details of WSLg's architecture, we highly recommend Microsoft's own April 19 devblog post on exactly that topic.

What can I do with WSLg on Windows 11?

  • We don't have Firefox installed on Windows 11—only inside the WSLg environment!
  • This is my favorite use for WSLg—a local copy of virt-manager, managing virtual machines hosted on remote Linux servers.

One of the most repeated questions we've seen about WSLg can be expressed as "why bother?" This is because the majority of GUI "killer apps" in the Linux world aren't really Linux-specific—the vast majority have already been ported directly to the Windows platform. And for those apps, running the native Windows ports frequently makes more sense.

Advertisement

With that said, there is one obvious "killer app" for WSLg that has us excited—and that's virt-manager, the RedHat-originated virtualization management tool. virt-manager is a simple tool that streamlines the creation, management, and operation of virtual machines using the Linux Kernel Virtual Machine.

With virt-manager, you can see a simple list of your VMs along with how much disk, network, and CPU activity is currently associated with each. You can also manipulate their virtual "hardware"—e.g., by adding or removing RAM, "disks", network interfaces, and more—and start, pause, or stop them. Creation and destruction of VMs is as easy as management—and, finally, virt-manager allows you to pull a graphical console directly into each VM, which behaves just as a physical display connected to a bare-metal machine would.

If all of this only worked on the local host, it would be pretty useless under WSLg. Nested virtualization is a thing, but it's generally not something you want to do in production. However, virt-manager allows you to manage the VMs on any machine you can SSH to, not just the local host. In practice, I use this remote management feature to manage many tens of hosts (and a few thousand VMs), both local and remote, on a day-to-day basis.

But...

Unfortunately, virt-manager never got a Windows port and seems unlikely to. But it runs under WSLg like a champ. In the screenshots above, you can see my Framework laptop running virt-manager under WSLg, connected via SSH to my Ubuntu workstation. The Ubuntu workstation has a variety of VMs installed and running—and virt-manager on my Framework laptop can manage them all, including the Hackintosh VM and Windows Server 2012 R2 VM it has console windows open to.

The cherry on top of this virtualization cake is just how well those console windows work—I had no trouble getting flawless YouTube playback on my Hackintosh VM console, complete with working, glitch-free audio. Ironically, this is a better remote control experience than I can manage with my real Macbook Air—which is unbearable to use for so much as spreadsheet work, thanks to it being limited to VNC over Wi-Fi.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK