Nuke and Reinstall a WSL Distribution


You can find the source of truth for managing WSL distributions over at Manage and configure Windows Subsystem for Linux.

Today while attempting to install some Alpine packages in my WSL distribution the distro started being naughty and did not want sudo ping or install manually downloaded Alpine packages.

Over at someone recommended messing around with perms in /usr and well, here we are lol. I borked my sudo permissions, and no longer being able to do anything in my Alpine distribution, it’s time to start from scratch. That’s what these WSL distributions are there for.

How to uninstall

The command spec is wsl --unregister <DistributionName> . In my case it was:

From a Windows command line cmd.exe or PowerShell instance:

You don’t need administrative permissions or an elevated shell to run these, which is great!

After that you can simply go to the Windows Store on your machine, and re-download the distribution:

After the distribution is downloaded, you can click on the Launch button, and it will open a shell to the distribution:

When you open this new shell, the WSL management engine will install the distribution proper, and ask you for a new username. In my case I choose wsl for my username:


Basic Setup


After a fresh Alpine WSL installation, you won’t have sudo out of the box. To open a root shell into Alpine WSL, from cmd.exe or PowerShell:

Then setup a password for the root user, and install the sudo apk package:

After that edit the /etc/sudoers file with visudo /etc/sudoers , and modify the %sudo line:

Add the group sudo :

Add your current user to the sudo group:

Verify contents of the /etc/group file, to make sure your default user is now included in the sudo group:

Add password to the default user, in my case wsl :


And we’re on our merry way to the rest of the day!


Organic, fair-sourced DevOps and Full-Stack things. This is a BYOB Establishment — Bring Your Own hipster Beard.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store