ubuntuvisual-studio-code

VSCode crashes when starting up in Ubuntu


I changed my workspace to Ubuntu recently, and I encountered the crashing problem.

The vscode was installed by apt. And it could be open for a few seconds, then it crashes automatically.

I tried to figure it out with the code --verbose command. It shows

[67802:0311/205929.505928:INFO:CONSOLE(626)] "%cTRACE color: #888 [File Watcher (node.js)] [CHANGED] /home/chou/.config/Code/logs/20210311T205927/telemetry.log", source: file:///usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js (626)
terminate called after throwing an instance of 'char const*'
/dev/fd/3: No such file or directory
Server response:
[67849:0311/205929.809879:ERROR:broker_posix.cc(40)] Recvmsg error: Connection reset by peer (104)

The last line might be caused by the ssh-extension, so I have removed it manually from ~/.vscode/extensions.

But the problem still exists, I've also tried with the --disable-extension flag, but nothing changed.

The only way I can enter vscode now is by sudo code --usr-data-dir command. I wonder what would cause this kind of frustrating problem.

EDIT: Here's the last few lines of exthost.log file:

[2021-03-11 22:07:54.814] [exthost] [debug] ProxyResolver#resolveProxy cached https://dc.services.visualstudio.com/api/profiles/AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217/appId DIRECT 
Error: Error for stack trace
    at Pe (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:96:3)
    at ProxyAgent.addRequest (/usr/share/code/resources/app/node_modules.asar/vscode-proxy-agent/index.js:73:16)
    at new ClientRequest (_http_client.js:296:16)
    at Object.request (https.js:314:10)
    at Object.<anonymous> (/usr/share/code/resources/app/node_modules.asar/agent-base/patch-core.js:23:20)
    at Object.<anonymous> (/usr/share/code/resources/app/node_modules.asar/https-proxy-agent/node_modules/agent-base/patch-core.js:25:22)
    at /usr/share/code/resources/app/node_modules.asar/socks-proxy-agent/node_modules/agent-base/patch-core.js:23:20
    at Object.U [as request] (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:96:4165)
    at Function.e.makeRequest (/usr/share/code/resources/app/extensions/github-authentication/dist/extension.js:1:7505)
    at Timeout.s [as _onTimeout] (/usr/share/code/resources/app/extensions/github-authentication/dist/extension.js:1:17133)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
[2021-03-11 22:07:55.351] [exthost] [info] extension host terminating: parent process 82934 does not exist anymore: kill ESRCH (code: ESRCH) (errno: ESRCH)
[2021-03-11 22:07:56.368] [exthost] [info] exiting with code 0

It seems like it may be the problem of the proxy resolver. But I still have no idea of how to fixed it up...


Solution

  • I was experiencing the same issue. I'm using Pop OS 20.04 LTS and Visual Studio Code would crash after startup. It seems the problem might be related to mixing the .snap package installation with the .deb package. This github comment has a solution that worked for me: (https://github.com/microsoft/vscode/issues/118727#issuecomment-801847011)

    I had to remove the vscodevscode.github-authentication/github.auth entry from the Passwords and Keys app.