microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.54k stars 823 forks source link

Allow WSL distros to change their WSL name #4241

Open sirredbeard opened 5 years ago

sirredbeard commented 5 years ago

We rebranded WLinux to Pengwin.

We maintained the WLinux name in the WSL API 1 in order to avoid breakage 2.

However this means Pengwin still appears as \WSL$\WLinux in Explorer.

It also means Pengwin appears as WLinux in the new Terminal application.

We could issue a new package of Pengwin in the Store with the new name in the API, offering it for free to everyone who has bought the old Pengwin, but it would mean a lot of links to the old package would break and would cause user confusion.

If down the line it becomes possible to rename WSL distros or identify them with a specific UUID and string that can change, it would be much appreciated.

Thank you.

rwenz3l commented 4 years ago

I second this with my point being that it would be cool for users to change the distro names to something more console friendly. Having to type wsl -d Ubuntu-18.04 when I want to switch quickly is annoying. Maybe smething like wsl --rename-distribution Ubuntu-18.04 ubuntu.

gcalis commented 4 years ago

[DISCLAIMER: Do not mess with your registry if you don't know what you're doing, it might break your Windows installation! Treat the Registry Editor like sudo: "With great power, comes great responsibility" ]

Having said that, this is an easy (and as far as I can see harmless) hack using the Registry editor: I renamed the distro by changing the following key: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss{xxxxxxxxx-YOUR-GUID-HERE-xxxxxxxx}\DistributionName

  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 het key DistributionName
  4. Change the key DistributionName to the desired value
  5. Start WSL again and browse to \\wsl$ to find your renamed distro, or execute wsl.exe -v -l

I put this here for those who cannot wait any longer and have to flinch every time they see distro Ubuntu-18.04 or WLinux listed when they are in fact running Ubuntu 20.04 or Pengwin.

begetan commented 4 years ago

@gcalis It helps to rename distro in wsl list, but doesn't change installed app, so application won't start from the Start menu after registry change.

ouwyukha commented 4 years ago

@gcalis It helps to rename distro in wsl list, but doesn't change installed app, so application won't start from the Start menu after registry change.

is there any way to fix this issue?

rwenz3l commented 4 years ago

I can imagine instead of replacing the actual value, you could create a new registry entry with the desired name? That leaves you with 2 entries per distro, but may work for both entrypoints then (not tested!). This is a hack either way.

4lph4-Ph4un commented 4 years ago

This would be really nice, as people who update their distros with do-release-upgrade-route get an updated distro that is listed by their previous version in wsl -l and have their start menu executables by their old name which can get pretty confusing.

oising commented 4 years ago

Arse. And I thought this would be an easy fix.

nguyentamgm commented 3 years ago

Hey, I just had the same issue and I found the solution

Step 1: Enter settings by pressing "Ctrl + ," Step 2: Modify the name from distro's profile

{
    "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
    "hidden": false,
    "name": "Ubuntu (RENAME HERE)",
    "source": "Windows.Terminal.Wsl",
    "useAcrylic": true, 
    "acrylicOpacity": 0.9,
    "fontFace": "CodeNewRoman Nerd Font"
}

Step 3: Save the change Step 4: Restart Terminal and see the result

🚀🚀🚀

watermarkhu commented 3 years ago

@nguyentamgm That doesn't solve the problem. What you've done is changing the tab name within Windows Terminal. But the issue here is that the listing under wsl -l is still unchanged.

ghost commented 3 years ago

I have had success renaming a WSL2 distribution by exporting the image as a .tar file to another location, then reimporting it with the new name. This sets up everything appropriately from what I can tell, except the Start Menu short-cuts to open the distro terminal. If anyone finds out how to get those sorted, I'd love to know.

However, no problems remoting into them with VS Code + extension, or via Windows Terminal(s), etc.

adambirds commented 2 years ago

Any update on when this will be possible?

Acumane commented 2 years ago

I have had success renaming a WSL2 distribution by exporting the image as a .tar file to another location, then reimporting it with the new name. This sets up everything appropriately from what I can tell, except the Start Menu short-cuts to open the distro terminal.

Has anyone tried this wsl --export/--import trick on a distro from the MS store? If so, were app updates broken afterwards?

garyo commented 1 year ago

Would love to see this too. All my distros now have ancient names that no longer reflect what's running in them.

wuxu92 commented 1 year ago

Is there any update or a schedule on this feature?

pashagolub commented 1 year ago

I would be delighted to observe this as well. All the operating systems I use now have old-fashioned labels that don't accurately reflect what is running on them.

mendhak commented 1 year ago

I'd like this feature please, we are running scripts to set WSL up for developers and it would be important to set the name of the distro as seen in the wsl -l list so it reflects what it is accurately. This will greatly help us with troubleshooting too.

As an example, at the moment the distro just gets imported as "Ubuntu" but it might be 18.04 or 20.04 or 22.04

thenger commented 1 year ago

I think this should be an easy Quality of Life improvement.

Can this issue be more prioritized because it is a "quick win" ? (if it is)

mwoodpatrick commented 1 year ago

I would love to have this feature rather than having to do one of the workarounds

xuanswe commented 1 year ago

Hm, having custom name for each WSL instance is required if we want multiple instances from the same distro. Currently, this is the workaround for both issues: https://endjin.com/blog/2021/11/setting-up-multiple-wsl-distribution-instances

aquette commented 11 months ago

upping on the wsl --rename-distribution proposal. a real Quick-Win: it would not cost much to implement, but would definitely make our developers' life easier ;)

Jplus2 commented 10 months ago

Any update on this?

jasonkenneth commented 8 months ago

bump

ztarem commented 1 month ago

4 years... Typical Microsoft response time, right?

HarveyJMartin commented 1 month ago

Would be great to see this happen !