'Windows Terminal profile not showing up

I've just installed WSL2 and am using the Windows Terminal on Win10 1909 (18363.1256). I'm trying to set up 2 different profiles, one that launches a local WSL2 Ubuntu shell, and one that launches another WSL2 shell that will automatically ssh to a specific host.

The local one works great, shows up without an issue, however I can't seem to get my 2nd profile to show up in the list of profiles.

My settings.json looks like this:

"profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
            "colorScheme": "One Half Dark",
            "fontFace": "JetbrainsMono NF",
            "fontSize": 11
        },
        "list":
        [
            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "//wsl$/Ubuntu/home/sensanaty",
                "tabTitle": "WSL2"
            },
            {
                "guid": "{15c5814b-7ed1-4cec-bc64-d165274958fa}",
                "hidden": false,
                "name": "External Host",
                "source": "Windows.Terminal.Wsl",
                "commandline": "ssh [email protected]",
                "tabTitle": "External Host"
            },
        ]
    },

With the above, I only get the Ubuntu profile in my list

enter image description here

I thought maybe it was the guid generated or something, but I just did a simple uuidgen and pasted it into the json so it shouldn't really be causing any issues there. I've also obviously tried restarting my system, to no avail. The default profiles show up fine if I disable the option to stop auto-generating them, as well.

Any clue as to what might help me out?



Solution 1:[1]

The 'source' attribute is for dynamically generated profiles, for which WSL will create one for each instance installed. You can't control the command line for these dynamically generated profiles. What you need is for your new profile to extend the command line to tell Terminal to use WSL. Remove the 'source' attribute entirely, so that your new profile is static.

In your case, that should be ...

            {
                "guid": "{15c5814b-7ed1-4cec-bc64-d165274958fa}",
                "hidden": false,
                "name": "External Host",
                //"source": "Windows.Terminal.Wsl",
                "commandline": "wsl.exe ssh [email protected]",
                "tabTitle": "External Host"
            }//, 

As bwolfbarn mentioned, you should also ditch that trailing comma if it really comes at the end of the "list" block.

Here are a few lines from mine as additional examples as well ...

            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu 20.04 WSL2 tmux",
                //"source": "Windows.Terminal.Wsl",
                "commandline": "wsl.exe -d Ubuntu -e sh -c \"/usr/bin/tmux has-session -t main 2>/dev/null && /usr/bin/tmux attach-session -d -t main || /usr/bin/tmux -2 new-session -t main -s main -c ${HOME}\"",
                "cursorShape": "filledBox"
            },
            {
                "guid": "{4e04fa7e-76c7-4746-a322-a227e70dde6c}",
                "hidden": false,
                "name": "Ubuntu 20.04 WSL1 tmux",
                //"commandline": "wsl.exe -d Ubuntu20.04_WSL1",
                "commandline": "wsl.exe -d Ubuntu20.04_WSL1 -e sh -c \"/usr/bin/tmux has-session -t main 2>/dev/null && /usr/bin/tmux attach-session -d -t main || /usr/bin/tmux -2 new-session -t main -s main -c ${HOME}\"",
                "cursorShape": "filledBox"
            }

Note that you could, I believe, use "wsl.exe -e" (a.k.a. --execute), but it's not really necessary in your case.

Solution 2:[2]

If you want to see your "source": "Windows.Terminal.Wsl" in Windows Terminal Menu it must exist in the registry [HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\{UUID}] (The registry UUID is not related to Windows Terminal UUID).

This registry entry can be created by running "wsl --import" or by cloning existing entry (if you are comfortable messing with the registry).

If you still don't see your profile after confirming that the registry entry exists, remove all entries for "generatedProfiles" in state.json file located in the same folder as settings.json. This will force Windows Terminal to update state.json. If you generated Windows Terminal profile UUID yourself, it may ignore it and create its own one. In this case you will see duplicate entries for the profile in settings.json. Remove the ones that were generated manually, and leave the one generated by the terminal.

Solution 3:[3]

At least the last comma should be removed (I commented it in your example) as the element "External Host" is the last of the list.

 [
            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "//wsl$/Ubuntu/home/sensanaty",
                "tabTitle": "WSL2"
            },
            {
                "guid": "{15c5814b-7ed1-4cec-bc64-d165274958fa}",
                "hidden": false,
                "name": "External Host",
                "source": "Windows.Terminal.Wsl",
                "commandline": "ssh [email protected]",
                "tabTitle": "External Host"
            }//, 
        ]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3 bwolfbarn