Skip to content

FailFast: The terminfo database is invalid (Integrated Terminal) #1288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
codywd opened this issue Apr 25, 2018 · 31 comments
Closed

FailFast: The terminfo database is invalid (Integrated Terminal) #1288

codywd opened this issue Apr 25, 2018 · 31 comments
Labels
Issue-Bug A bug to squash.

Comments

@codywd
Copy link

codywd commented Apr 25, 2018

System Details

  • Operating system name and version: Arch Linux (Kernel 4.16)

  • VS Code version: 1.22.2
    3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9
    x64

  • PowerShell extension version: 1.6.0

  • Output from $PSVersionTable:
    PSVersion 6.0.2
    PSEdition Core
    GitCommitId v6.0.2
    OS Linux 4.16.3-1-ARCH Create Yeoman generator for PowerShell projects #1 SMP PREEMPT Thu Apr 19...
    Platform Unix
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1
    WSManStackVersion 3.0

Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:
[codywd@cody-linux PowerShell]$ pwsh
PowerShell v6.0.2
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /home/codywd/Projects/PowerShell> code -v
1.22.2
3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9
x64
PS /home/codywd/Projects/PowerShell> $pseditor.EditorServicesVersion
PS /home/codywd/Projects/PowerShell> code --list-extensions --show-versions
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
PS /home/codywd/Projects/PowerShell> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.2
PSEdition                      Core
GitCommitId                    v6.0.2
OS                             Linux 4.16.3-1-ARCH #1 SMP PREEMPT Thu Apr 19 09:17:56 UTC 2018
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Description

This is directly related to issue #6132 with PowerShell Core (PowerShell/PowerShell#6132)

On Arch Linux, the PowerShell integrated shell can not open without manually opening the integrated terminal (after it crashes due to this error), and typing in TERM=xterm pwsh. However, intellisense and everything else continues to not work.

Starting code from terminal with TERM=xterm code also does not work, with the same crash.

Are there any workarounds for this issue?

Attached Logs

4/25/2018 2:14:15 PM [NORMAL] - Visual Studio Code v1.22.2 64-bit
4/25/2018 2:14:15 PM [NORMAL] - PowerShell Extension v1.6.0
4/25/2018 2:14:15 PM [NORMAL] - Operating System: Linux 64-bit
4/25/2018 2:14:15 PM [NORMAL] - Language server starting --
4/25/2018 2:14:15 PM [NORMAL] - exe: /usr/bin/pwsh
4/25/2018 2:14:15 PM [NORMAL] - args: /home/codywd/.vscode/extensions/ms-vscode.powershell-1.6.0/scripts/Start-EditorServices.ps1 -EditorServicesVersion '1.6.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath '/home/codywd/.vscode/extensions/ms-vscode.powershell-1.6.0/modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath '/home/codywd/.vscode/extensions/ms-vscode.powershell-1.6.0/logs/1524680055-f11d6665-68a6-45fc-860c-d53ca8d865661524680053653/EditorServices.log' -SessionDetailsPath '/home/codywd/.vscode/extensions/ms-vscode.powershell-1.6.0/sessions/PSES-VSCode-8842-464466' -FeatureFlags @()
4/25/2018 2:14:15 PM [NORMAL] - powershell.exe started, pid: 9227
4/25/2018 2:14:16 PM [NORMAL] - powershell.exe terminated or terminal UI was closed
4/25/2018 2:15:15 PM [NORMAL] - Language server startup failed.
4/25/2018 2:15:15 PM [ERROR] - The language service could not be started:
4/25/2018 2:15:15 PM [ERROR] - Timed out waiting for session file to appear.

@TylerLeonhardt
Copy link
Member

Thanks for the report!

Can you try adding this to your user settings?

"powershell.powerShellAdditionalExePaths": [
        {
            "versionName": "with-xterm-env-var",
            "exePath": "TERM=xterm pwsh"
        }
    ]

and then also add this:

"powershell.powerShellDefaultVersion": "with-xterm-env-var"

I'm hoping the right environment variable gets set for you in the Integrated Console process.

@codywd
Copy link
Author

codywd commented Apr 26, 2018

Is this much different than setting PowerShell.PowershellExePath to TERM=xterm pwsh? I tried that and received an error stating the executable wasnt found at that path. I also tried setting it to TERM=xterm /use/bin/pwsh with the same result. I am away from my computer at the moment, but I will try this tomorrow

@TylerLeonhardt
Copy link
Member

interesting. Should be the same result but worth a shot.

@dargmuesli
Copy link

Seems like this is fixed upstream. The next update should solve this.

@codywd
Copy link
Author

codywd commented May 6, 2018

@tylerl0706 Just got around to testing this and it still fails with the same error. This is exactly what I typed in user settings

{
   "powershell.powerShellAdditionalExePaths": [
       {
           "versionName": "with-xterm-env-var",
           "exePath": "TERM=xterm pwsh"
       }
    ],
    "powershell.powerShellDefaultVersion": "with-xterm-env-var"
}

@dargmuesli dotnet seems to work, but PowerShell still crashes with this.

@TylerLeonhardt
Copy link
Member

I think we may need to add another property in that json called environmentVariables or something. I think we're checking the path of the pwsh so that fails because of the environment variable before it.

@codywd
Copy link
Author

codywd commented May 6, 2018

@tylerl0706 If this is done, please let me know and I'll definitely implement it in my VSCode immediately. I'll try any beta builds for this fix as well.

I also forgot to mention, this same error occurs on VSCode 1.23 (which probably would have made a difference anyway)

Another quick update, I looked at the session log for the latest launch and the following error is shown:

5/6/2018 4:49:06 PM [NORMAL] - Path specified by 'powerShellExePath' setting - 'TERM=xterm pwsh' - not found, reverting to default PowerShell path.

Another update,

Setting terminal.integrated.env.linux to { "TERM": "xterm" } does not fix this either.

@rkeithhill
Copy link
Contributor

Yeah, the extension code is being too clever and trying to verify the "file" at the exePath exists. :-( We could change that - treat this setting as a "sharp stick" kind of setting.

@TylerLeonhardt
Copy link
Member

@rkeithhill I like that! Especially since adding env vars to PSES is very rare. We could have a small addition to the description that says

"supports passing environment variables: FOO=1 pwsh"

Looks like the check is here:
https://github.com/PowerShell/vscode-powershell/blob/master/src/session.ts#L305

I think we might be able to just remove that check and things should work for this scenario. I wonder what error message is thrown when you DO supply a wrong path.

This is a relatively trivial change if @codywd you (or anyone else lurking) would like to give it a try!

Otherwise @rkeithhill or I can get to it.

@rkeithhill
Copy link
Contributor

rkeithhill commented May 8, 2018

We are using the vscode.createTerminal() overload that takes shellPath and shellArgs. However, there is an overload that takes a TerminalOptions object which allows us to set env vars before invoking the terminal. I propose that we modify the schema of additional exe paths like so:

"powershell.powerShellAdditionalExePaths": [
        {
            "versionName": "with-xterm-env-var",
            "exePath": "pwsh"
            "env": [
                "TERM": "xterm"
            ]
        }
    ]

As a workaround can you try this - put this in your settings file:

"terminal.integrated.env.linux": {
    "TERM": "xterm"
}

Then use the default PowerShell Core 6.0.2 session.

@TylerLeonhardt
Copy link
Member

@rkeithhill I definitely liked the

"env": [
                "TERM": "xterm"
            ]

Idea more than removing the check. It's polished and feels less "hacky" to me.

+1 for adding env!

@avbor
Copy link

avbor commented May 15, 2018

Hi.
I can not get to work powershell plugin in fedora 28 with this settings:

{
    "powershell.powerShellAdditionalExePaths": [{
        "versionName": "with-xterm-env-var",
        "exePath": "/usr/bin/pwsh",
        "env": [{"TERM": "xterm"}]
    }],
    "powershell.powerShellDefaultVersion": "with-xterm-env-var",
    "terminal.integrated.env.linux": {
        "TERM": "xterm"
    }
}

Errors in log:

5/15/2018 11:15:07 AM [NORMAL] - powershell.exe started, pid: 14644
5/15/2018 11:15:07 AM [NORMAL] - powershell.exe terminated or terminal UI was closed
5/15/2018 11:16:06 AM [NORMAL] - Language server startup failed.
5/15/2018 11:16:06 AM [ERROR] - The language service could not be started: 
5/15/2018 11:16:06 AM [ERROR] - Timed out waiting for session file to appear.

What else can I try to do?

@rkeithhill
Copy link
Contributor

rkeithhill commented May 15, 2018

Try it with these settings - note there is no env support directly in powerShellAdditionalExePaths at this time:

{
    "powershell.powerShellAdditionalExePaths": [{
        "versionName": "with-xterm-env-var",
        "exePath": "/usr/bin/pwsh"
    }],
    "powershell.powerShellDefaultVersion": "with-xterm-env-var",
    "terminal.integrated.env.linux": {
        "TERM": "xterm"
    }
}

From my experiments in Windows, this creates the PowerShell Integrated Console with the specified environment variables defined.

@avbor
Copy link

avbor commented May 15, 2018

Nope, that did not help me:

5/15/2018 5:54:46 PM [NORMAL] - Visual Studio Code v1.23.1 64-bit
5/15/2018 5:54:46 PM [NORMAL] - PowerShell Extension v1.7.0
5/15/2018 5:54:46 PM [NORMAL] - Operating System: Linux 64-bit
5/15/2018 5:54:46 PM [NORMAL] - Language server starting --
5/15/2018 5:54:46 PM [NORMAL] -     exe: /usr/bin/pwsh
5/15/2018 5:54:46 PM [NORMAL] -     args: /home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules/PowerShellEditorServices/Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.7.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/logs/1526396086-de5df260-d80e-4ddc-b286-84a73f97a52f1526396083052/EditorServices.log' -SessionDetailsPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/sessions/PSES-VSCode-22617-213627' -FeatureFlags @()
5/15/2018 5:54:46 PM [NORMAL] - powershell.exe started, pid: 22882
5/15/2018 5:54:47 PM [NORMAL] - powershell.exe terminated or terminal UI was closed
5/15/2018 5:55:46 PM [NORMAL] - Language server startup failed.
5/15/2018 5:55:46 PM [ERROR] - The language service could not be started: 
5/15/2018 5:55:46 PM [ERROR] - Timed out waiting for session file to appear.

@rkeithhill
Copy link
Contributor

Can you change your user setting for powershell.developer.editorServicesLogLevel to Diagnostic so we get some more log output during startup? Also, since PowerShell seems to be starting but then crashing, can you attach the EditorServices.log file that gets created? Instructions for that are here - https://github.com/PowerShell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us

@avbor
Copy link

avbor commented May 15, 2018

Very strange, but powershell.developer.editorServicesLogLevel do nothing for me =(

settings.json.txt
vscode-powershell.log

@rkeithhill
Copy link
Contributor

The important log file we need is the EditorServices.log file. Look under your ~/.vscode/extensions/ms-vscode.powershell-1.7.0/logs folder for the latest dated folder, then grab the EditorServices.log file from that dir and attach it here.

@avbor
Copy link

avbor commented May 16, 2018

I understand, but i don't have those file =(
image

@rkeithhill
Copy link
Contributor

rkeithhill commented May 16, 2018

Hmm... Let me check to see if we are writing it to a different location on Linux. @tylerl0706 where do the extension log files go on your Mac?

@avbor
Copy link

avbor commented May 16, 2018

I know. But he's not there.

@rkeithhill
Copy link
Contributor

rkeithhill commented May 16, 2018

@avbor Is PowerShell Core supported on Fedora 28? From this list of PS Core installs I only see 25 and 26 as supported.

Can you manually start PowerShell Core with TERM=xterm pwsh? If so, run this command from PS Core:

/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules/PowerShellEditorServices/Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.7.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/logs/1526396086-de5df260-d80e-4ddc-b286-84a73f97a52f1526396083052/EditorServices.log' -SessionDetailsPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/sessions/PSES-VSCode-22617-213627' -FeatureFlags @()

Does anything of interest get output to the console?

@avbor
Copy link

avbor commented May 21, 2018

Supported or now - i dont know =)
i take rpm package for fedora 26 and install it.
pwsh work fine with TERM=xterm.
With this command i get nothing on console =(
image
EditorServices.log

@avbor
Copy link

avbor commented May 21, 2018

image

@TylerLeonhardt
Copy link
Member

/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules/PowerShellEditorServices/Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.7.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules' -EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/logs/1526396086-de5df260-d80e-4ddc-b286-84a73f97a52f1526396083052/EditorServices.log' -SessionDetailsPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/sessions/PSES-VSCode-22617-213627' -FeatureFlags @()

Sorry, can you run this instead? I just changed the log level to Diagnostic so we will see more info.

@avbor
Copy link

avbor commented May 21, 2018

PS /home/alex> /home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules/PowerShellEditorServices/Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.7.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules' -EnableConsoleRepl -LogLevel 'Diagnostic' -LogPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/logs/1526396086-de5df260-d80e-4ddc-b286-84a73f97a52f1526396083052/EditorServices.log' -SessionDetailsPath '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/sessions/PSES-VSCode-22617-213627' -FeatureFlags @()                                                                                                                                                           
Transcript started, output file is /home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/logs/1526396086-de5df260-d80e-4ddc-b286-84a73f97a52f1526396083052/Start-EditorServices.log
VERBOSE: 
#-- Removing PSReadLine module -----------------------------------------------
VERBOSE: Removing the imported "PSConsoleHostReadline" function.
VERBOSE: 
#-- Updated PSModulePath to: -------------------------------------------------
VERBOSE: /home/alex/.local/share/powershell/Modules
VERBOSE: /usr/local/share/powershell/Modules
VERBOSE: /opt/microsoft/powershell/6.0.2/Modules
VERBOSE: /home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules
VERBOSE: 
#-- Check required modules available -----------------------------------------
VERBOSE: Testing module availability PowerShellGet 
VERBOSE: Loading module from path '/opt/microsoft/powershell/6.0.2/Modules/PowerShellGet/1.6.0/PSModule.psm1'.
VERBOSE: PowerShellGet  found
VERBOSE: 
#-- Start up PowerShellEditorServices ----------------------------------------
VERBOSE: Importing PowerShellEditorServices
VERBOSE: Loading module from path '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules/PowerShellEditorServices/PowerShellEditorServices.psd1'.
VERBOSE: Loading module from path '/home/alex/.vscode/extensions/ms-vscode.powershell-1.7.0/modules/PowerShellEditorServices/PowerShellEditorServices.psm1'.
VERBOSE: Exporting function 'Start-EditorServicesHost'.
VERBOSE: Exporting function 'Compress-LogDir'.
VERBOSE: Exporting function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Compress-LogDir'.
VERBOSE: Importing function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Start-EditorServicesHost'.
VERBOSE: Checking port: 25376, attempts remaining 10 --------------------
VERBOSE: Testing availability of port 25376 at address 127.0.0.1 / InterNetwork
VERBOSE: Port: 25376 is available
VERBOSE: Checking port: 13507, attempts remaining 10 --------------------
VERBOSE: Testing availability of port 13507 at address 127.0.0.1 / InterNetwork
VERBOSE: Port: 13507 is available
PowerShell Integrated Console

VERBOSE: Invoking Start-EditorServicesHost
VERBOSE: Start-EditorServicesHost returned Microsoft.PowerShell.EditorServices.Host.EditorServicesHost
VERBOSE: Writing session file with contents:
VERBOSE: {"debugServiceTransport":"Tcp","debugServicePort":13507,"languageServiceTransport":"Tcp","status":"started","languageServicePort":25376}
VERBOSE: Wrote out session file
VERBOSE: 
#-- Waiting for EditorServicesHost to complete execution ---------------------

EditorServices.log
Start-EditorServices.log

@joeyaiello
Copy link

joeyaiello commented May 22, 2018

This should theoretically be fixed in upstream versions of PowerShell built on top of .NET Core 2.1. Unfortunately, there is no released version that fits that bill (6.1.0-preview.3 will be the first release to switch to .NET Core 2.1), but according to @rjmholt, the Arch installation uses the latest master branch straight out of GitHub, so you should be able to test there and tell us whether this is already fixed.

In any case, if it is fixed, I'm not sure that implementing env is worth the time, especially since setting TERM=xterm universally could cause problems (and the env solution will never be very discoverable).

@rjmholt
Copy link
Contributor

rjmholt commented May 22, 2018

See PowerShell/PowerShell#6132 for the PowerShell issue summary.

I've verified that this is fixed for Fedora 28 too. If you're very keen on testing it, building should work from PowerShell master.

On the note of including an environment variable configuration, I can imagine that being useful in other scenarios too and @rkeithhill's suggested implementation looks pretty sane.

@avbor
Copy link

avbor commented May 23, 2018

I'm just trying to find a quick and easy way to get around this problem without manual recompilation from source. =)

@rjmholt rjmholt added the Issue-Bug A bug to squash. label May 24, 2018
@rjmholt
Copy link
Contributor

rjmholt commented May 24, 2018

Unfortunately I don't think there's any way to set an environment variable for the PowerShell process being run by the service at the moment. And that's the only workaround I know of.

@rjmholt
Copy link
Contributor

rjmholt commented Aug 7, 2018

@codywd, @avbor PowerShell 6.1.0-preview.4 has shipped with the fix for this in it. Does this issue persist?

@avbor
Copy link

avbor commented Aug 8, 2018

@rjmholt Yes, all work fine since preview 3 =)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

7 participants