Skip to content
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

Attaching Visual Studio Code to Remote Containers Hangs at "Setting up Remote-Containers (show log)" #6670

Open
uns1 opened this issue Apr 29, 2022 · 29 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers
Milestone

Comments

@uns1
Copy link

uns1 commented Apr 29, 2022

Issue
Trying to attach visual studio code to a container hangs at "Setting up Remote-Containers (show log)". I can attach a shell to the container as well as attach visual studio code to the same container from another computer. To remedy, I reinstalled (clean) VS Code but that did not help either. The Dev Container log shows this:
[26127 ms] Remote-Containers 0.233.0 in VS Code 1.66.2 (dfd34e8260c270da74b5c2d86d61aee4b6d56977).
[26127 ms] Start: Run: ssh xxx-xxxxxxx /bin/sh
[26141 ms] Start: Run in host: id -un

Version of VS Code
Version 1.66.2

What type of remote connection you were using: SSH, Containers, WSL
SSH and Containers

Your operating system
On a Windows 11 Pro Machine, SSH-ed into Ubuntu (18.04.5 LTS)

The remote operating system you are connecting to
A docker container building from python and/or ubuntu

List of extensions that you have installed
image

Reproducible steps (1... 2... 3...) that cause the issue
Right click on running container, click attach Visual Studio Code

What you expected to see, versus what you actually saw
VS Code to open in remote container

Errors from the Dev Tools Console (open from the menu: Help > Toggle Developer Tools)
image

If you are using VS Code Remote - Container support, include your container configuration files if you are able to.
This happens with every container, all of which were functioning properly until recently - hence I do not think providing the container config files will be beneficial as the issue is not specific to certain containers

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Apr 29, 2022
@uns1
Copy link
Author

uns1 commented May 2, 2022

P.S. It works if I run the extension in the workspace by adding the following to my settings:

"remote.extensionKind": { "ms-vscode-remote.remote-containers": "workspace" }

@chrmarti
Copy link
Contributor

chrmarti commented May 3, 2022

Does your ssh connection require a password or passphrase to connect?

@chrmarti chrmarti self-assigned this May 3, 2022
@chrmarti chrmarti added the info-needed Issue requires more information from poster label May 3, 2022
@uns1
Copy link
Author

uns1 commented May 3, 2022

P.S. It works if I run the extension in the workspace by adding the following to my settings:

"remote.extensionKind": { "ms-vscode-remote.remote-containers": "workspace" }

P.S. this doesn't get stuck on
Start: Run in host: id -un
But is largely useless as when you try to attach vs code to a container, since the extension is installed in the workspace, it just says you have to install the remote-containers extension in the container and disconnects

@uns1
Copy link
Author

uns1 commented May 3, 2022

Does your ssh connection require a password or passphrase to connect?

@chrmarti - password

@chrmarti
Copy link
Contributor

chrmarti commented May 4, 2022

Are you asked for the password before it stops on Start: Run in host: id -un?

@uns1
Copy link
Author

uns1 commented May 4, 2022

Are you asked for the password before it stops on Start: Run in host: id -un?

Nope - not asked for a password.

@chrmarti
Copy link
Contributor

chrmarti commented May 6, 2022

Could you enable trace logging for Remote-Containers in the settings and retry and then append the full log here?
image

@uns1
Copy link
Author

uns1 commented May 6, 2022

@chrmarti which of these logs would you be interested in?
image

@sharkfox
Copy link

sharkfox commented May 6, 2022

@uns1 Are you connecting to a Azure VM using a bastion tunnel? I am facing exactly the same issue and suspect azure-cli to be the reason. VSCode seems to open two connections, one for remote ssh and a second to open the remote container. But the bastion tunnel seems to only support one connection at a time resulting VSCode to block with the log output in your issue description. I managed to create an ugly workaround with two ports and switching the port in my ssh config before opening the container.

@chrmarti
Copy link
Contributor

chrmarti commented May 9, 2022

@uns1 The one you get with F1 > Remote-Containers: Show Container Log.

@uns1
Copy link
Author

uns1 commented May 9, 2022

@chrmarti - same thing - even with log level == trace, all I get is:
image

image

@uns1
Copy link
Author

uns1 commented May 9, 2022

@sharkfox - not entirely sure where/how the machine I'm SSH-ing into is hosted - sorry,

@chrmarti
Copy link
Contributor

@uns1 Do you have "Remote.SSH: Use Local Server" enabled in your user settings? If not: Could you enable it and check if you can still connect to the SSH server using Remote-SSH?

Also: Do you have a RemoteCommand in your SSH config for that server?

@uns1
Copy link
Author

uns1 commented May 10, 2022

@chrmarti - Use Local Server is already enabled. No RemoteCommand in SSH config

@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels May 12, 2022
@ortzinator
Copy link

I had this exact problem with the exact same log.

The only workaround I found was to configure ssh to not need any passwords, either the user password on the host or the key passphrase. At first I tried letting the user log in with just the ssh key but still having a passcode on the key, but the problem remained.

@benchoi93
Copy link

Same problem here.

@abarcovschi
Copy link

abarcovschi commented Jun 3, 2022

I am also having a problem with attaching to a remote docker container.

However, my log gets stuck on the following line when attempting to attach:

image

I am using SSH public key to log into the remote server.

UPDATE 06/06/2022:
In the end, I can connect to an already running docker container that I built and launched manually, but it requires some patience as it takes an undesirably long amount of time to connect and get past the line in the log where it gets stuck on (ranging from 2 mins - 5 mins). Sometimes manually SSHing into the remote machine and removing the "~/.vscode-server" folder and restarting VSC helps, though this will remove any remote VSC configs (elsewhere it is mentioned that removing ~/.vscode-server/bin" suffices.

PS. I am using Windows 10 client and Ubuntu 20.04 server.

@Alino
Copy link

Alino commented Jun 3, 2022

any workaround? I have been waiting for over a year until there are improvements in vscode remote containers so that I can start using it. But sadly it still is pain to setup and use. I have removed my passphrase so it does not prompt me for passwords. I have tried to play with the remote.extensionKind settings. Nothing works...

It works when trying to open the folder in container directly on the machine in its vscode.

But it does not work when I SSH to that machine and try to open the folder in container...

The log is stuck at this:
image

Nor does attaching to an existing container work.

Actually here is the error that I am getting when trying to connect to the already existing and running container:
image

I was trying to connect from MacOS to Windows 10 docker

@iboutsikas
Copy link

Experiencing the same issue. Container start up gets stuck at Start: Run in host: id -un. Also happens if I start/build the container manually and try to attach to it.

@chrmarti chrmarti added this to the June 2022 milestone Jun 7, 2022
@chrmarti
Copy link
Contributor

chrmarti commented Jun 7, 2022

@Alino Connecting to a Windows SSH server is not supported yet. Tracked as #6055.

@abarcovschi That last command in the log transfers the VS Code server to the container. If the connection to the SSH server is slow, that might take more time to finish.

For everyone else, loading the private key into the local SSH agent might work around the problem (which appears to be related to entering a passphrase/password when connecting to the SSH server).

@strazto
Copy link

strazto commented Jun 7, 2022

Getting the same thing - Ubunutu server - Can connect to vscode server fine, but it hangs at the Start: Run in host: id -un part for me

@invigorator96
Copy link

For everyone else, loading the private key into the local SSH agent might work around the problem (which appears to be related to entering a passphrase/password when connecting to the SSH server).

I had the same problem, and this worked for me. Thanks!

@chrmarti chrmarti modified the milestones: July 2022, On Deck Jul 22, 2022
@esttenorio
Copy link

esttenorio commented Sep 30, 2022

Is there any other workaround for this?
I cannot "Attach with VS Code" to a remote container any more.
How can I wipe the host or client to get this functionality back?

It gets stuck on: Run in host: id -un

Or how can I programatically invoke the remote container directly without sshing to the host first with VS Code?

@benchoi93
Copy link

@esttenorio setting up ssh key without passcode worked for me.

@chrmarti
Copy link
Contributor

@esttenorio What is your local OS? What is the ssh server's OS? Could you append your ~/.ssh/config?

@Tuebel
Copy link

Tuebel commented Dec 12, 2022

I had the same problem when RequestTTY force was present in my ~/.ssh/config. Removing this line fixed it for me.

@CyCle1024
Copy link

CyCle1024 commented Feb 8, 2023

@Alino Connecting to a Windows SSH server is not supported yet. Tracked as #6055.

@abarcovschi That last command in the log transfers the VS Code server to the container. If the connection to the SSH server is slow, that might take more time to finish.

For everyone else, loading the private key into the local SSH agent might work around the problem (which appears to be related to entering a passphrase/password when connecting to the SSH server).

I had the same problem that devcontainer attach command hangs after Start: Run in host: id -un. Unfortunately, I have to use password to access my remote machine because there's a jump server between my PC and remote machine. The jump server requires password to login and disable the ssh forward feature (I access the remote machine by jump server's own forward mechanism).

I wonder if there's a work around in my situation? @chrmarti

@maciejskorski
Copy link

Have seen this when connecting to Unbuntu VM on Google Cloud. Hanging exactly as @abarcovschi showed, it helped to clear .vscode-remote-containers and .vscode-server and reconnect.

@lenarddome
Copy link

I had the same error as @abarcovschi. I tried using ssh keys, but the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers
Projects
None yet
Development

No branches or pull requests