devpod icon indicating copy to clipboard operation
devpod copied to clipboard

Starting container with --debug prints repeating fatal error

Open ptab opened this issue 2 years ago • 2 comments

What happened? ~~I am unable to interact with any git repository inside a devcontainer, as DevPod is not able to forward SSH authentication requests to my SSH agent.~~ Turns out SSH forwarding does works, it was an issue on my side. Somehow MacOS replaced SSH_AUTH_SOCK with its own agent, which apparently would still internally forward requests to 1Password (since I would get the 1Password fingerprint dialogs when connecting directly via SSH). I do still see a lot of fatal error messages when connecting to the container using devpod ssh --debug so I'll leave this issue up.

What did you expect to happen instead?
~~I expect DevPod to correctly forward requests from inside the container to my SSH agent so that I am able to interact with a git repository.~~ I expect no fatal errors in the debug logs when connecting to a devcontainer.

How can we reproduce the bug? (as minimally and precisely as possible)
I created a simple project to showcase the issue: https://github.com/ptab/reproduce-devpod-bug.

  1. Create a workspace from the repository:

    ❯ devpod up [email protected]:ptab/reproduce-devpod-bug.git --ide none
    16:47:15 info Creating devcontainer...
    16:47:15 info Clone repository
    16:47:15 info URL: [email protected]:ptab/reproduce-devpod-bug.git
    16:47:17 done Successfully cloned repository
    16:47:17 warn dev container config is missing one of "image", "dockerFile" or "dockerComposeFile" properties, defaulting to auto-detection
    16:47:18 info Found existing local image vsc-content-32bbf:devpod-cd4037f429101ea3b6dd5207e681a1c8
    16:47:18 info Inspecting image vsc-content-32bbf:devpod-cd4037f429101ea3b6dd5207e681a1c8
    16:47:18 info 727e017f3fd721b413f857fd14038d6bccebe09e71844ac59e408025946f377b
    16:47:19 info Setup container...
    16:47:20 info Chown workspace...
    16:47:20 info Run command : mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts...
    16:47:20 warn # github.com:22 SSH-2.0-babeld-9e2e2a76e
    16:47:20 done Successfully ran command : mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
    16:47:20 info Run 'ssh github-com-ptab-reproduce-devpod-bug.devpod' to ssh into the devcontainer
    
  2. Connect to the workspace via SSH to verify agent forwarding works:

    ❯ ssh github-com-ptab-reproduce-devpod-bug.devpod
    vscode ➜ /workspaces/github-com-ptab-reproduce-devpod-bug (main) $ git pull 
    Already up to date.
    

~3. Connect to the workspace through DevPod to verify it does not~ (EDIT: removed because this actually does work)

  1. Connect to the workspace with --debug flag to see a very clear error, repeating non-stop:
    16:52:02 info Execute SSH server command: bash -c '/usr/local/bin/devpod' agent container credentials-server --user 'vscode' --configure-git-helper --git-user-signing-key ssh-ed25519 <redacted> --configure-docker-helper --debug
    16:52:02 debug 15:52:02 fatal unknown command "<redacted>" for "devpod agent container credentials-server"
    
    This prevents the terminal to be used as the error message is printed every few seconds.

devcontainer.json:

{
  "name": "reproduce-devpod-bug",
  "features": {
    "ghcr.io/devcontainers/features/git:1": {}
  },
  "postCreateCommand": "mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts",
}

Local Environment:

  • DevPod Version: v0.6.1
  • Operating System: mac Sequoia 15.1
  • ARCH of the OS: ARM64

DevPod Provider:

  • Local/remote provider: docker

Anything else we need to know?
My SSH agent is 1Password for SSH & Git.

ptab avatar Dec 02 '24 15:12 ptab

This does seem to be having an actual effect, in that it stops the docker credential helper from working. I'm guessing the ssh key is meant to be enclosed in quotes in the generated command, because setting GIT_SSH_SIGNATURE_FORWARDING=false is making the docker credential helper work.

AmandaCameron avatar Dec 03 '24 20:12 AmandaCameron

@ptab and @AmandaCameron thanks for the info, looks like we need to base64 encode the signing key to work around line break and whitespace issues

pascalbreuninger avatar Dec 05 '24 06:12 pascalbreuninger