Linux – How to recover the legacy WSL without data loss

windowswindows-subsystem-for-linux

I have had the Windows Subsystem for Linux installed for a long time. Today, after a clean boot of my Windows 10, it fails to start, with the regular error message:

Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
Press any key to continue…

In my %LOCALAPPDATA%\lxss, I see that WSL is still completely there. Can I somehow still start this? If not, if I perform a new installation, can I mount the old directories somehow in such a way that not just all data, but also all permissions etc. are visible, and move them to a new installation?

I shouldn't need to spell this out, but when WSL doesn't work, any back-up utility that has to be run from WSL also won't work.

I'm hesitant to just try lxrun /install for fear that it will nuke all of my data.


For no reason that I can tell, it started working again. I'd still like to know what happened and what fixed it, so that I know what to do if this happens again in the future.

Best Answer

I understand that you have the root folder of your distribution, but you cannot run it using bash or wsl. I think you may try to register again your old installation folder using lxRunOffline


Registering an existing installation

# lxrunoffline register -n <distro name> -d <basepath>
C:> lxrunoffline register -n copy -d %LOCALAPPDATA%\Packages\...\LocalState

I think that the BasePath is the parent of your rootfs folder. For instance, if the root folder is

%LOCALAPPDATA%\Packages\...\LocalState\rootfs

The base path must be

%LOCALAPPDATA%\Packages\...\LocalState