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
settings.jsonUbuntu 18.04 for WSL to persist as the default profile that Windows Terminal uses when it launches.
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"
}
If you relaunch terminal some time later, does the Ubuntu profile show back up?
No, it seems to lose track of it forever.
Can you share the output of wsl -l -v --all? If that fails, can you just run wsl -l?
It didn't like the -v flag, but wsl -l gives:
Windows Subsystem for Linux Distributions:
Ubuntu-18.04 (Default)
Wow, this is really unexpected. Can you share your entire settings.json?
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:
// This file was initially generated by Windows Terminal 1.0.1811.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
},
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "Command Prompt",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
"hidden": false,
"name": "Ubuntu-18.04",
"source": "Windows.Terminal.Wsl",
"startingDirectory": "//wsl$/Ubuntu-18.04/home/<user>",
"colorScheme": "Ubuntu",
"fontFace": "DejaVuSansMono"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}
]
},
// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes": [
{
"name": "Ubuntu",
"background": "#300a24",
"foreground": "#eeeeec",
"black": "#2e3436",
"red": "#cc0000",
"green": "#4e9a06",
"yellow": "#c4a000",
"blue": "#3465a4",
"purple": "#75507b",
"cyan": "#06989a",
"white": "#d3d7cf",
"brightBlack": "#555753",
"brightRed": "#ef2929",
"brightGreen": "#8ae234",
"brightYellow": "#fce94f",
"brightBlue": "#729fcf",
"brightPurple": "#ad7fa8",
"brightCyan": "#34e2e2",
"brightWhite": "#eeeeec"
}
],
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
}
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?
Yeah that's basically what happens. I'm running WT as the same user. It's so odd because whenever I do a fresh install of WT it always works fine, and then at some point it just breaks.
Is there some hidden guid that my Ubuntu installation has that causes a conflict?
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"?
So, going out even further on a limb ... does it take a while for wsl to respond when you run wsl -l or start up Ubuntu?
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.
Also, erm, now if I comment out the commandLine option and uncomment source, it works...
It's like running it using commandLine has made it remember about WSL. Though I suspect this fix won't last?
When it was broken, it would also take some time to launch and close down Terminal. Especially closing down - it would quit the UI but the application would stay 'active' in the taskbar for a little while.
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, sometimes wsl 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. 馃槙
If 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 backNote that doing this will disable all WSL distribution autodetection!
Interesting! Well, for my circumstances the fact that I can use the "commandLine" option as a permanent fix is fine; I'm not worried about auto-detecting additional WSL distributions. I suppose any number of things could be causing WSL to be a bit slow? Whatever's happening is somewhat inconsistent as I've restarted my machine in the past few hours, which has always caused it to break in the past, and now it's fine. The only thing in the chain of events I've done differently is temporarily removing "source" and adding "commandLine": "wsl -d Ubuntu-18.04", which brought recognition of the default profile back, and then removing "commandLine" and putting "source" back in.
Regardless, I'm fine with the proposed solution and don't personally need further investigation (although I am personally curious!). Thanks for your help, that's some great detective work.
And of course getting Tux back is the most important thing ;)
Much appreciated. Thanks for debugging with me! :smile:
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 same source but with different guid values.
If you have a profile with a source _that the source doesn't know about_, it will be ignored. The GUID is the only way it can know. :smile:
If you add a custom profile with a source, it's not likely to work unless that profile was actually generated by that source.
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 admin
Most helpful comment
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.exewas not responding at all. Docker for Windows too would get stuck in its Starting stage.What fixed it for me:
optionalfeatures.exeas adminEnable-WindowsOptionalFeature -Online -FeatureName $("VirtualMachinePlatform", "Microsoft-Windows-Subsystem-Linux")as admin