WSL icon indicating copy to clipboard operation
WSL copied to clipboard

WSL 2 Ubuntu Files Gone

Open engina opened this issue 6 years ago • 67 comments

See our contributing instructions for assistance.

Please fill out the below information:

  • Your Windows build number: (Type ver at a Windows Command Prompt) Microsoft Windows [Version 10.0.18362.657]

  • What you're doing and what's happening: I started Ubuntu as usual. It said installing some stuff, it seem to be frozen. There was no feedback. I closed the window and relaunched the Ubuntu. It gave an error that looks like https://github.com/microsoft/WSL/issues/4444 but a bit different. Then I try to re-run it. And it asked me for a username and password for the new Ubuntu installed. My older ubuntu is gone.

BTW after I killed the launch process, later I noticed bsdtar in process explorer.

  • What's wrong / what should be happening instead: Ubuntu shouldn't have gone for no apparent reason with all my user files.

  • Strace of the failing command, if applicable:

  • For WSL launch issues, please [collect detailed logs] I was not logging during this incident happened. Right now the only problem is that my ~user files are gone and this is a brand new Ubuntu installation, my older one is gone.

What could be the problem? Could this be reversed? (I've checked if there is a backup of the rootfs dir in AppData to restore from there, at least retrieve but unluckily there was none)

engina avatar Mar 15 '20 12:03 engina

I have a similar issue. My Ubuntu boot into a different distribution, which seems to have a new wsl2-linux-kernel.

.# cat /proc/version Linux version 4.19.84-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Nov 13 11:44:37 UTC 2019

willyjchen avatar Mar 17 '20 02:03 willyjchen

I have a similar issue. My Ubuntu boot into a different distribution, which seems to have a new wsl2-linux-kernel.

.# cat /proc/version Linux version 4.19.84-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Nov 13 11:44:37 UTC 2019

File system is stored in %APPDATA%/Local/Packages/CanonicalGroupLimited.Ubuntu18.04....

If you have File History enabled maybe you can save your files. I was not as lucky. I hope you are.

Meanwhile anyone figure out why is this happening?

engina avatar Mar 17 '20 05:03 engina

@engina

You are on WSL1, correct, on build 18362.657?

@willyjchen

What build are you on? Are you on WSL2?

sirredbeard avatar Mar 17 '20 15:03 sirredbeard

I also just experienced this. This is wild - I've never seen a system where the OS would reinstall itself and wipe files before. Exactly the same symptoms as OP. Truly incredible. Do I reinstall everything and trust Windows / WSL not to do something so incredibly awful again? Do I give up on WSL and go back to dual booting? Do I buy a personal Macbook Pro? Just wow.

shelmire avatar Mar 28 '20 14:03 shelmire

I also just experienced this. This is wild - I've never seen a system where the OS would reinstall itself and wipe files before. Exactly the same symptoms as OP. Truly incredible. Do I reinstall everything and trust Windows / WSL not to do something so incredibly awful again? Do I give up on WSL and go back to dual booting? Do I buy a personal Macbook Pro? Just wow.

Yes, there's a psychological component to this. I'll have real hard time trusting WSL again. I literally transferred all the tiny bit of dev work I've started doing on WSL (VS Code remote) to macs again. (Not that macs are perfect...)

WSL design should be more transparent, even though I've read almost everything I've found still it was a mystery where the storage files are (WSL1 is on host FS, WSL2 is on a vdd), at least that way we could have a way to backup etc.

It's ironic that this happened the day after I've praised WSL developers in a public forum, saying; they must be real proud of what they've been doing so far, it's a real promising development environment.

Next day, poof, everything is gone. :)

Anyway, I'm thankful for the WSL project nonetheless. Great work guys! (Except for the loss of several users' data :))

engina avatar Mar 28 '20 15:03 engina

Did you use the undocumented option wsl.exe --upgrade by any chance? That option has been removed in recent builds because it can blow up your distro. #4094

onomatopellan avatar Mar 28 '20 16:03 onomatopellan

@onomatopellan Absolutely not. I haven't touch my Ubuntu / WSL in months at least.

What's worse? This happened again this morning - I open up vscode, expect it to open wsl without issue since I just reinstalled it on saturday. But nope. Gone again, mysteriously, with no action on my end. Maybe something about Windows restarting is causing this? Could be some auto-update feature that I didn't successfully turn off?

shelmire avatar Mar 30 '20 16:03 shelmire

@shelmire woah, that's really bad. You should use Event Viewer or Task Scheduler to see latest run tasks and at what time they were done. Maybe some disk optimization program is deleting your rootfs folder.

onomatopellan avatar Mar 30 '20 19:03 onomatopellan

@shelmire what version of Windows are you using? We identified a possible cause of this bug earlier and have implemented a fix in Windows builds 19002 or higher. See this comment for details: https://github.com/microsoft/WSL/issues/4469#issuecomment-543401572

craigloewen-msft avatar Mar 30 '20 21:03 craigloewen-msft

I have a similar issue. My Ubuntu boot into a different distribution, which seems to have a new wsl2-linux-kernel.

.# cat /proc/version Linux version 4.19.84-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Nov 13 11:44:37 UTC 2019

Just faced this issue and this reply gave me some clue. I just opened Windows Terminal Settings file and saw an additional Ubuntu distro, which I did not have. I removed it and then my wsl2 ubuntu showed up in the list of windows terminal shell programs

abdullahiphys avatar Dec 15 '20 18:12 abdullahiphys

I'm having a similar issue where every time I close / re-open a terminal window, all of my files disappear.

mrmos avatar Feb 28 '21 01:02 mrmos

Another possible source of this was fixed in Insider build 21370. In that case, we added a check during distro registration to better handle the case where the vhd file already exists and prevent it from overwriting the old copy. I understand that there may be existing versions of this issue, even with that fix, so I'm going to close this issue to ensure that existing cases get looked at appropriately.

bpulliam avatar May 07 '21 13:05 bpulliam

Pretty sure I just had my files (just in the home directory?) disappear. Only change I can think of was that I installed Visual Studio Code and the Remote - WSL extension. Microsoft Windows [Version 10.0.19043.1052] Fortunately this is a new computer and I still have the WSL on my old workstation. Going to restore to a different dist name. "Ubuntu" is probably a bit too generic.

Tehvan avatar Jun 22 '21 18:06 Tehvan

I frequently have files disappear. It's very easy to tell since I'm working in a repository and all of a sudden I get a long list of 'deleted' files. Also, the repository frequently corrupts and has to be reinstalled

(frequently = a couple times per year)

zachsa avatar Jun 30 '21 14:06 zachsa

I'm using WSL2 with Docker Desktop. This morning I experience Docker Desktop 'failing to initialize'. After investigation it turned out that the settings.json is filled with NULLs. After removing it, I managed to run it but the Ubuntu distro was gone. I opened MS Store and Launched (not reinstalled, just Launched!) Ubuntu and ended up with a fresh instance and all my files gone.

I understand that there might be bugs but how come is it allowed for MS Store/Ubuntu installer to overrride such sensitive data with no permission from the user whatsoever? This is unacceptable and I became yet another person who completely lost trust in WSL overnight.

Pramuspl avatar Jul 23 '21 12:07 Pramuspl

With me the problem started this morning when I turned on my PC and opened VS Code. WSL2 was somewhat working but, when I tried to run a server and open the URL through my browser on Windows, I was receiving ERR_CONNECTION_REFUSED.

So I've checked some configurations, firewall, and on my antivirus (Kaspersky Free), on the Settings, the protection through virtualization was active but there was a warning stating that neither the hardware nor the software were able to handle virtualization.

Then I proceeded to UEFI and checked if the SVM was enabled. For a test, I've disabled the option, restarted the PC, proceeded to desktop, shut down and reenabled SVM. But then the problem increased because now I wasn't even able to access WSL2, also none of the CMD commands were working.

I was then unable to open Ubuntu through MS Terminal or VS Code. VS Code was stating that "No distros were found", but when I looked on MS Store Ubuntu status was marked as Installed.

I was worried that I could lost all my settings and files but I've proceeded disabling / reenabling Linux Subsystem for Windows feature and it worked!

I cannot give you a more in depth analysis because I'm not very experienced using WSL2 but, somehow, something messed up with the configurations of it and by toggling the feature off / on fixed the issue.

mateusleon avatar Jul 27 '21 18:07 mateusleon

Encountered some variant of this today. Opened VSCode workspace and an error message came up saying that the project directory no longer exists. Found that my ubuntu user home directory was gone. In its place was a directory for wslg. A cursory Google search indicated that some people were able to get back their accounts and files by restarting. Worked.

evantkchong avatar Nov 18 '21 11:11 evantkchong

Incredible. I've been facing the same issues. Every time I restart my PC, my WSL distro installation magically disappears.

bitnahian avatar Dec 05 '21 23:12 bitnahian

Just to provide reference for others, in my case, the same problem occurs when I create content in the /dev directory, but for other directories, no such thing happened.

KamenRiderKuuga avatar Dec 08 '21 06:12 KamenRiderKuuga

I just restored a backup I took with acronis and WSL2 is just gone... I reeeaaaaaly needed the files to be there so I could renew some SSL certificates easily.

JVKeller avatar Dec 10 '21 18:12 JVKeller