https://philipbohun.com/blog/0007.html
philipbohun.com
gitlab | github | youtube | twitter
---------------------------------------------------------------------
blog dark mode
---------------------------------------------------------------------
Convert Linux to Windows
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.
(c) 2025 philip bohun