3

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.

hvd
  • 358
  • 3
  • 12
  • Best you could do is backup `%LOCALAPPDATA%/lxss`. Ensure it also contains the home folder, or backup that too. Afterward it all depends on the destruction - you might need to uninstall and reinstall again. – harrymc Jun 18 '18 at 08:31
  • Oddly, it started working again without me having done anything (knowingly, at any rate) to fix it. I'll leave this question up, I'd still like to know what happened, what I can do if this happens again, and what made it work again. – hvd Jun 18 '18 at 08:39
  • 2
    Some knowledge is not meant for us mere mortals. – harrymc Jun 18 '18 at 09:08
  • 2
    Possible duplicate of [How to backup (WSL) Linux Subsystem for Windows 10, before system reset or reinstall?](https://superuser.com/questions/1164818/how-to-backup-wsl-linux-subsystem-for-windows-10-before-system-reset-or-reins) – Biswapriyo Jun 18 '18 at 14:31
  • @Biswapriyo No, not a duplicate of that. That assumes your WSL is still operable. Mine wasn't, so I'd have had no way to run tar or anything like that, unless I'd have done it from the Windows side, which wouldn't have preserved permissions etc. – hvd Jun 18 '18 at 14:40
  • @hvd - Your question indicates it is indeed working though. – Ramhound Jun 18 '18 at 14:47
  • @Ramhound I asked my question when it wasn't working. It started working again after I asked it, but I'd still like an answer to the original question, in case I run into this problem again. – hvd Jun 18 '18 at 14:49

2 Answers2

0

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
Jaime
  • 2,169
  • 21
  • 20
  • These instructions should probably have a warning applied to them. I have a new copy of Ubuntu installed on my new machine and when I run this, it appears to just replace my new installation with my old backup installation without warning. – Micah Zoltu Jun 17 '23 at 05:24
0

I had an Ubuntu instance, and the path where I could recover my data was:

C:\Users\[username]\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_[someID]\LocalState\rootfs