20

I have WSL 2 installed on my Windows 10 machine. I switched over to version 1 and upgraded from Ubuntu 18.04 to 19.04 using the do-release-upgrade command. I then tried to switch over to WSL 2, but I noticed the output of wsl -l -v is Ubuntu 18.04, not 19.04, but when running an Ubuntu prompt the output of lsb_release -a is accurately 19.04. I then tried moving the distro as named over to WSL 2 anyway, and received a

Exporting the distribution failed.
bsdtar: Write error

error. I am hoping that updating the name to the actual distro (19.04) will solve this issue. Any idea on how to do that? Probably it's in some config file for WSL?

2
  • Does that distribution works now as WSL2?
    – Biswapriyo
    Dec 4, 2019 at 8:30
  • Including the exact commands used when moving the distro would help diagnose the problem.
    – M.W.
    Aug 19, 2021 at 18:24

3 Answers 3

15

If you want to rename your WSL distro, you have to:

  1. Stop all instances of WSL
  2. Open Registry Editor and go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss
  3. Find the distro you want to rename, look for the DistributionName
  4. Change it as you want
  5. Start WSL again, you can also execute wsl.exe -l -v to check if it changes
4
  • 1
    Now how do we get vscode to stop throwing errors do to an outdated reference somewhere? I'm getting errors that include the following, which refers to the old distro name, not the newer 20.04 one. ENOPRO: No file system provider found for resource 'vscode-remote://wsl%2Bubuntu18.04/home/...
    – rainabba
    Nov 22, 2021 at 17:11
  • And how to update the original App shortcut: WslRegisterDistribution failed with error: 0x80070050 The file exists.. Its Properties/Target is inactive. This answer is either incomplete or even potentially harmful.
    – bloody
    Nov 25, 2021 at 19:36
  • 1
    @rainabba Restarting the LxssManager service has solved this. Thanks to the other answer for mentioning it.
    – mtman
    Jan 31 at 20:46
  • This still worked for me, even with the latest WSL 2 (that includes WSLg). I kind of thought it wouldn't.
    – GregRos
    Nov 4 at 19:52
6

(1): Open the Windows registry editor (regedit), and paste the following URI in its adddress bar:

Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss

(2): In the left-side navigation pane, look for a folder that looks like this {xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx}. (The folder name contains all Hexadecimal digits). Double-click to enter it.

(3): In the right-side navigation pane, double-click the REG_SZ item called DistributionName, and edit its content to whatever you want. Save it.

(4): Finally, restart wsl.

  • Press: Win + R on your PC.
  • Type services.msc into the search box that pops up.
  • In Services Manager tool that pops up, find the LxssManager entry in the list, and restart it.

That should do it.

NOTE: Do not skip step (4), because doing so will cause some wsl applications launch with errors. For example, Visual Studio Code will not launch correctly because wsl has not been refreshed / restarted.

PS: Don't forget to edit the launch property of your application launch icons. Any of them specifying the -d distroName option to wsl.exe [...] or wslg.exe [...] will need to be edited.

2

Just ran into this myself. Though it's basically just cosmetic and only comes up when running WSL specific commands, I wanted to keep things from getting confusing in the future.

What I ended up using LxRunOffline to duplicate my Distro, which in the process allows you to name the duplicate, setting the duplicate as default, and then uninstalling my old Distro.

Example of what I did(ran in powershell from my user's home directory):

#List installed Distros
LxRunOffline.exe l
#Duplicate Ubuntu-18.04 to folder in my user directory and name it Ubuntu
LxRunOffline.exe d -n Ubuntu-18.04 -d ./WSL/Ubuntu -N Ubuntu
#Set new Distro as default
LxRunOffline.exe sd -n Ubuntu
#Uninstall old Distro
LxRunOffline.exe ui -n Ubuntu-18.04

PS: To be clear, the WSL listed name of your Distro is unrelated to what is really running inside the Distro. So you just have to use the current name WSL currently lists, in the WSL2 convert command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.