将Linux系统转换为Windows系统
Convert Linux to Windows

原始链接: https://philipbohun.com/blog/0007.html

Philip Bohun 提出了一种新的 Linux 发行版,它可以通过 Wine 原生运行 Windows 可执行文件,以解决 Linux 的二进制兼容性问题以及 Windows 和 macOS 等商业操作系统日益增多的限制。由于库依赖和多个冲突的包管理系统,Linux 二进制文件往往缺乏长期兼容性。相比之下,Windows 的 Win32 API 依靠动态链接库,提供了更高的稳定性。 拟议的发行版将提供熟悉的 Windows 风格桌面环境、预安装的 Wine 以及内核修改,以无缝执行 Windows 应用程序。这种方法利用了 Wine 与 Windows 应用程序的广泛兼容性。这种“Windows”发行版旨在为面临隐私问题和对较新 Windows 版本控制限制的 Windows 用户提供用户友好的迁移路径,同时确保应用程序的长期保存。通过将应用程序发布为 Windows/Win32 应用程序,它可以轻松实现跨平台兼容性。

Hacker News 的一个帖子讨论了将 Linux 转换为 Windows 的可行性和必要性,起因是 philipbohun.com 上的一篇博文。评论者认为 Linux 已经通过容器化(Flatpak、Snap、AppImage)和静态链接提供了二进制兼容性解决方案,从而避免了 ABI 问题。一位用户指出,glibc 的向后兼容性确保了较旧的二进制文件(大约 2005 年左右的)仍然可以在具有所需 `.so` 文件的现代发行版上运行,这与 Windows 需要 `.dll` 文件类似。Zorin OS 被提及为一个现有的 Linux 发行版,它可以通过 Wine 运行 `.exe` 文件。最后,一位评论者质疑原发帖人关于苹果和微软等大公司激励机制错位的说法,认为最大化利润本身可能并非“不当”的。讨论的中心围绕着桥接 Linux 和 Windows 应用程序兼容性的实用性和必要性。

原文
philipbohun.com/blog
blog dark mode
2025-03-29

Thesis: We should create a distro of Linux that runs Windows binaries by default via Wine.

The Linux Environment is Unstable

I can pull down a 20 year old exe and still run it today on Windows. Try doing the same with a Linux binary that's just a year old. There's no guarantee that it will be able to run based off some update that has happened. There's also no guarantee that a binary produced today on Linux will even work on the various distributions of Linux today due to the same installed library version problem.

While the Linux syscalls themselves are very stable and reliable, the c library on top of them is not. Practically all of userland is based on libc, and therefore by proxy Linux itself has a binary compatibility problem.

Binary Distribution is a Problem

Because of the problems listed above (and more), there is no good way to distribute binaries for Linux. There are four (yes four!) major ways to distribute binaries, and they all have problems:

  1. The raw binary. If this worked, we wouldn't need the other solutions.
  2. AppImage. Completely self-contained artifact that bundles all dependencies in with the binary.
  3. Flatpak. A package manager that provides a sandbox for each application.
  4. Snaps. Yet another package manager that runs applications in a sandbox.

There are even more ways of distributing binaries, but these are the major ones. What's crazy is that all four methods can be used at once on a system, each with their own methods of installing, updating, and deleting applications. I won't go into the pros and cons of each method here, but there are arguments about each.

A major downside for all these methods is that application preservation is essentially non-existant for all of them. Can a person archive an application for 20 years, pull it from the dustbin, and execute it with no other effort? Maybe for AppImage? Who knows? It's a definite "no" for the other three methods.

Win32 is the Answer

A few years ago, Arek Hiler wrote a blog post, Win32 Is The Only Stable ABI On Linux. He is absolutely right, and I believe this insight holds the answer to Linux's compatibility problem. This is actually made possible by a genius decision for the design of Win32.

In Linux, you can make system calls directly. Just fill up some registers and make a syscall interrupt.

In Windows, you do not make system calls directly. Instead, you dynamically link to libraries that make the system calls for you. This allows Microsoft to do all sorts of shenanigans at the kernal level while providing a stable API to userspace. This little stroke of genius allows us to have both Linux and Windows on the same machine at the same time.

If you think about it, there are only two major differences between a Windows app and a Linux app. One, they use different executable formats. Two, Windows uses dynamic libraries to make system calls. Just use a PE format instead of ELF, load a couple libraries, and you essentially have a Windows application! We also already have a simple way to run Windows applications, Wine.

Wine is a miraculous project. It provides amazing compatibility with Windows applications going all the way back to the 32-bit Windows 95 era. It even implements DirectX! The difference between what Windows supports and Wine supports is approaching zero over time (especially if you stick to Win32). Wine is the magic we can use to fix our problem.

A New Distro

Imagine we made a new Linux distro. This distro would provide a desktop environment that looks close enough to Windows that a Windows user could use it without training. You could install and run Windows applications exactly as you do on Windows; no extra work needed. How would this work?

The distro would come with Wine pre-installed, and there would be some small patches to the Linux kernel. A small modification to the "exec" family of system calls to dispatch on executble type would allow any Linux application to fork an exec a Windows application with no effort.

A wine prefix could be setup for each user, and the desktop environment would work off of that prefix, presenting a Windows-like file system to the user, and to user applications. Linux as we know it would still be available, but hidden for the normal GUI desktop user.

True Multiplatform

Wine works on Linux, FreeBSD, ReactOS, macOS, Android, and Haiku. If we published all our applications as Windows/Win32 apps we could achive multiplatform compatibility without any extra effort.

The Looming Future

The two major commercial operating systems, MacOS and Windows, are heading in the same direction. These OSs are becoming more locked down, violating privacy, and removing control user's have over their own computing environment. Both OSs are arguably building in outright spyware into their operating systems. Windows is going to take screenshots of your screen every few seconds and have an AI analyze it. MacOS has a feature called Gatekeeper, which limits what software you can run on your Mac to only those applications that Apple approves. Both Apple and Microsoft are in the process of adding the ability to scan your computer for "illegal" files and report you to the authorities.

These features are done in the name of convenience and "child safety", but the net effect is that billions of users lose their agency and control over their own computers. What happens when you no longer have any control over your computer? What happens when your operating system is a subscription? What happens when you do something these companies don't like and you are banned from using any computer?

Microsoft is already removing the ability to run Windows without an online account. If you lose your account, even for a mistake, you lose the ability to run a computer.

NOTE: I am not against Apple or Microsoft. They have amazing engineers! I don't think they're being malicious. Rather, I think the incentives for these companies are improperly aligned. Economic and governmental forces are guiding them down this path. They could absolutely change tack and try to empower users, but I think we shouldn't assume that will happen naturally.

This is why I think we need a "Windows" distro of Linux. Not only does it solve our binary compatibility problem, it also provides an onramp to Windows users who will be forced to "upgrade" to Windows 11 in October of this year. Wouldn't it be great to have a painless way to switch Linux?

Just a thought.

联系我们 contact @ memedata.com