Skip to content

[Bug]: No working Terminal on FreeBSD 13.1-RELEASE-p2 #5741

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
4 tasks done
ilovebsd opened this issue Nov 1, 2022 · 13 comments
Closed
4 tasks done

[Bug]: No working Terminal on FreeBSD 13.1-RELEASE-p2 #5741

ilovebsd opened this issue Nov 1, 2022 · 13 comments
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer

Comments

@ilovebsd
Copy link

ilovebsd commented Nov 1, 2022

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. (/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. (/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
@ilovebsd ilovebsd added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Nov 1, 2022
@olegsidorkin
Copy link

The same thing happens with code-server 4.8.1/ node16 / FreeeBSD 13.

@jsjoeio
Copy link
Contributor

jsjoeio commented Nov 1, 2022

Hmm I haven't used freebsd so I'm not sure what could be happening here.

Any ideas @code-asher?

@code-asher
Copy link
Member

[IPC Library: Pty Host] Error: Platform not supported

Was code-server installed via npm? If so then I am not sure why node-pty is saying the platform is not supported. 🤔

@ilovebsd
Copy link
Author

ilovebsd commented Nov 1, 2022

Installed in the order below

/usr/local/lib/node_modules/code-server/lib/vscode/node_modules/node-pty/package.json
{
"name": "node-pty",
"description": "Fork pseudoterminals in Node.JS",
"author": {
"name": "Microsoft Corporation"
},
"version": "0.11.0-beta11",
"license": "MIT",
"main": "./lib/index.js",
"types": "./typings/node-pty.d.ts",
"repository": {
"type": "git",
"url": "git://github.com/microsoft/node-pty.git"
},
"files": [
"binding.gyp",
"lib/",
"scripts/",
"src/",
"deps/",
"typings/"
],
"homepage": "https://github.com/microsoft/node-pty",
"bugs": {
"url": "https://github.com/microsoft/node-pty/issues"
},
"keywords": [
"pty",
"tty",
"terminal",
"pseudoterminal",
"forkpty",
"openpty"
],
"scripts": {
"build": "tsc -b ./src/tsconfig.json",
"watch": "tsc -b -w ./src/tsconfig.json",
"lint": "eslint -c .eslintrc.js --ext .ts src/",
"install": "node scripts/install.js",
"postinstall": "node scripts/post-install.js",
"test": "cross-env NODE_ENV=test mocha -R spec --exit lib/*.test.js",
"posttest": "npm run lint",
"prepare": "npm run build",
"prepublishOnly": "npm run build"
},
"dependencies": {
"nan": "^2.14.0"
},
"devDependencies": {
"@types/mocha": "^7.0.2",
"@types/node": "12",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"cross-env": "^5.1.4",
"eslint": "^6.8.0",
"mocha": "^7.1.1",
"ps-list": "^6.0.0",
"typescript": "^3.8.3"
}

@olegsidorkin
Copy link

olegsidorkin commented Nov 1, 2022

After looking at compiled JS, i think it's here: https://github.com/microsoft/vscode/blob/9db57e76e9f16f552203585a394e50cf0f7a84a7/src/vs/platform/environment/node/userDataPath.js#L98

However setting --user-data-dir ~/.local/share/code-server didn't help.
Electron is 18.3.11

@ilovebsd
Copy link
Author

ilovebsd commented Nov 4, 2022

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

#5496 (comment)

@olegsidorkin
Copy link

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

#5496 (comment)

Yes, this helped. Terminal started to work after patching with sed.

@ykla
Copy link

ykla commented May 21, 2023

Not Work now.

@rowheel
Copy link

rowheel commented May 21, 2023

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

@dch
Copy link

dch commented May 22, 2023

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.

@rowheel
Copy link

rowheel commented May 22, 2023

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 [email protected]

@katrinabryce
Copy link

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.

My process for installing it is:

npm install -g code-server --unsafe-perm
cd /usr/local/lib/node_modules/code-server/
npm install --unsafe-perm
sed -i -e 's|switch(process.platform)|switch("linux")|' /usr/local/lib/node_modules/code-server/lib/vscode/out/vs/platform/terminal/node/ptyHostMain.js

The patch is based on the comment referred to further up this thread.
A lot of dependencies don't install first time round, hence the second installation round.
Works for 4.16.1. 4.17.0 isn't on npm yet.

@code-asher
Copy link
Member

Closing for now, but if this is still a problem and there is something we can fix on code-server's end, let me know.

@code-asher code-asher closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

8 participants