Cygwin and WSL
Since the early days of the NT operating system, Windows provided a POSIX subsystem, even if it was not complete or known to most users.
Microsoft changed multiple times the implementation and name of this subsystem. The first version was named Microsoft POSIX subsystem, with Windows 2000. With Windows 8 we got the Windows Services for UNIX, and now, with Windows 10, we have the Windows Subsystem for Linux.
I have no experience with the previous POSIX subsystems of Windows, but I have gathered some experience with WSL. As I am also a Cygwin user, I wanted to see if it was able to replace my current setup, therefore availability, compatibility with other tools, and so on.
Availability
The WSL is integrated with the operating system. You might therefore think that given some Windows machines, you can always expect to find a bash shell and work with it.
Unfortunately, it’s not the case, and it won’t be in the foreseeable future.
WSL is available only for the 64 bit version of Windows and is disabled by default. To enable it you need to change a couple of system settings and install a GNU/Linux operating system like Ubuntu.
On the other hand, also Cygwin is not available by default. It needs to be downloaded and installed, but
-
it also works on x86 systems
-
it works on older Windows versions
-
it does not require changing any Windows configuration/it can be installed as any other program
Future updates
I fear that WSL will suffer a fate similar to Internet Explorer. It is highly integrated with the system, and you’ll need to upgrade to the latest Windows version to also get the Linux subsystem (partially) updated.
The Linux subsystem uses the Ubuntu repository and uses unmodified Linux binaries, but Microsoft needs to support the system calls that are used by those binaries. If a newer version of the Operating system has been released, it makes little sense to add new features to the old one. Thus it is plausible that users that won’t upgrade their system to the latest version, won’t be able to get the latest features if they want them.
Cygwin on the other hand is much more decoupled from the Windows version, like third-party browsers. You can run the latest version even on an older operating system until support is discontinued.
Until now, in practice, support has been discontinued only after Microsoft discontinued support for its system. Something similar happened with Firefox and Chrome for older Windows versions compared to Internet Explorer, and many other programs.
These are of course speculations, but not unfounded.
Cygwin supported Windows XP, which is not supported anymore since 2015, until 2016, and it does still support Windows Vista. You could get the latest Cygwin version for Windows XP one year later official support has been discontinued.
Actual comparison of the system
Supposing that we have a recent Windows version and WSL enabled, let’s compare WSL with Cygwin.
Terminal emulator
The terminal emulator is the first tool one will have to use to enter the POSIX subsystem. It’s cmd :-( Fortunately, you can install another emulator, but it would have been much better to provide a more modern one by default.
Environment integration
Enter WSL, the first thing you get asked is to create a new account with a different password. This was a little bit unexpected, why should I need to add another account?
WSL and Windows are different worlds (with some overlaps). You can’t edit Linux files under Windows 🗄️ or navigate its file system directly with Explorer.
Therefore all the WSL processes will run as a different user, and those are not visible to the Windows user.
Permissions won’t match, the home directory will not be the same as the one under Windows, and so on.
Cygwin may not be perfect, but the system integration is much better.
It is possible, for example, to edit Cygwin configuration files with Windows native tools. And of course, it is also possible (and it’s one of the first things I do), to set the Cygwin home directory at the same location as my Windows home.
This makes it possible to use the same configuration for Windows native programs, and programs in Cygwin, for example, git
or other command-line tools, without copy-pasting my configuration file in different locations.
This has been the biggest disappointment. As WSL is provided directly by Microsoft, I hoped that the two systems would have been somehow integrated.
At that point, I realized, that many command-line tools I wanted so badly under Cygwin, like htop
and sudo
, and that are available with WSL, are useless. sudo
works, but it won’t give you Windows Administrator permissions, you will "only" be root inside WSL (you wille be able to upgrade GNU/Linux packages and so on). htop
works too, but it will only show the processes of the Linux subsystem.
And worse yet, the two systems, have a completely separate network configuration. The file /etc/hosts
is, for example, not linked to %SystemRoot%\System32\drivers\etc\hosts
.
So WSL can be viewed as a virtual machine, from where you can call Windows programs, but cannot provide a good integration like Cygwin.
Available Tools
The WSL gives you, theoretically, the whole Ubuntu repository. That’s a lot of programs. Surely more than those provided by Cygwin, which is a great thing.
As mentioned before, many tools I would like to have, like htop
and sudo
, are nice to have but not what I wanted if they do not integrate with the Windows world. And other Tools, that can be useful for a POSIX system inside the Windows system, are not there too. There is for example no tool for accessing the Windows registry.
Issues with AV
At first, I thought that the Ubuntu repository was not working. The connection was incredibly slow, even with Cygwin sometimes it takes a lot of time to update the system but not connect to the network and download the required packages.
Then I found out that the AV was blocking the connection, Microsoft is aware of this issue, and hopefully most AV vendors too. Also, Cygwin has this issue 🗄️ from time to time, the installer has even an option for disabling buggy antiviruses (lucky me I never needed it). So this is not WSL or Cygwin’s fault, lets hope that most AV updates their products.
WSL2
Not all syscalls have been implemented in WSL. For example, it is not possible to execute x86 programs, nor it is foreseeable that WSL is going to be developed further, as there is now WSL2, an integrated virtual machine that runs the Linux kernel.
WSL2 is also currently problematic as it breaks other virtualization programs like VirtualBox and VMWare.
Conclusion
WSL is not a tool for administering your machine, WSL2 is even less.
It might replace some of my virtual machines, as generally, it should consume fewer resources, but not all of them (thus ruling WSL2 out), and not Cygwin.
It might also remove the need to install some programs under Cygwin if it turns out that it is possible to integrate without too many gotchas both worlds and if WSL provides some advantages over Cygwin, like better performance.
If you have questions, comments, or found typos, the notes are not clear, or there are some errors; then just contact me.