terminal: Windows Terminal keeps forgetting/can't find my default WSL Ubuntu profile
Environment
Windows build number: Version 1909 (OS Build 18363.900)
Windows Terminal version (if applicable): 1.0.1811.0
Any other software?
Ubuntu 18.04 LTS for WSL
Steps to reproduce
- WSL and Ubuntu 18.04 are already installed and configured.
- Install Windows Terminal from the Microsoft Store.
- Upon first installation, it will automatically pick up the Ubuntu profile
- Set the Ubuntu profile as default in
settings.json
- After e.g. restarting the pc, Windows Terminal can no longer find the default profile and does not list Ubuntu in the drop-down
Expected behavior
Ubuntu 18.04 for WSL to persist as the default profile that Windows Terminal uses when it launches.
Actual behavior
After e.g. restarting the pc, Windows Terminal can no longer find the default profile and does not list Ubuntu in the drop-down. The following error occurs when launching Windows Terminal: " Encountered errors while loading user settings Could not find your default profile in your list of profiles - using the first profile. Check to make sure the “defaultProfile” matches the GUID of one of your profiles. "
The defaultProfile guid matches that of the Ubuntu profile. JSON for Ubuntu profile:
{
"guid": "{some_guid}",
"hidden": false,
"name": "Ubuntu-18.04",
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/Ubuntu-18.04/home/my_username"
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 41 (12 by maintainers)
Happened to me (seemingly) after updating Docker for Windows.
Haven’t had any issues with WSL2 for months. I updated Docker for Windows from 2.4.0 to 2.5.0 as prompted by the tool recently. Had no issues with updating Docker for Windows in the past. This time too everything continued to work at first. But today the WSL option had disappeared from WT dropdown selection.
wsl.exe
was not responding at all. Docker for Windows too would get stuck in its Starting stage.What fixed it for me:
optionalfeatures.exe
as adminEnable-WindowsOptionalFeature -Online -FeatureName $("VirtualMachinePlatform", "Microsoft-Windows-Subsystem-Linux")
as adminIf you’d like to make startup fully deterministic and move back to manual control for WSL, here’s what you can do.
"disabledProfileSources": [ "Windows.Terminal.Wsl" ]
to the root node of your settings filesource
line from your WSL profile"commandline": "wsl -d Ubuntu-18.04"
"icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png"
to get the Tux icon backI encountered the same problem after installing the pre-release version along with the standard version that I have used for a long time. It seems that the pre-release one accidentally corrupted the setting file (but I didn’t notice anything weird when I was checking the setting.json).
Here is my solution:
Then, I get my WSL profile back.
I wonder if it’s something to do with
"source": "Windows.Terminal.Wsl"
, because when I comment this line out, it does seem to launch into Ubuntu. Although it’s not quite right, because it doesn’t set all the colour/font scheme settings I have, doesn’t have the Linux icon, and doesn’t like me passing in a starting directory.Here’s the full
settings.json
:By commenting out
"source"
and using"commandline" : "wsl -d Ubuntu-18.04"
(from the docs here ) instead, it seems to work more or less the same way as it does on a fresh install that uses"source"
So what do you think is happening with
"source": "Windows.Terminal.Wsl"
?I just had this problem today. Seems like Windows Terminal uses a sort of well-known GUID value for the WSL profile (it also does for PowerShell.Core). If you have custom profile using
"source": "Windows.Terminal.Wsl"
and the guid doesn’t match the expected value (for me it’s"{2c4de342-38b7-51cf-b940-2309a097f518}"
) then you get this error. In fact, if you don’t use this guid value in your custom profile, Terminal seems to add the “missing” profile automatically, and then you end up with two profiles using the samesource
but with differentguid
values.For a little bit of backstory… Terminal queries which WSL distributions exist every time it’s launched, by running
wsl -l
. That might seem strange, but it’s based on the official guidance from the WSL team. Now, sometimeswsl
fails to return anything in time. That used to cause Terminal to hang indefinitely on startup!I reached out to the dev lead who owns some of the WSL usermode experience, and he suggested that two seconds is “long enough” to give WSL to respond. Pursuant to that, we added a timeout: if WSL doesn’t respond within 2 seconds, Terminal will move on as though WSL is wedged, stalled or stopped. Our launch issues went away overnight!
It seems like you’re one of the suffering few that have lingering WSL issues. I might have to bounce you over to the WSL repository for this one, if only because they’ll know best how to handle an issue like this. 😕
When it was in a broken state, I would say yes, at least compared to now (no errors because I’m using
"commandLine"
rather than"source"
.) When it was broken, it would take a little while to list Ubuntu, and then a bit longer to complete the command. Now it’s instantaneous.Interesting. So, when you comment out
source
two things happen.When a profile has a source and a guid, Terminal queries to make sure that the source (in this case, “wsl”) still thinks it exists. When Terminal asks, unfortunately, WSL reports that there aren’t any installed distributions.
Are you running WT at a different user than your desktop session?
If you relaunch terminal some time later, does the Ubuntu profile show back up?