terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Terminal loses the defaultProfile when set to one of Canonical's Ubuntu fragments

Open bluser86 opened this issue 3 years ago • 8 comments

Windows Terminal version

1.14.2281.0

Windows build number

10.0.19043.0

Other Software

No response

Steps to reproduce

Through this this reddit thread DHowett urged me to open an issue.

I changed the default profile to my WSL distro and the colorscheme and fontsettings for this profile. I believe installing the latest windows updates broke my profile and reset my settings to default showing this error. My settings were changed back to default (Powershell as standard profile, WSL profile colorscheme and font settings back to defaults).

I had the same happen on my Windows 11 workstation.

Here is the settings.json from my Win10 desktop (I had already fixed my settings)

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": [],
    "defaultProfile": "{59b72ad2-09f7-55ec-af87-65d062af8472}",
    "profiles": 
    {
        "defaults": 
        {
            "bellStyle": "none"
        },
        "list": 
        [
            {
                "bellStyle": "none",
                "colorScheme": "Dracula",
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "bellStyle": "none",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "cmd"
            },
            {
                "bellStyle": "none",
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": true,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{3984afef-440c-559b-8f33-5fcf304dbdf5}",
                "hidden": true,
                "name": "Developer Command Prompt for VS 2019",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{156e4d1e-3d62-5f80-acb2-5801576d863d}",
                "hidden": true,
                "name": "Developer PowerShell for VS 2019",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                "hidden": true,
                "name": "Ubuntu-20.04",
                "source": "Windows.Terminal.Wsl"
            },
            {
                "colorScheme": "One Half Dark",
                "font": 
                {
                    "size": 10
                },
                "guid": "{59b72ad2-09f7-55ec-af87-65d062af8472}",
                "hidden": false,
                "name": "Ubuntu 20.04.5 LTS",
                "source": "CanonicalGroupLimited.Ubuntu20.04LTS_79rhkp1fndgsc"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#282A36",
            "black": "#21222C",
            "blue": "#BD93F9",
            "brightBlack": "#6272A4",
            "brightBlue": "#D6ACFF",
            "brightCyan": "#A4FFFF",
            "brightGreen": "#69FF94",
            "brightPurple": "#FF92DF",
            "brightRed": "#FF6E6E",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFFA5",
            "cursorColor": "#FFFFFF",
            "cyan": "#8BE9FD",
            "foreground": "#F8F8F2",
            "green": "#50FA7B",
            "name": "Dracula",
            "purple": "#FF79C6",
            "red": "#FF5555",
            "selectionBackground": "#FFFFFF",
            "white": "#F8F8F2",
            "yellow": "#F1FA8C"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#FFFFFF",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#300A24",
            "black": "#171421",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#08458F",
            "brightCyan": "#2C9FB3",
            "brightGreen": "#26A269",
            "brightPurple": "#A347BA",
            "brightRed": "#C01C28",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#A2734C",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#FFFFFF",
            "green": "#26A269",
            "name": "Ubuntu-20.04-ColorScheme",
            "purple": "#881798",
            "red": "#C21A23",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#A2734C"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        }
    ]
}

Expected Behavior

After an update I would like my settings to remain the way they were

Actual Behavior

My terminal settings got reset to defaults showing an error message about the default GUID not matching any of my profile GUIDs.

bluser86 avatar Sep 14 '22 19:09 bluser86

What's the output of

wsl --list --all -v

I wonder if the underlying source got lost, so the default profile, which should be Ubuntu 20.04.5 LTS, got lost

zadjii-msft avatar Sep 14 '22 19:09 zadjii-msft

(fat fingered close, sorry)

zadjii-msft avatar Sep 14 '22 19:09 zadjii-msft

What's the output of

wsl --list --all -v

I wonder if the underlying source got lost, so the default profile, which should be Ubuntu 20.04.5 LTS, got lost

PS C:\Users\Berry> wsl --list --all -v
  NAME                   STATE           VERSION
* docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2
  Ubuntu-20.04           Running         1

bluser86 avatar Sep 14 '22 19:09 bluser86

(Thanks for filing this!)

This is the part that worries me. The Ubuntu application was shipping a fragment, and now they're possibly not!

                "guid": "{59b72ad2-09f7-55ec-af87-65d062af8472}",
                "hidden": false,
                "name": "Ubuntu 20.04.5 LTS",
                "source": "CanonicalGroupLimited.Ubuntu20.04LTS_79rhkp1fndgsc"
                          ^^^^^

Would you mind running Get-AppxPackage CanonicalGroup* | fl * in PowerShell? I wonder if there was a package update recently that changed something about their profile setup.

DHowett avatar Sep 14 '22 21:09 DHowett

Here ya go

PS C:\Users\Berry> Get-AppxPackage CanonicalGroup* | fl *


Name                   : CanonicalGroupLimited.Ubuntu20.04LTS
Publisher              : CN=23596F84-C3EA-4CD8-A7DF-550DCE37BCD0
PublisherId            : 79rhkp1fndgsc
Architecture           : X64
ResourceId             :
Version                : 2004.5.11.0
PackageFamilyName      : CanonicalGroupLimited.Ubuntu20.04LTS_79rhkp1fndgsc
PackageFullName        : CanonicalGroupLimited.Ubuntu20.04LTS_2004.5.11.0_x64__79rhkp1fndgsc
InstallLocation        : C:\Program Files\WindowsApps\CanonicalGroupLimited.Ubuntu20.04LTS_2004.5.11.0_x6
                         4__79rhkp1fndgsc
IsFramework            : False
PackageUserInformation : {}
IsResourcePackage      : False
IsBundle               : False
IsDevelopmentMode      : False
NonRemovable           : False
Dependencies           : {Microsoft.VCLibs.140.00.UWPDesktop_14.0.30704.0_x64__8wekyb3d8bbwe, CanonicalGr
                         oupLimited.Ubuntu20.04LTS_2004.5.11.0_neutral_split.scale-100_79rhkp1fndgsc}
IsPartiallyStaged      : False
SignatureKind          : Store
Status                 : Ok

bluser86 avatar Sep 14 '22 21:09 bluser86

Do you recall whether the profile at one point called itself "Ubuntu 20.04.4" or "20.04.3"? I cracked open their profile customization and noticed that they didn't specify a permanent unique identifier for it, so it'll get autogenerated based on the name. If they release a package that updates the name, it'll invalidate all other references to that profile...

Hmmmm. I don't love this state of affairs.

DHowett avatar Sep 14 '22 21:09 DHowett

I'm a afraid I can't say for certain. :(

bluser86 avatar Sep 14 '22 21:09 bluser86

@DHowett's gonna take the action item here to follow up with Canonical.

tldr of a teams thread:

  • Their fragments define new profiles for their distro. They do this probably because the dynamic profile won't exist until ubuntu.exe has been run at least once.
  • Their fragment profiles don't define a GUID, but they do ship a name. Terminal generates a GUID for that profile on their behalf.
  • When you set that profile as the default, Terminal sets the guid of the profile as the defaultProfile.[1]
  • When the app gets updated, they change the name of the profile. This results in a new GUID being generated for the fragment.
  • Now when you launch the Terminal, the old GUID does not point at a valid profile. This throws the warning.

they should: (1) freeze the guid for this package to the current autogenerated one, (2) same for all EXISTING packages and (3) for all new ones, just generate guids

[1]: this issue would ultimately still happen even if we used the name of the profile, because the profile would change names. But maybe we could surface the error better? We were expecting a profile with the name "foo".


collected issues with Canonical's distro profiles

  • #14003 (this thread)
    • because the guid changes, the defaultProfile is now invalid
  • #12961
    • Because they're using ubuntu.exe as the commandline, when we change the startingDirectory, that's ignored by ubuntu.exe
  • #14233
    • We don't know which WSL distro is associated with their profiles, so we don't know how to translate windows paths into WSL-relative ones for them.
  • #15347
    • People are pretty easily confused when they try to customize "Ubuntu" and end up customizing the wrong thing.

zadjii-msft avatar Sep 15 '22 11:09 zadjii-msft