Replies: 2 comments
-
I should be specific about the file that is being reverted - /etc/hosts. I added an entry. Also forgot to mention, session gets closed prematurely without any trace... I think my whole subsystem is in a real bad shape. But I don't know best way to reset it now... |
Beta Was this translation helpful? Give feedback.
-
Hello, I have been interested in WSL2 recently. I think I can help you with some issues. File Recovery on WSLI know a way to access files through the NTFS file system. Open Windows Explorer and enter the following expression:
Picture 1. Entering \\wsl$ in the windows explorer
Picture 2. Selecting the Linux distribution to recover the file
Picture 3. Copying files/projects to be recovered to the NTFS file system
This way, you can access the project files you are working on. You can use VS Code Studio and Git when working with WSL to avoid data loss. You can check the WSL version assigned to each of the Linux distributions you have installed by opening the PowerShell command line and entering the command (only available in Windows Build 18362 or higher): (Resource: Set your distribution version to WSL 1 or WSL2) wsl --list --verbose
Picture 4. Ubuntu is running on WSL 2.
To set a distribution to be backed by either version of WSL please run: (Resource: Set your distribution version to WSL 1 or WSL2) wsl --set-version <distribution name> <versionNumber>
# Use Case: https://github.com/microsoft/WSL/discussions/5645#discussioncomment-135169
I think the Ubuntu 18.04 user directory will not be deleted during the system upgrade (Ubuntu 18.04 > Ubuntu 20.04 / WSL 1 > WSL 2). You can change the default WSL distribution: # Convert an existing WSL1 distro to WSL2 from PowerShell
wsl --set-version Ubuntu 2
Picture 5. Ubuntu 20.04 will be run on WSL2
Bash Session RecordsYou can view the .bash_history log in your user directory to see the last commands used on the command line. .bash_history is a text file that can be opened in notepad.
Picture 6. .bash_history command history log
Uninstall WSLWSL distributions installed from the store can be uninstalled like any other Windows app, by right-clicking on the app tile and clicking Uninstall, or via PowerShell using the Remove-AppxPackage cmdlet. Resource: How do I uninstall a WSL Distribution? Open command prompt with administrator rights and run the following command: lxrun /uninstall /full Reinstall WSLYou can follow the manual steps in the document during the reinstallation phase. When you run PowerShell during the setup again, it should have administrator permissions. |
Beta Was this translation helpful? Give feedback.
-
I've upgraded to WSL 2 following the instruction provided. Since than, any changes I apply to files on subsystem are GONE!
I tried converting ubuntu 18 to v2. No errors. But does not fix the issue either.
I tried both reset and repair Ubuntu installation. Did not help.
I've installed 20.04 LTS and removed 18.04 LTS. SAME ISSUE. I ended up loosing all my data also... aghghghg
I am lost. Is this a known issue? How do I fix this...
Beta Was this translation helpful? Give feedback.
All reactions