11

I'm setting up a new remote host and every time I initiate it I get the following error output. How can I resolve this issue?

Pseudo-terminal will not be allocated because stdin is not a terminal.

Linux Destiny 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1 (2019-04-12) x86_64

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.

mesg: ttyname failed: Inappropriate ioctl for device

bash: cannot set terminal process group (3202): Inappropriate ioctl for device bash: no job control in this shell

mesg: ttyname failed: Inappropriate ioctl for device

Installing... Downloading with wget

WARNING: tar exited with non-0 exit code

Found running server...

*

cat: /root/.vscode-remote/.473af338e1bd9ad4d9853933da1cd9d5d9e07dc9.log: No such file or directory

Server did not start successfully. Full server log: cat: /root/.vscode-remote/.X.log51ec4692- 4da4-4ec0-b613-5a3563034cf1==== : No such file or directory

"install" terminal command done Received install output: : No such file or directory Failed to parse remote port from server output: : No such file or directory

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sean Zamora
  • 167
  • 1
  • 1
  • 6

13 Answers13

14

If the server fails to shut down properly, sometimes it leaves dangling lockfiles. This can cause startup to fail and produce the "Failed to parse remote port from server output" error message. In this case the solution is to simply to delete the lockfiles:

.vscode-server/bin/[:xdigit:]*/vscode-remote-lock.*
Floegipoky
  • 3,087
  • 1
  • 31
  • 47
  • 1
    In my case it happened randomly after a disconnect, but thank you it worked! VSCode team needs to add a more descriptive error – Epic Speedy Apr 14 '21 at 16:57
2

I fixed the issue. It appears I had two other server agents running incorrectly. I killed both server agents using kill (PID) and removed the ".vscode_remote" directory from the user home directory. Then I reinitialized remote-ssh from Visual Studio Code. Successfully connected!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sean Zamora
  • 167
  • 1
  • 1
  • 6
2

I also got the same issue and my workaround was to provide proper rights to the home or user folder, so Visual Studio Code can create a remote folder and do the required installation on it.

Example:

sudo chmod -R 777 /home/

In this case, I have provided all rights to my home folder (777) and it worked like a charm for all the users.

Nearoo
  • 4,454
  • 3
  • 28
  • 39
Sachin
  • 1,460
  • 17
  • 24
  • To me, it's a permission issue as well. Thanks for the hint – dproc Mar 08 '23 at 14:52
  • 777 is (U)ser / owner can read, can write and can execute. (G)roup can read, can write and can execute. (O)thers can read, can write and can execute. What are the security implications? – Peter Mortensen Mar 19 '23 at 00:08
  • Actually, vscode required write permissions ,so you can provide right permissions only. – Sachin Mar 20 '23 at 02:55
1

On the remote machine you do not have a tar file installed. It's in the log output

Installing... Downloading with wget

WARNING: tar exited with non-0 exit code

so under a root run:

apt-get install tar

or with sudo, if you have a user with sudoers configured:

sudo apt-get install tar
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
bodo
  • 827
  • 6
  • 19
  • Tar was installed. i think this issue is related to bash script not treated as a terminal. "Pseudo-terminal will not be allocated because stdin is not a terminal." – Sean Zamora May 04 '19 at 13:52
1

I ssh'd onto the remote server (Linux) and then deleted both directories as follows:

rm -r .vscode-server.backup2022-04-03T16:20:18-05:00

rm -r .vscode-server
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Finn
  • 61
  • 1
  • 2
1

There are many causes for this problem,

  • First, ensure the ssh is working, whatever you can restart the ssh
/etc/init.d/ssh restart
  • Then, delete the lock files
rm -rf ~/.vscode-server/bin/**
  • Finally, retry connecting
KingLiu
  • 59
  • 4
0

In case someone else encounters the same issue: I had an instance where the remote target didn't have any space left on the device. After extending the root volume of the target machine, the connection worked fine.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Greg
  • 1,845
  • 2
  • 16
  • 26
0

I had the same issue because Visual Studio Code was looking for my .vscode-server directory in the wrong location (it was in a custom location due to restrictions on where files can be saved). This can be fixed by using How to change vscode-server directory. Specifically, add

"remote.SSH.lockfilesInTmp": true,
"remote.SSH.serverInstallPath":{
    "hostname":"/path/to/.vscode-server/.."
}

to your settings.json file.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
kauii8
  • 199
  • 9
0

In my case, it wasn't working because of the server asking for a new password when starting a session. I opened a new default terminal (not the Visual Studio Code terminal, but your OS default terminal, like Z shell, CMD, and so on). And I used the ssh command to log in. I logged in successfully and changed the password. Then I tried connecting with the new password and it worked, because the server didn't asked for a password change now.

Command:

ssh username@IP

Enter the password and you'll get asked to change the password. Change the password and try connecting again with new password using the SSH Visual Studio Code extension.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

If you authorize by ssh-key, also check the value of the User parameter in Visual Studio Code's SSH configuration. User must have a matching key in file ~/.ssh/authorized_keys on the remote host.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Solo.dmitry
  • 690
  • 8
  • 15
0

Sachin's answer directed me in the right direction. Visual Studio Code needs permissions in order to create some files, but instead of giving 777 permissions to your home folder (which can be dangerous), you can just chown the user that wants to log in (the user for me was ubuntu):

sudo chown -R ubuntu /home

I also got the same issue and my workaround was to provide proper rights to the home or user folder, so Visual Studio Code can create a remote folder and do the required installation on it.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

The following solution worked for my case:

  1. Connect to your server through a terminal (vscode terminal, cmd etc)!
  2. Remove vscode-server from /home/user_name/ folder. (rm -r /home/user_name/.vscode-server)
  3. Try connect from VS code again!

The server will be re-installed. However, you loose config, meta data etc.

user3503711
  • 1,623
  • 1
  • 21
  • 32
-1

Step 1: Add port to your configuration file:

Host hostname
Port 22
User username

Step 2: Go to menu FilePreferencesOpen settings.json file. Search for lockfilesInTmp and check the box next to that

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Shruthi H R
  • 9
  • 1
  • 4