Windows 的 Linux 子系统（WSL）即将带来图形化应用
WSL

> 
> Windows 上的 Linux 正在继续发展，功能越来越强大。现在，图形化的 Linux 程序正在被整合到 WSL 中。
> 
> 
> 


![](/data/attachment/album/202010/04/224625e5kvrjksnkkzlhos.jpg)


在微软 Build 2020 虚拟开发者大会上，微软 CEO 萨提亚·纳德拉宣布 Windows 的 Linux 子系统（WSL）2.0 [即将支持 Linux GUI 和应用程序](https://www.zdnet.com/article/microsoft-linux-gui-apps-coming-to-windows-10-wsl-along-with-gpu-access/)。现在这一天比以往任何时候都要近。在最近的 X.Org 开发者大会（XDC）上，微软合作伙伴开发者负责人 Steve Pronovost 透露，微软已经可以在 WSL 中运行图形化的 Linux 应用。


一直以来，虽然都可以在 WSL 上运行 [GIMP 图形编辑器](https://www.gimp.org/)、[Evolution 电子邮件客户端](https://wiki.gnome.org/Apps/Evolution)和 [LibreOffice](https://www.libreoffice.org/) 等 Linux 图形程序，但这并不容易。你必须安装一个第三方 X Window 显示服务器，比如 Windows 10 中的 [VcXsrv Windows X Server](https://sourceforge.net/projects/vcxsrv/)，然后[对 Windows 和 Linux 做一些调整，让它们顺利地一起工作](https://techcommunity.microsoft.com/t5/windows-dev-appconsult/running-wsl-gui-apps-on-windows-10/ba-p/1493242)。[X Window 系统](http://www.opengroup.org/tech/desktop/x-window-system/)几乎是所有 Linux 图形用户界面的基础。


现在，微软已经将 [Wayland 显示服务器](https://www.linux-magazine.com/Online/Features/Is-Wayland-the-New-X)移植到 WSL 中。Wayland 是最流行的 X Window 兼容的显示服务器。在 WSL2 中，它通过远程桌面协议（RDP）连接将图形化的 Linux 应用程序连接到主 Windows 显示器上。这意味着你可以在同一个桌面屏幕上同时运行 Linux 和 Windows GUI 应用程序。


Pronovost 解释道：



> 
> WSL 本质上是在 Windows 托管的虚拟机里面运行 Linux，我们将应用程序（控制台程序，现在还有 GUI 程序）整合回你的 Windows 桌面，这样你就可以在统一的体验里面同时运行 Win32 和 Linux 应用程序。由于 Linux 是在虚拟机中运行，我们不能运行期望直接访问 GPU 的原生 GPU 驱动程序（除非我们做一些类似于离散设备分配的事情，并将其中一个宿主机 GPU 分配给虚拟机......但那样宿主机将失去对该 GPU 的访问！）。有了[GPU-PV（GPU 准虚拟化）](https://petri.com/microsoft-announces-gpu-hardware-acceleration-and-gui-app-support-for-wsl-2-at-build-2020)，我们基本上可以在 Linux 中投射宿主机 GPU，让 Linux 和 Windows 进程共享同一个物理 GPU，而不需要固定的资源分区。
> 
> 
> 


微软 WSL 项目经理 Craig Loewen 在 Twitter 上补充道，使用第三方 X 服务器和内置 Wayland 服务器的关键区别在于。“[你不需要启动显示服务器](https://twitter.com/craigaloewen/status/1308452901266751488)，我们会为你处理。”此外，它还带有“与 Windows 的完美集成”，例如投影和 Linux 图标支持。


Loewen 还表示，你可以在其中运行 Linux Web 浏览器。“我们还没有用完整的桌面环境（DE）对它进行充分测试，因为我们想先专注于运行经常被问及的应用，主要是 IDE（集成开发环境），这样你就可以在一个完整的 Linux 环境中运行这些应用，”他说。


不过，先别太兴奋。Loewen 继续说道：“我们还没有制定测试通道的时间表，不过，这项工作通常会在接下来几个月内提供给 Insiders 试用。”


[微软将 Linux 整合到 Windows 中](https://www.zdnet.com/article/2020-will-be-the-year-of-linux-on-the-windows-desktop/)已经有一段时间了。四年前，微软推出了 WSL，[将 Linux Bash shell 带到了 Windows 10 中](https://www.zdnet.com/article/microsoft-to-show-bash-on-linux-running-on-windows-10/)。通过 Bash 和 WSL，你可以运行大多数 [Linux shell 工具](http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html)和流行的 Linux 编程语言。


随着时间的推移，Linux 更成为 Windows 桌面上的一等公民。多个 Linux 发行版，从 Ubuntu 开始，随后是红帽 Fedora 和 SUSE Linux 企业桌面版（SLED） 都进入了 Windows 商店。随后，微软用 WSL 2 取代了将 Linux 内核调用转换为 Windows 调用的 WSL 翻译层。这一更新是在精简版 Hyper-V 管理程序上运行的[微软自己的 Linux 内核](https://www.zdnet.com/article/hell-freezing-over-microsoft-releases-its-own-linux-for-windows/)附带的。


最近，[从 Windows 10 Insider Preview build 20211 开始，Windows 用户可以访问 Linux 文件系统](https://devblogs.microsoft.com/commandline/access-linux-filesystems-in-windows-and-wsl-2/)。这包括访问 Windows 本身不支持的 Linux 文件系统，例如 ext4。这也意味着，如果你用不同的磁盘双启动 Windows 和 Linux，现在可以从 Windows 访问 Linux 文件。有了这个功能，你可以通过管理权限从 Windows 文件资源管理器和 PowerShell 窗口访问 Linux 文件。


按照现在的发展速度，我对 [Windows 11 可能会运行在 Linux 之上](https://www.computerworld.com/article/3438856/call-me-crazy-but-windows-11-could-run-on-linux.html)的“疯狂”预测，也许会成为现实! 


OK
# Linux graphical apps coming to Windows Subsystem for Linux

![steven-vaughan-nichols](https://www.zdnet.com/a/img/resize/e27b3953df87b835a77deeeec01f311aa283a5ec/2022/08/05/e2171bd1-84f6-4ca8-9801-2abdeb61a365/steven-vaughan-nichols.jpg?auto=webp&fit=crop&frame=1&height=192&width=192)

At the Microsoft Build 2020 virtual developers' conference, CEO Satya Nadella announced that Windows Subsystem for Linux (WSL) 2.0 would [soon support Linux GUIs and applications](https://www.zdnet.com/article/microsoft-linux-gui-apps-coming-to-windows-10-wsl-along-with-gpu-access/). That day is closer now than ever before. At the recent [X.Org Developers Conference (XDC)](https://xdc2020.x.org/), Microsoft partner developer lead Steve Pronovost revealed that Microsoft has made it possible to run graphical Linux applications within WSL.

### Windows

It's always been possible to run Linux graphical programs such as the [GIMP graphics editor](https://www.gimp.org/), [Evolution e-mail client](https://wiki.gnome.org/Apps/Evolution), and [LibreOffice](https://www.libreoffice.org/) on WSL. But it wasn't easy. You had to install a third-party X Window display server, such as the [VcXsrv Windows X Server ](https://sourceforge.net/projects/vcxsrv/)in Windows 10, and then do some [tuning with both Windows and Linux to get them to work together smoothly.](https://techcommunity.microsoft.com/t5/windows-dev-appconsult/running-wsl-gui-apps-on-windows-10/ba-p/1493242) The [X Window System](http://www.opengroup.org/tech/desktop/x-window-system/) underlies almost all Linux graphical user interfaces.

Now, Microsoft has ported a [Wayland display server](https://www.linux-magazine.com/Online/Features/Is-Wayland-the-New-X) to WSL. Wayland is the most popular X Window compatible server. In WSL2, it connects the graphical Linux applications via a Remote Desktop Protocol (RDP) connection to the main Windows display. This means you can run Linux and Windows GUI applications simultaneously on the same desktop screen.

Pronovost explained:

WSL essentially runs Linux inside of a Virtual Machine hosted by Windows and we integrate applications (console, and now GUI) back onto your Windows desktop so you can run both Win32 and Linux applications inside of a unified experience. Because Linux is running in VM, we can't run the native GPU driver that expects direct access to the GPU (unless we were to do something like discrete device assignment and assign one of the host GPU to the VM... but then the host would lose access to that GPU!). With

[GPU-PV [GPU Paravirtualization]]we can essentially project the host GPU in Linux and have both Linux and Windows processes share the same physical GPU without the need for fixed resource partitioning.

Craig Loewen, Microsoft WSL Program Manager, added in a Twitter thread that the key differences between using a third-party X server and the built-in Wayland server is that: "[You don't need to start up or start the server,](https://twitter.com/craigaloewen/status/1308452901266751488) we'll handle that for you." In addition, it comes with "Lovely integration with Windows," such as drop shadows and Linux icon support.

Loewen also said you can run a Linux web browser in it. "We haven't tested it extensively with a full desktop environment yet, as we want to focus on running often asked for apps first, and primarily IDEs [integrated development environment] so you can run those in a full Linux environment," he said.

Don't get too excited about it just yet, though. Loewen continued, "We don't yet have an ETA for the beta channel, however, this work will be available in general for Insiders to try within the next couple of months."

[Microsoft's integration of Linux into Windows](https://www.zdnet.com/article/2020-will-be-the-year-of-linux-on-the-windows-desktop/) has been coming for some time. Four years ago, Microsoft introduced WSL, which brought the [Linux Bash shell to Windows 10](https://www.zdnet.com/article/microsoft-to-show-bash-on-linux-running-on-windows-10/). With Bash and WSL, you can run most [Linux shell tools](http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html) and popular Linux programming languages.

As time went on, Linux became more of a first-class citizen on the Windows desktop. Multiple Linux distros, starting with [Ubuntu](https://ubuntu.com/), were followed by [Red Hat Fedora](https://getfedora.org/) and [SUSE Linux Enterprise Desktop (SLED)](https://www.suse.com/products/desktop/). Then, Microsoft replaced its WSL translation layer, which converted Linux kernel calls into Windows calls, with WSL 2. This update came with [Microsoft's own Linux kernel](https://www.zdnet.com/article/hell-freezing-over-microsoft-releases-its-own-linux-for-windows/) running on a thin version of the Hyper-V hypervisor.

More recently, starting with the [Windows 10 Insider Preview build 20211, Windows users can access Linux file systems](https://devblogs.microsoft.com/commandline/access-linux-filesystems-in-windows-and-wsl-2/). This includes access to Linux file systems, such as ext4, which Windows doesn't natively support. It also means, if you dual-boot Windows and Linux with different disks, you can now access Linux files from Windows. With this, you can access Linux files from both the Windows File Explorer and PowerShell window with administrative privilege.

At the rate things are going, my "crazy" prediction that [Windows 11 might run on top of Linux](https://www.computerworld.com/article/3438856/call-me-crazy-but-windows-11-could-run-on-linux.html) may yet come true!

**Related Stories:**

[Editorial standards](/editorial-guidelines/)