code-server: [Bug]: No working Terminal on FreeBSD 13.1-RELEASE-p2

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: Windows 10
  • Remote OS: FreeBSD 13.1-RELEASE-p2 Jails
  • Remote Architecture: amd64
  • code-server --version: 4.8.1

Steps to Reproduce

  1. open code-server on Chrome
  2. New Notification “The connection to the terminal’s pty host process is unresponsive, the terminals may stop working.”
  3. Repeated “Restart pty host”

Expected

pty host must operate normally

Actual

Terminal is not working.

Logs

[17:00:43] ptyHost was unable to resolve shell environment Error: Unable to resolve your shell environment: Unexpected exit code from spawned shell (code 1, signal null) at /usr/local/lib/node_modules/code-server/lib/vscode/out/vs/server/node/server.main.js:92:2607 at async /usr/local/lib/node_modules/code-server/lib/vscode/out/vs/server/node/server.main.js:67:23805 [IPC Library: Pty Host] The factory function of “vs/platform/terminal/node/ptyHostMain” has thrown an exception [IPC Library: Pty Host] Error: Platform not supported at E (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js:19:811) at y (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js:19:110) at new E (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js:19:1504) at Object.<anonymous> (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js:27:17502) at Function.s._safeInvokeFunction (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:5:1337) at Function.s._invokeFactory (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:5:1522) at s.complete (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:5:1801) at s._onModuleComplete (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:1112) at s._onModuleComplete (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:1358) at s._onModuleComplete (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:1358) at s._onModuleComplete (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:1358) at s._onModuleComplete (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:1358) at s._resolve (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:510) at s.defineModule (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:5:6066) at n (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:5:10527) at Object.R (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:6036) at Function.s._safeInvokeFunction (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:5:1337) at Function.s._invokeFactory (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:5:1522) at s.complete (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:5:1801) at s._onModuleComplete (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:1112) at s._onModuleComplete (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:1358) at s._resolve (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:510) at s.defineModule (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:5:6066) at y (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:6:1825) at h (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:4:2554) at Object.<anonymous> (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.nls.js:3:61) at e._createAndEvalScript (/usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:4:2598) at /usr/local/lib/node_modules/code-server/lib/vscode/out/vs/loader.js:4:2237 at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) [IPC Library: Pty Host] Here are the modules that depend on it: [IPC Library: Pty Host]% [ ‘===anonymous1===’ ] [17:00:43] [192.168.0.104][5ee7cc5d][ExtensionHostConnection] Unknown reconnection token (never seen). [17:00:43] [192.168.0.104][eb8a76c1][ManagementConnection] Unknown reconnection token (never seen). [IPC Library: Pty Host] Unknown channel: heartbeat [IPC Library: Pty Host] Unknown channel: log [IPC Library: Pty Host] Unknown channel: ptyHost [IPC Library: Pty Host] Unknown channel: ptyHost [IPC Library: Pty Host] Unknown channel: ptyHost [IPC Library: Pty Host] Unknown channel: ptyHost [IPC Library: Pty Host] Unknown channel: ptyHost [IPC Library: Pty Host] Unknown channel: ptyHost [IPC Library: Pty Host] Unknown channel: ptyHost

Screenshot/Video

bug

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

It works fine in other jails environments.

  • FreeBSD 13.1-RELEASE-p2
  • node14-14.18.1_1
  • npm-node14-6.14.8_1
  • code-server v4.0.2

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 22 (3 by maintainers)

Most upvoted comments

I changed the default shell to bash or zsh and solved the problem by referring to the link below. Thank you @kawanakaiku

https://github.com/coder/code-server/issues/5496#issuecomment-1240839804

@0x1eef I know someone who added code-oss to the Ports tree and then the Pkg collection. Basically their method is to package all needed node modules in a static tarball and upload it somewhere, then download the tarball in the Makefile as part of the source code to fill the build dependency.

Check tagattie/FreeBSD-VSCode for details. Likely that your Port will have to take a similar approach.

Hi @tagattie , if that’s not too much to ask, can you kindly share how you maintained your Port? I believe @0x1eef can use some guidance.

Not Work now.

Didn’t work indeed.

However, it seems like an upstream issue so pointing our fingers to coder/code-server may not work as intended.

Meanwhile, I just fired some PRs at microsoft/node-pty and microsoft/vscode to see if they can give code reviews and possibly approve those fixes.

Hope that contributes.

-RW

Thanks a lot @tagattie !

I made some progress in this pull request. It includes:

  • Download the source from this github repository instead of via npm
  • Download vscode-node-modules-*.tgz and code-server-node-modules-*.tgz at the fetch phase
  • Both tarballs include a build I did manually and then packaged for download

The packaging part still needs to be automated. And maybe I need to rebuild the node_modules directory similar to what @tagattie is doing. I think we’re headed in the right direction though.

@0x1eef As already mentioned, the official FreeBSD package builders do not allow network access except for the fetch phase. So we have to prepare a tarball which contains all the necessary node modules in advance and host it somewhere. I (ab)use GitHub releases pages for this purpose.

In case of VSCode, it is a bit complicated because multiple package.json/package-lock.json are involved. (https://github.com/tagattie/FreeBSD-VSCode/blob/master/editors/vscode/Makefile#L289)

But the basics should be applicable to any node-based ports. Hope this helps.

thanks! @rowheel do you have a branch somewhere including all your fixes? If this works atm I’d like to get it into ports proper.

Hi @dch,

The fix for node-pty has been accepted by Microsoft. (Thanks M$!)

The fix for vscode is, however, still unanswered. If you want to see what’s changed you can click on the PR link above. It’s not a complicated fix to be honest.

-RW

Update: The issue found in node-pty was a hard block that directly causes compile error, which in turn directly lead to dependency loss under lib/vscode

The issue found in vscode, however, can be worked around by setting an environment variable called VSCODE_APPDATA

Update: An old code-server release v4.11.0 is known to work on FreeBSD 13.2.

At the release of coder-server v4.11.0 aka VS Code v1.76, the poison in node-pty has not yet been introduced into the trunk so the compile was good.

Personally recommending FreeBSD users to stick to that version until further official code-server release.

# yarn global add code-server@v4.11.0