Installing Microsoft Edit in WSL Ubuntu

Installing new tools on Linux, especially within a WSL (Windows Subsystem for Linux) environment, can sometimes feel like a treasure hunt. Recently, we embarked on a mission to get “Microsoft Edit” – a handy utility from Microsoft’s GitHub – up and running in WSL Ubuntu. What seemed like a straightforward installation quickly turned into a classic Linux dependency puzzle. Here’s how we solved it!

The Initial Download and Decompression

Our journey began at the Microsoft Edit GitHub releases page, where we found the latest Linux binary: edit-1.0.0-x86_64-linux-gnu.xz.

First, we fired up our WSL Ubuntu terminal and used wget to grab the file:

wget https://github.com/microsoft/edit/releases/download/v1.0.0/edit-1.0.0-x86_64-linux-gnu.xz

The .xz extension told us it was a compressed archive. So, the next logical step was to decompress it:

unxz edit-1.0.0-x86_64-linux-gnu.xz

This command successfully extracted the file, leaving us with edit-1.0.0-x86_64-linux-gnu. Interestingly, it wasn’t a .tar archive as is often the case; it appeared to be a direct executable!

The First Attempt to Run and the “Permission Denied”

Excited, we tried to run it directly:

./edit-1.0.0-x86_64-linux-gnu

We were met with a “Permission denied” error. A quick fix was to make the file executable:

chmod +x edit-1.0.0-x86_64-linux-gnu

The GLIBC Roadblock

With execution permissions granted, we tried again, this time, a new error appeared:

version 'GLIBC_2.32' not found (required by ./edit-1.0.0-x86_64-linux-gnu)

This is a common Linux issue. GLIBC (GNU C Library) is a fundamental library that almost all programs on Linux rely on. This error meant that the edit program was compiled on a newer Linux system that had GLIBC version 2.32 or higher, but our WSL Ubuntu instance had an older version. You can check your system’s GLIBC version with ldd –version.

The Solution: Upgrading WSL Ubuntu

Since the edit binary specifically required a newer GLIBC, the most robust solution was to upgrade our WSL Ubuntu distribution. This ensures that all system libraries, including GLIBC, are brought up to a more recent standard.

Here’s the sequence of commands we used:

First, update your package lists and upgrade existing packages:

sudo apt update
sudo apt upgrade

Then, perform the distribution upgrade:

sudo do-release-upgrade

This command initiates the process of upgrading your Ubuntu release (e.g., from 20.04 to 22.04). It will ask several questions during the process; generally, accepting the defaults is fine unless you have specific configurations. The upgrade can take some time.

After the upgrade was complete, we restarted our WSL instance (you can do this by typing wsl –shutdown in a Windows Command Prompt or PowerShell, then reopening your Ubuntu terminal).

Success!

With the WSL Ubuntu system successfully upgraded, we navigated back to the directory containing our edit executable and tried to run it one last time:

./edit-1.0.0-x86_64-linux-gnu

And voilà! The program launched without a hitch.

Microsoft Edit running in WSL Ubuntu

Optional: Making it Globally Accessible

To make edit easier to use from any directory, we moved it to /usr/local/bin and renamed it for convenience:

sudo mv edit-1.0.0-x86_64-linux-gnu /usr/local/bin/edit

Now, we can simply type edit in our terminal to launch the application.

Conclusion

This experience highlights a common challenge in Linux: dependency mismatches. While initially frustrating, understanding the GLIBC error led us to the straightforward solution of upgrading our WSL Ubuntu distribution. It’s a reminder that keeping your system updated isn’t just about new features, but also about ensuring compatibility for the latest software. Happy editing!

Leave a Reply

Your email address will not be published. Required fields are marked *