Skip to content
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

Resolve shell environment failed on 1.62.1 #136791

Closed
briankintz opened this issue Nov 9, 2021 · 27 comments
Closed

Resolve shell environment failed on 1.62.1 #136791

briankintz opened this issue Nov 9, 2021 · 27 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release important Issue identified as high-priority regression Something that used to work is now broken verified Verification succeeded

Comments

@briankintz
Copy link

briankintz commented Nov 9, 2021

The shell environment no longer resolves correctly in remote terminals in 1.62.1.

A possible workaround is to manually source the shell env in remote terminals

source ~/.bashrc

Another workaround is to downgrade to 1.62.0


  • VS Code Version: 1.62.1
  • OS Version: Windows 10 21H1 / WSL2 / Ubuntu 20.10

After updating from 1.62.0 to 1.62.1, the full shell environment under WSL2 isn't loaded.

  • Aliases from .bashrc work normally
  • Additional configuration files like .profile are not loaded

The remote server log shows the following errors:

[2021-11-09 22:18:30.906] [remoteagent] [error] ptyHost was unable to resolve shell environment {}
[2021-11-09 22:18:31.090] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}

Rolling back to 1.62.0 solves the problem

@sroby
Copy link

sroby commented Nov 9, 2021

I am having what appears to be the same issue with a SSH Remote workspace on the latest release. My .bashrc is sourced, but my .bash_profile no longer is. It seems the terminal no longer inherits the environment.

Before updating VS Code today, I have never had this problem. (Is there any easy way to temporarily downgrade VS Code (on Windows), btw?)

@briankintz
Copy link
Author

Before updating VS Code today, I have never had this problem. (Is there any easy way to temporarily downgrade VS Code (on Windows), btw?)

  1. Pick your desired OS variant from the updates page
  2. Copy the download link
  3. Paste into address bar and replace 1.62.1 with 1.62.0
  4. Press enter to download

For the Windows user installer it would be:

https://update.code.visualstudio.com/1.62.0/win32-x64-user/stable

@Taskle
Copy link

Taskle commented Nov 9, 2021

WSL2 Ubuntu seems to be having some severe regressions with the release of v1.62.1 - I just filed #136809 and I see that #136799 is also WSL2 ubuntu-related - each seems to be issues related to SSH/connections via either the terminal or otherwise.

Hopeful someone at Microsoft can take a look soon! :)

@ghost
Copy link

ghost commented Nov 10, 2021

I am having what appears to be the same issue with a SSH Remote workspace on the latest release. My .bashrc is sourced, but my .bash_profile no longer is. It seems the terminal no longer inherits the environment.

I am having the same issue with SSH Remote workspace after updating VS Code to 1.62.1

@chrmarti
Copy link
Collaborator

chrmarti commented Nov 10, 2021

@alexdima This looks like a regression from the 1.62.1 fix. /fyi @aeschli

Likely duplicates: #136814, #136809, #136799, microsoft/vscode-remote-release#5844

@chrmarti
Copy link
Collaborator

@deepak1556 Identified the fix in main: e08e4d3#diff-ba73d13771267ed61274b4094ee466e9ee2256307ae6cae5ef1161d0bfaebe67

Labelling as candidate for visibility.

@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release labels Nov 10, 2021
@chrmarti chrmarti added this to the October 2021 Recovery 2 milestone Nov 10, 2021
@alexr00
Copy link
Member

alexr00 commented Nov 10, 2021

Also impacting tasks in WSL: #136799

@alexdima alexdima added the important Issue identified as high-priority label Nov 10, 2021
@alexdima alexdima changed the title Resolve shell environment failed on 1.62.1 / Remote WSL2 Resolve shell environment failed on 1.62.1 Nov 10, 2021
@alexdima alexdima added the regression Something that used to work is now broken label Nov 10, 2021
@jefferai
Copy link

Chiming in: took me a while to figure out why my Go setup that has been working for years suddenly wasn't working, and it's this bug; pathing sourced from .profile was no longer working. Rolling back to 1.62.0 fixed my issues.

@sroby
Copy link

sroby commented Nov 10, 2021

@briankintz: Worked great, thank you!

And this indeed confirms that 1.62.1 was the culprit in my case. (SSH, not WSL)

@deepak1556
Copy link
Collaborator

Fixed in #136877

@richtera
Copy link

When will this go live? I had to restore 1.60 on my machine after messing around with shell setup for a long while.

@richtera
Copy link

That actually worked before. The problem I had was that clicking on a launch item that used npm, then that shell was not a login shell and it was trying to find npm on the windows side.

@deepak1556
Copy link
Collaborator

@richtera can you check if the issue is present in latest insiders https://code.visualstudio.com/insiders which already contains the fix.

@richtera
Copy link

@deepak1556 Ok that works. I guess both shell problems are related. Thank you.

@deepak1556
Copy link
Collaborator

yup thanks for testing!

@briankintz
Copy link
Author

Confirmed my problems both with the shell and with tasks are fixed in the latest insiders build. Thanks @deepak1556!

@taikulawo
Copy link

I guess this is the same problem #136838

@arobertn
Copy link

Argh, first time I needed to use a remote env in months and wouldn't you know it I hit this release. And the fix is coming out today even, but in a timezone after my workday is up!

@Stanzilla
Copy link

What's the correct way to start a VSCode WSL instance that inherits the profile? Sometimes when I just call wsl.exe code . it does not inherit it.

@aeschli
Copy link
Contributor

aeschli commented Nov 15, 2021

@Stanzilla It should. Check out the WSL log for the entry Using shell environment from invoking shell. Setting "remote.WSL.debug": true will give more information about the env variables that are read and set.
Please file a new issue if it doesn't work.

@richtera
Copy link

A lot of time I have to remove the code that distinguishes login and non-login shells in bashrc, otherwise some things like nvm, conda and so on won't get initialized. I think it might be worth it to review which parts of the system pass --login to bash or zsh during startup of Visual Studio Code.

@richtera
Copy link

Hmmm, I am seeing this failing again in 1.62.2. My launch.json file no longer works, although everywhere else in terminal and javascript debugging terminal the environment is correct. It looks like the current version no longer opens up the terminal first so I can't see what's happening. I will enable remote.WSL.debug to see if that helps.

@richtera
Copy link

richtera commented Nov 16, 2021

Using remote.WSL.debug now shows (edited to show the whole log, it's not so large)

[2021-11-16 08:20:49.486] [remoteagent] [info] 

*
* Visual Studio Code Server
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license https://aka.ms/vscode-remote/license
*


[2021-11-16 08:20:49.486] [remoteagent] [info] Extension host agent started.
[2021-11-16 08:20:49.693] [remoteagent] [info] Deleted from disk ms-azuretools.vscode-docker /home/andy/.vscode-server/extensions/ms-azuretools.vscode-docker-1.17.0
[2021-11-16 08:20:49.965] [remoteagent] [info] [::ffff:172.24.192.1][1419c1fa][ManagementConnection] New connection established.
[2021-11-16 08:20:49.966] [remoteagent] [info] [::ffff:172.24.192.1][427f594b][ExtensionHostConnection] New connection established.
[2021-11-16 08:20:59.478] [remoteagent] [error] ptyHost was unable to resolve shell environment {}
[2021-11-16 08:20:59.479] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 08:20:59.500] [remoteagent] [info] [::ffff:172.24.192.1][427f594b][ExtensionHostConnection] <332> Launched Extension Host Process.
[2021-11-16 08:21:03.626] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 09:46:29.962] [remoteagent] [info] [::ffff:172.24.192.1][b8ecfbff][ExtensionHostConnection] New connection established.
[2021-11-16 09:46:29.964] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 09:46:29.967] [remoteagent] [info] [::ffff:172.24.192.1][b8ecfbff][ExtensionHostConnection] <2800> Launched Extension Host Process.
[2021-11-16 09:46:29.998] [remoteagent] [info] [::ffff:172.24.192.1][4f87aba8][ManagementConnection] New connection established.
[2021-11-16 09:46:34.453] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 09:46:57.102] [remoteagent] [info] [::ffff:172.24.192.1][fab8d065][ManagementConnection] New connection established.
[2021-11-16 09:46:57.181] [remoteagent] [info] [::ffff:172.24.192.1][0e39568f][ExtensionHostConnection] New connection established.
[2021-11-16 09:46:57.183] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 09:46:57.186] [remoteagent] [info] [::ffff:172.24.192.1][0e39568f][ExtensionHostConnection] <4134> Launched Extension Host Process.
[2021-11-16 09:47:00.523] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 10:57:22.773] [remoteagent] [info] [::ffff:172.24.192.1][1419c1fa][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2021-11-16 10:57:23.839] [remoteagent] [info] [::ffff:172.24.192.1][427f594b][ExtensionHostConnection] <332> Extension Host Process exited with code: 0, signal: null.
[2021-11-16 10:57:25.380] [remoteagent] [info] [::ffff:172.24.192.1][fab8d065][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2021-11-16 10:57:26.427] [remoteagent] [info] [::ffff:172.24.192.1][0e39568f][ExtensionHostConnection] <4134> Extension Host Process exited with code: 0, signal: null.
[2021-11-16 10:57:29.017] [remoteagent] [info] [::ffff:172.24.192.1][4f87aba8][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2021-11-16 10:57:30.069] [remoteagent] [info] [::ffff:172.24.192.1][b8ecfbff][ExtensionHostConnection] <2800> Extension Host Process exited with code: 0, signal: null.
[2021-11-16 10:57:30.069] [remoteagent] [info] Last EH closed, waiting before shutting down
[2021-11-16 10:57:33.099] [remoteagent] [info] [::ffff:172.24.192.1][00e79969][ManagementConnection] New connection established.
[2021-11-16 10:57:33.196] [remoteagent] [info] [::ffff:172.24.192.1][0b2efabe][ExtensionHostConnection] New connection established.
[2021-11-16 10:57:33.198] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 10:57:33.203] [remoteagent] [info] [::ffff:172.24.192.1][0b2efabe][ExtensionHostConnection] <7935> Launched Extension Host Process.
[2021-11-16 10:57:40.647] [remoteagent] [info] [::ffff:172.24.192.1][00e79969][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2021-11-16 10:57:41.713] [remoteagent] [info] [::ffff:172.24.192.1][0b2efabe][ExtensionHostConnection] <7935> Extension Host Process exited with code: 0, signal: null.
[2021-11-16 10:57:41.713] [remoteagent] [info] Cancelling previous shutdown timeout
[2021-11-16 10:57:41.713] [remoteagent] [info] Last EH closed, waiting before shutting down
[2021-11-16 10:57:42.140] [remoteagent] [info] [::ffff:172.24.192.1][ba818ac8][ManagementConnection] New connection established.
[2021-11-16 10:57:42.422] [remoteagent] [info] [::ffff:172.24.192.1][63d1584a][ExtensionHostConnection] New connection established.
[2021-11-16 10:57:42.423] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 10:57:42.427] [remoteagent] [info] [::ffff:172.24.192.1][63d1584a][ExtensionHostConnection] <8990> Launched Extension Host Process.
[2021-11-16 10:58:54.645] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 11:00:08.029] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 11:02:41.715] [remoteagent] [info] New EH opened, aborting shutdown
[2021-11-16 11:05:57.204] [remoteagent] [info] [::ffff:172.24.192.1][ba818ac8][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2021-11-16 11:05:58.259] [remoteagent] [info] [::ffff:172.24.192.1][63d1584a][ExtensionHostConnection] <8990> Extension Host Process exited with code: 0, signal: null.
[2021-11-16 11:05:58.260] [remoteagent] [info] Last EH closed, waiting before shutting down
[2021-11-16 11:06:01.707] [remoteagent] [info] [::ffff:172.24.192.1][ec64ed7f][ManagementConnection] New connection established.
[2021-11-16 11:06:01.711] [remoteagent] [info] [::ffff:172.24.192.1][5eb8c6ec][ExtensionHostConnection] New connection established.
[2021-11-16 11:06:01.712] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-11-16 11:06:01.717] [remoteagent] [info] [::ffff:172.24.192.1][5eb8c6ec][ExtensionHostConnection] <11294> Launched Extension Host Process.
[2021-11-16 11:06:19.201] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}

@richtera
Copy link

It works fine in the insider build

Version: 1.63.0-insider (user setup)
Commit: 6a25ae3a24929f35aabf8a051531c0716032e0a0
Date: 2021-11-16T05:14:38.726Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

The failure is from this exact version.

Version: 1.62.2 (user setup)
Commit: 3a6960b964327f0e3882ce18fcebd07ed191b316
Date: 2021-11-11T20:56:38.428Z
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

what's interesting is that after upgrading the insider build to the latest version the normal version started to work again.

@brybalicious
Copy link

brybalicious commented Dec 9, 2021

I'm on 1.63.0-insider on WSL2 on windows 10 and still getting this problem when trying to run live-server (which I installed as an npm package using nvm, not a VSCode extension) from a terminal in VSCode Insiders

Version: 1.63.0-insider (user setup)
Commit: 7db1a2b88f7557e0a43fec75b6ba7e50b3e9f77e
Date: 2021-12-06T21:54:39.104Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043

Remote Server Logs:

[2021-12-09 02:57:52.395] [remoteagent] [info] 

*
* Visual Studio Code Server
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license https://aka.ms/vscode-remote/license
*


[2021-12-09 02:57:52.396] [remoteagent] [info] Extension host agent started.
[2021-12-09 02:57:52.549] [remoteagent] [info] [::ffff:127.0.0.1][5f3f8d71][ManagementConnection] New connection established.
[2021-12-09 02:57:54.433] [remoteagent] [info] [::ffff:127.0.0.1][30a82c8d][ExtensionHostConnection] New connection established.
[2021-12-09 02:57:54.554] [remoteagent] [info] Deleted from disk ms-toolsai.jupyter-renderers /home/username/.vscode-server-insiders/extensions/ms-toolsai.jupyter-renderers-1.0.3
[2021-12-09 02:57:59.806] [remoteagent] [info] Deleted from disk ms-toolsai.jupyter /home/username/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2021.11.1001498571
[2021-12-09 02:58:00.670] [remoteagent] [info] Deleted from disk ms-python.vscode-pylance /home/username/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2021.11.2
[2021-12-09 02:58:02.268] [remoteagent] [error] ptyHost was unable to resolve shell environment {}
[2021-12-09 02:58:02.269] [remoteagent] [error] RequestService#request resolving shell environment failed {}
[2021-12-09 02:58:02.270] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-12-09 02:58:02.271] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}
[2021-12-09 02:58:02.442] [remoteagent] [info] [::ffff:127.0.0.1][30a82c8d][ExtensionHostConnection] <7566> Launched Extension Host Process.
[2021-12-09 02:58:20.160] [remoteagent] [error] ExtensionHostConnection#buildUserEnvironment resolving shell environment failed {}

@github-actions github-actions bot locked and limited conversation to collaborators Dec 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release important Issue identified as high-priority regression Something that used to work is now broken verified Verification succeeded
Projects
None yet
Development

No branches or pull requests