code-server
code-server copied to clipboard
[Bug]: No working Terminal on FreeBSD 13.1-RELEASE-p2
Is there an existing issue for this?
- [X] 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
- open code-server on Chrome
- New Notification "The connection to the terminal's pty host process is unresponsive, the terminals may stop working."
- 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.
Screenshot/Video
Does this issue happen in VS Code or GitHub Codespaces?
- [X] I cannot reproduce this in VS Code.
- [X] I cannot reproduce this in GitHub Codespaces.
Are you accessing code-server over HTTPS?
- [X] 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
The same thing happens with code-server 4.8.1/ node16 / FreeeBSD 13.
Hmm I haven't used freebsd so I'm not sure what could be happening here.
Any ideas @code-asher?
[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. :thinking:
Installed in the order below
- pkg install node16-16.16.0 npm-node16-8.19.1 pkgconf libsecret
- curl -fsSL https://code-server.dev/install.sh | sh
/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" }
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
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
I changed the default shell to bash or zsh and solved the problem by referring to the link below. Thank you @kawanakaiku
Yes, this helped. Terminal started to work after patching with sed.
Not Work now.
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.
- https://github.com/microsoft/node-pty/pull/597
- https://github.com/microsoft/vscode/pull/183027
Hope that contributes.
-RW
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.
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]
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.
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.