devpod icon indicating copy to clipboard operation
devpod copied to clipboard

Cannot connect to desktop VSCode, ENAMETOOLONG

Open m2Giles opened this issue 1 year ago • 7 comments

What happened?
When attempting to connect to desktop vscode, receive an error that ENAMETOOLONG

What did you expect to happen instead?
Connection

How can we reproduce the bug? (as minimally and precisely as possible) On both docker and podman on a local host. Spin up any devpod. For example https://github.com/ublue-os/bluefin

My devcontainer.json:

{
    "name": "...",
    ...
}

Local Environment:

  • DevPod Version: 0.5.6
  • Operating System: linux
  • ARCH of the OS: AMD64

DevPod Provider:

  • Local/remote provider: docker/podman

Anything else we need to know?
Image: image

When connecting from vscode instead of launching from devpod, vscode can connect.

m2Giles avatar May 01 '24 20:05 m2Giles

Hi @m2Giles thanks for reporting

is VSCode installed as rpm or flatpak? thanks!

89luca89 avatar May 03 '24 07:05 89luca89

Just tried with both a flatpak and code installed in distrobox and both worked for me

I'm on OpenSUSE Aeon, not bluefin, but that should not be impactful

89luca89 avatar May 03 '24 07:05 89luca89

It only appears to fail on the first run when it uses the vscode URL. After the fail, I can connect to Devpod from VScode.

Browser vscode always seems to work.

VScode installed via rpm on host. I haven't tried the flatpak yet.

Docker and Podman were both showing the same behavior.

Should I remove ~/.devpod and rebuild?

m2Giles avatar May 03 '24 10:05 m2Giles

Try with either vscode flatpak and/or code in distrobox and let's see :+1:

89luca89 avatar May 06 '24 07:05 89luca89

Hey, I don't believe in bluefin it can be uninstalled from rpm easily to then try the flatpack (unless we have both the flatpack and rpm?). It's an OCI limitation. Because of how OCI layers work, everything stays in the image and if it is removed it is basically just dereferenced in later layer in which it is removed.

Arham4 avatar May 11 '24 17:05 Arham4

I decided to install the flatpak (so I have both rpm install and flatpak install on my system now). It seems devpod opened in the flatpak version, so that's good. However, upon connecting, rather than getting enametoolong, I just get this: image

[13:13:27.275] Log Level: 2
[13:13:27.280] VS Code version: 1.89.1
[13:13:27.281] Remote-SSH version: [email protected]
[13:13:27.281] linux x64
[13:13:27.281] SSH Resolver called for "ssh-remote+amal.devpod", attempt 1
[13:13:27.282] "remote.SSH.useLocalServer": true
[13:13:27.282] "remote.SSH.useExecServer": true
[13:13:27.282] "remote.SSH.path": undefined
[13:13:27.282] "remote.SSH.configFile": undefined
[13:13:27.282] "remote.SSH.useFlock": true
[13:13:27.282] "remote.SSH.lockfilesInTmp": false
[13:13:27.282] "remote.SSH.localServerDownload": auto
[13:13:27.282] "remote.SSH.remoteServerListenOnSocket": false
[13:13:27.282] "remote.SSH.showLoginTerminal": false
[13:13:27.282] "remote.SSH.defaultExtensions": []
[13:13:27.282] "remote.SSH.loglevel": 2
[13:13:27.282] "remote.SSH.enableDynamicForwarding": true
[13:13:27.282] "remote.SSH.enableRemoteCommand": false
[13:13:27.282] "remote.SSH.serverPickPortsFromRange": {}
[13:13:27.282] "remote.SSH.serverInstallPath": {}
[13:13:27.286] SSH Resolver called for host: amal.devpod
[13:13:27.286] Setting up SSH remote "amal.devpod"
[13:13:27.288] Acquiring local install lock: /tmp/vscode-remote-ssh-742d61fe-install.lock
[13:13:27.289] Looking for existing server data file at /var/home/arham/.var/app/com.visualstudio.code/config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-742d61fe-dc96b837cf6bb4af9cd736aa3af08cf8279f7685-0.110.1-es/data.json
[13:13:27.289] Using commit id "dc96b837cf6bb4af9cd736aa3af08cf8279f7685" and quality "stable" for server
[13:13:27.290] Install and start server if needed
[13:13:27.292] PATH: /app/bin:/app/bin:/app/bin:/usr/bin:/var/home/arham/.var/app/com.visualstudio.code/data/node_modules/bin
[13:13:27.292] Checking ssh with "ssh -V"
[13:13:27.295] > OpenSSH_9.7p1, OpenSSL 3.1.5 30 Jan 2024

[13:13:27.297] askpass server listening on /run/user/1000/vscode-ssh-askpass-ad32c848ab766dfe95cc53403f3dcac3421b7227.sock
[13:13:27.297] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-e7b641daf017fab8c73a213ccdb1df6b212ca982.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","36105","-o","ConnectTimeout=15","amal.devpod"],"serverDataFolderName":".vscode-server","dataFilePath":"/var/home/arham/.var/app/com.visualstudio.code/config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-742d61fe-dc96b837cf6bb4af9cd736aa3af08cf8279f7685-0.110.1-es/data.json"}
[13:13:27.297] Local server env: {"SSH_AUTH_SOCK":"/run/flatpak/ssh-auth","SHELL":"/bin/sh","DISPLAY":":0","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/app/extra/vscode/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"","VSCODE_SSH_ASKPASS_MAIN":"/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-ad32c848ab766dfe95cc53403f3dcac3421b7227.sock"}
[13:13:27.299] Spawned 230
[13:13:27.365] > local-server-1> Running ssh connection command: ssh -v -T -D 36105 -o ConnectTimeout=15 amal.devpod
[13:13:27.368] > local-server-1> Spawned ssh, pid=239
[13:13:27.369] stderr> OpenSSH_9.7p1, OpenSSL 3.1.5 30 Jan 2024
[13:13:27.370] stderr> /bin/sh: line 1: /usr/bin/devpod-cli: No such file or directory
[13:13:27.370] stderr> kex_exchange_identification: Connection closed by remote host
[13:13:27.370] stderr> Connection closed by UNKNOWN port 65535
[13:13:27.371] > local-server-1> ssh child died, shutting down
[13:13:27.373] Local server exit: 0
[13:13:27.373] Received install output: local-server-1> Running ssh connection command: ssh -v -T -D 36105 -o ConnectTimeout=15 amal.devpod
local-server-1> Spawned ssh, pid=239
OpenSSH_9.7p1, OpenSSL 3.1.5 30 Jan 2024
/bin/sh: line 1: /usr/bin/devpod-cli: No such file or directory
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
local-server-1> ssh child died, shutting down

[13:13:27.374] Failed to parse remote port from server output
[13:13:27.375] Resolver error: Error: 
	at g.Create (/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:499181)
	at t.handleInstallOutput (/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:496503)
	at e (/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:557639)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async /var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:579548
	at async t.withShowDetailsEvent (/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:583207)
	at async /var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:554344
	at async T (/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:552395)
	at async t.resolveWithLocalServer (/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:553884)
	at async k (/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:576765)
	at async t.resolve (/var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:580578)
	at async /var/home/arham/.var/app/com.visualstudio.code/data/vscode/extensions/ms-vscode-remote.remote-ssh-0.110.1/out/extension.js:2:846687
[13:13:27.377] ------

Like the other user mentioned, VSCode on browser works fine.

By the way, this resolves the issue if it helps with debugging possibly, however its needed almost anytime devpod is opened then: https://github.com/ublue-os/bluefin/issues/892#issuecomment-1992783675

Arham4 avatar May 11 '24 17:05 Arham4

Disclaimer. I'm on DevPod v0.5.6, Linux via bluefin-dx, so I don't know if this is fixed on a later version?

ENAMETOOLONG is Node.js when the operating system rejects the creation of a new process due to the length of the command line being too long.

To me this error occurs when starting VS Code on the NodeJS quickstart example from the DevPod app. -Closing and reopening VS Code circumvents the error.

My hunch is that DevPod issues a command with some security key as a param to the filename, and that fails in a VS Code (JS-)extension due to overall length. -Subsequently reopening VS Code, that last used remote connection was saved, ssh is "spawned" without the initial full command, and voila it works. (Restarting the docker daemon doesn't work for me.)

[22:04:23] debug Done creating devcontainer 
[22:04:23] info Run 'ssh my.devpod' to ssh into the devcontainer 
[22:04:23] debug No dotfiles repo specified, skipping 
[22:04:23] info Starting VSCode... 
[22:04:23] debug Error opening vscode via cli: /usr/bin/env: ‘sh’: File name too long

Now, if we could only see the command for starting VS Code...

Thanks, Flemming

gnimmelf avatar Jul 14 '24 21:07 gnimmelf