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

WSL2 Host - Sharing Git credentials with your container - ssh-agent not forwarding to remote correctly #6395

Closed
Archie-Elvie opened this issue Feb 26, 2022 · 9 comments
Assignees
Labels
containers Issue in vscode-remote containers *question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@Archie-Elvie
Copy link

Archie-Elvie commented Feb 26, 2022

  • VSCode Version: 1.65.0-insider
  • Local OS Version: Windows 10 - 19044.1526
  • Remote OS Version: Ubuntu-20.04
  • Remote Extension/Connection Type: Docker
Logs
[48 ms] Remote-Containers 0.223.0 in VS Code 1.65.0-insider (8440b8f47231147823ba9696913d642e5f2d9d58).
[48 ms] Start: Resolving Remote
[58 ms] Setting up container for folder or workspace: c:\Users\Archie.Atkinson\Documents\fw-cicd-test
[61 ms] Start: Check Docker is running
[61 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[287 ms] Server API version: 1.41
[345 ms] Start: Run: docker-compose version --short
[768 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=fw-cicd-test --filter label=com.docker.compose.service=dev_env
[1043 ms] Start: Run: docker inspect --type container 832a8b4a9f65
[1325 ms] Start: Inspecting container
[1325 ms] Start: Run: docker inspect --type container 832a8b4a9f65be633132137e425906f5434c919943cb5b0e0cdd42820c8caf78
[1634 ms] Start: Run in container: /bin/sh
[1655 ms] Start: Run in container: uname -m
[2049 ms] x86_64
[2049 ms] 
[2049 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[2051 ms] NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
[2051 ms] 
[2052 ms] Start: Run in container: cat /etc/passwd
[2054 ms] Start: Setup shutdown monitor
[2054 ms] Forking shutdown monitor: c:\Users\Archie.Atkinson\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.223.0\dist\shutdown\shutdownMonitorProcess \\.\pipe\vscode-remote-containers-8b189b7a2d17a4f8f04c4fc8c9a516de871efd13-sock dockerCompose Debug c:\Users\Archie.Atkinson\AppData\Roaming\Code - Insiders\logs\20220226T201903\exthost1\ms-vscode-remote.remote-containers 1645906946410
[2068 ms] Start: Run in container: test -d /root/.vscode-server-insiders
[2071 ms] 
[2072 ms] 
[2072 ms] Start: Run in container: test -f '/var/vscode-server-insiders/.patchEtcEnvironmentMarker'
[2073 ms] 
[2073 ms] 
[2073 ms] Start: Run in container: test -f '/var/vscode-server-insiders/.patchEtcProfileMarker'
[2074 ms] 
[2074 ms] 
[2074 ms] Start: Run in container: test ! -f '/root/.vscode-server-insiders/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server-insiders/data/Machine' && { > '/root/.vscode-server-insiders/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[2076 ms] 
[2076 ms] 
[2076 ms] Exit code 1
[2077 ms] Start: Run in container: cat /root/.vscode-server-insiders/data/Machine/settings.json
[2079 ms] 
[2080 ms] cat: /root/.vscode-server-insiders/data/Machine/settings.json: No such file or directory
[2080 ms] Exit code 1
[2080 ms] Start: Run in container: test -d /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider
[2082 ms] 
[2082 ms] 
[2083 ms] Start: Launching Remote-Containers helper.
[2083 ms] ssh-agent: SSH_AUTH_SOCK in container (/tmp/vscode-ssh-auth-2db8e5f259970f6c563e109d26b0442bdd2c87bc.sock) forwarded to local host (\\.\pipe\openssh-ssh-agent).
[2083 ms] Start: Run: gpgconf --list-dir agent-extra-socket
[2102 ms] findLocalWindowsExecutable: Exectuable 'gpgconf' not found on PATH 'C:\Program Files\Google\Chrome\Application;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Python310\Scripts\;C:\Python310\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\Program Files\CMake\bin;C:\HashiCorp\Vagrant\bin;C:\Program Files\usbipd-win\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Nordic Semiconductor\nrf-command-line-tools\bin\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\Archie.Atkinson\AppData\Local\Microsoft\WindowsApps;C:\Users\Archie.Atkinson\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\GitHub CLI\;C:\Program Files (x86)\GnuWin32\bin;C:\Python310;C:\Program Files\SEGGER\JLink;C:\msys64\mingw64\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\CMake\bin;C:\Program Files\PostgreSQL\14\bin;C:\nrfutil;'.
[2105 ms] Start: Run in container: /bin/sh
[2106 ms] userEnvProbe: loginInteractiveShell (default)
[2106 ms] userEnvProbe shell: /bin/bash
[2109 ms] Start: Run in container: # Test for /root/.ssh/known_hosts and ssh
[2111 ms] /root/.ssh/known_hosts exists
[2111 ms] 
[2111 ms] Exit code 1
[2111 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --system --replace-all credential.helper '!f() { /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node /tmp/vscode-remote-containers-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js $*; }; f' || true
[2115 ms] 
[2116 ms] 
[2116 ms] Start: Preparing Extensions
[2116 ms] Start: Run in container: test ! -f '/root/.vscode-server-insiders/data/Machine/.installExtensionsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server-insiders/data/Machine' && { > '/root/.vscode-server-insiders/data/Machine/.installExtensionsMarker' ; } 2> /dev/null
[2117 ms] 
[2117 ms] 
[2117 ms] Exit code 1
[2119 ms] Extensions cache, install extensions: None
[2120 ms] Start: Run in container: test -d /root/.vscode-server-insiders/extensionsCache && ls /root/.vscode-server-insiders/extensionsCache || true
[2123 ms] llvm-vs-code-extensions.vscode-clangd-0.1.15
ms-vscode.cmake-tools-1.9.2
twxs.cmake-0.0.17
xaver.clang-format-1.9.0
yzhang.markdown-all-in-one-3.4.0
[2123 ms] 
[2124 ms] Extensions cache, copy to remote: None
[2124 ms] Start: Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink /proc/$pid/cwd ; readlink /proc/$pid/ns/mnt ; cat /proc/$pid/stat | tr "
[2168 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js' >/tmp/vscode-remote-containers-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js
[2187 ms] Start: Run in container: cat '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider' 2>/dev/null || (umask 377 && echo '92ed85b6-5222-4af9-a5ab-e0d1ec17b334' >'/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider-800d9524-54d8-4ac9-a877-bc9775e4c566' && mv -n '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider-800d9524-54d8-4ac9-a877-bc9775e4c566' '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider' && rm -f '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider-800d9524-54d8-4ac9-a877-bc9775e4c566' && cat '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider')
[2189 ms] fae685df-0f34-4af5-9919-436dab465a78
[2189 ms] 
[2190 ms] Start: Starting VS Code Server
[2564 ms] 
[2565 ms] 
[2565 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js' >/tmp/vscode-remote-containers-server-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js_1645906948975
[2567 ms] 
[2567 ms] 
[2570 ms] Start: Run in Container: /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/bin/code-server-insiders --log debug --force-disable-user-env --server-data-dir /root/.vscode-server-insiders --use-host-proxy --accept-server-license-terms --host 127.0.0.1 --port 0 --connection-token-file /root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider --extensions-download-dir /root/.vscode-server-insiders/extensionsCache --start-server --disable-websocket-compression
[2643 ms] userEnvProbe PATHs:
Probe:     '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
Container: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
[2645 ms] *
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
[2650 ms] Server bound to 127.0.0.1:42085 (IPv4)
Extension host agent listening on 42085

[2651 ms] Start: Run in container: echo 42085 >'/root/.vscode-server-insiders/data/Machine/.devport-8440b8f47231147823ba9696913d642e5f2d9d58-insider'
[2652 ms] 
[2653 ms] 
[2653 ms] Port forwarding for container port 42085 starts listening on local port.
[2654 ms] Port forwarding local port 42085 to container port 42085
[2654 ms] Start: Run in container: mkdir -p '/root/.vscode-server-insiders/data/Machine' && CONTENT="$(cat '/root/.vscode-server-insiders/data/Machine/.onCreateCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2022-02-26T20:12:05.315482743Z}" != '2022-02-26T20:12:05.315482743Z' ] && echo '2022-02-26T20:12:05.315482743Z' > '/root/.vscode-server-insiders/data/Machine/.onCreateCommandMarker'
[2658 ms] 
[2658 ms] 
[2658 ms] Exit code 1
[2658 ms] Start: Run in container: mkdir -p '/root/.vscode-server-insiders/data/Machine' && CONTENT="$(cat '/root/.vscode-server-insiders/data/Machine/.updateContentCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2022-02-26T20:12:05.315482743Z}" != '2022-02-26T20:12:05.315482743Z' ] && echo '2022-02-26T20:12:05.315482743Z' > '/root/.vscode-server-insiders/data/Machine/.updateContentCommandMarker'
[2662 ms] 
[2663 ms] 
[2663 ms] Exit code 1
[2663 ms] Start: Run in container: mkdir -p '/root/.vscode-server-insiders/data/Machine' && CONTENT="$(cat '/root/.vscode-server-insiders/data/Machine/.postCreateCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2022-02-26T20:12:05.315482743Z}" != '2022-02-26T20:12:05.315482743Z' ] && echo '2022-02-26T20:12:05.315482743Z' > '/root/.vscode-server-insiders/data/Machine/.postCreateCommandMarker'
[2667 ms] 
[2667 ms] 
[2667 ms] Exit code 1
[2667 ms] Start: Run in container: # Test for /root/.gitconfig and git
[2669 ms] /root/.gitconfig exists
[2669 ms] 
[2669 ms] Exit code 1
[2669 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global --replace-all credential.helper '!f() { /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node /tmp/vscode-remote-containers-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js $*; }; f' || true
[2675 ms] Port forwarding connection from 63418 > 42085 > 42085 in the container.
[2675 ms] Start: Run in container: /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node -e 
[2676 ms] 
[2676 ms] 
[2676 ms] Start: Run in container: mkdir -p '/root/.vscode-server-insiders/data/Machine' && CONTENT="$(cat '/root/.vscode-server-insiders/data/Machine/.postStartCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2022-02-26T20:20:52.62224788Z}" != '2022-02-26T20:20:52.62224788Z' ] && echo '2022-02-26T20:20:52.62224788Z' > '/root/.vscode-server-insiders/data/Machine/.postStartCommandMarker'
[2680 ms] 
[2680 ms] 
[2680 ms] Exit code 1
[2796 ms] [20:22:29] Extension host agent started.
[3173 ms] Port forwarding connection from 50442 > 42085 > 42085 in the container.
[3174 ms] Start: Run in container: /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node -e 
[3176 ms] [20:22:29] [127.0.0.1][d62e6d15][ManagementConnection] New connection established.
[4188 ms] [20:22:30] [127.0.0.1][b7e9f06c][ExtensionHostConnection] New connection established.
[4192 ms] [20:22:30] [127.0.0.1][b7e9f06c][ExtensionHostConnection] <1428> Launched Extension Host Process.
[5046 ms] Port forwarding connection from 58657 > 42085 > 42085 in the container.
[5047 ms] Start: Run in container: /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node -e 
[10517 ms] Port forwarding 58657 > 42085 > 42085 stderr: Remote close
[10557 ms] Port forwarding 58657 > 42085 > 42085 terminated with code 0 and signal null.
[12145 ms] Extensions cache, remote removals: None
[72152 ms] Extensions cache, remote removals: None
[130565 ms] Port forwarding 58657 > 42085 > 42085: Local close with error
[132162 ms] Extensions cache, remote removals: None

Steps to Reproduce:

  1. Follow the instructions provided in the documentation
  2. Open your container in VSCode
  3. Run ssh-add -l in the Container, response with The agent has no identities.

Same symptoms as #5604 but the solution didn't work.

Here's is the current setup:

WSL2

~/.bash_profile contains: eval $(keychain --eval)
$:ssh-add -l returns my ssh key.
$:ssh -T git@github.com returns: Hi Archie-Elvie! You've successfully authenticated, but GitHub does not provide shell access.
$: ps ax | grep ssh-agent returns a single ssh-agent process.

Container

$:ssh-add -l returns: The agent has no identities.
$:echo $SSH_AUTH_SOCK returns: /tmp/vscode-ssh-auth-2db8e5f259970f6c563e109d26b0442bdd2c87bc.sock
ssh -T git@github.com returns: git@github.com: Permission denied (publickey).

Let me know if you need more information.

@Archie-Elvie Archie-Elvie changed the title WSL2 Host - Sharing Git credentials with your container - ssh-agent not forwarding to remote WSL2 Host - Sharing Git credentials with your container - ssh-agent not forwarding to remote correctly Feb 26, 2022
@github-actions github-actions bot added the containers Issue in vscode-remote containers label Feb 26, 2022
@chrmarti
Copy link
Contributor

Could you post your log after you connected to the dev container? (F1 > Remote-Containers: Show Container Log)

@chrmarti chrmarti self-assigned this Feb 28, 2022
@chrmarti chrmarti added the info-needed Issue requires more information from poster label Feb 28, 2022
@Archie-Elvie
Copy link
Author

[48 ms] Remote-Containers 0.223.0 in VS Code 1.65.0-insider (8440b8f47231147823ba9696913d642e5f2d9d58).
[48 ms] Start: Resolving Remote
[58 ms] Setting up container for folder or workspace: c:\Users\Archie.Atkinson\Documents\fw-cicd-test
[61 ms] Start: Check Docker is running
[61 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[287 ms] Server API version: 1.41
[345 ms] Start: Run: docker-compose version --short
[768 ms] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=fw-cicd-test --filter label=com.docker.compose.service=dev_env
[1043 ms] Start: Run: docker inspect --type container 832a8b4a9f65
[1325 ms] Start: Inspecting container
[1325 ms] Start: Run: docker inspect --type container 832a8b4a9f65be633132137e425906f5434c919943cb5b0e0cdd42820c8caf78
[1634 ms] Start: Run in container: /bin/sh
[1655 ms] Start: Run in container: uname -m
[2049 ms] x86_64
[2049 ms] 
[2049 ms] Start: Run in container: (cat /etc/os-release || cat /usr/lib/os-release) 2>/dev/null
[2051 ms] NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
[2051 ms] 
[2052 ms] Start: Run in container: cat /etc/passwd
[2054 ms] Start: Setup shutdown monitor
[2054 ms] Forking shutdown monitor: c:\Users\Archie.Atkinson\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.223.0\dist\shutdown\shutdownMonitorProcess \\.\pipe\vscode-remote-containers-8b189b7a2d17a4f8f04c4fc8c9a516de871efd13-sock dockerCompose Debug c:\Users\Archie.Atkinson\AppData\Roaming\Code - Insiders\logs\20220226T201903\exthost1\ms-vscode-remote.remote-containers 1645906946410
[2068 ms] Start: Run in container: test -d /root/.vscode-server-insiders
[2071 ms] 
[2072 ms] 
[2072 ms] Start: Run in container: test -f '/var/vscode-server-insiders/.patchEtcEnvironmentMarker'
[2073 ms] 
[2073 ms] 
[2073 ms] Start: Run in container: test -f '/var/vscode-server-insiders/.patchEtcProfileMarker'
[2074 ms] 
[2074 ms] 
[2074 ms] Start: Run in container: test ! -f '/root/.vscode-server-insiders/data/Machine/.writeMachineSettingsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server-insiders/data/Machine' && { > '/root/.vscode-server-insiders/data/Machine/.writeMachineSettingsMarker' ; } 2> /dev/null
[2076 ms] 
[2076 ms] 
[2076 ms] Exit code 1
[2077 ms] Start: Run in container: cat /root/.vscode-server-insiders/data/Machine/settings.json
[2079 ms] 
[2080 ms] cat: /root/.vscode-server-insiders/data/Machine/settings.json: No such file or directory
[2080 ms] Exit code 1
[2080 ms] Start: Run in container: test -d /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider
[2082 ms] 
[2082 ms] 
[2083 ms] Start: Launching Remote-Containers helper.
[2083 ms] ssh-agent: SSH_AUTH_SOCK in container (/tmp/vscode-ssh-auth-2db8e5f259970f6c563e109d26b0442bdd2c87bc.sock) forwarded to local host (\\.\pipe\openssh-ssh-agent).
[2083 ms] Start: Run: gpgconf --list-dir agent-extra-socket
[2102 ms] findLocalWindowsExecutable: Exectuable 'gpgconf' not found on PATH 'C:\Program Files\Google\Chrome\Application;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Python310\Scripts\;C:\Python310\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\Program Files\CMake\bin;C:\HashiCorp\Vagrant\bin;C:\Program Files\usbipd-win\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Nordic Semiconductor\nrf-command-line-tools\bin\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\Archie.Atkinson\AppData\Local\Microsoft\WindowsApps;C:\Users\Archie.Atkinson\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files (x86)\GitHub CLI\;C:\Program Files (x86)\GnuWin32\bin;C:\Python310;C:\Program Files\SEGGER\JLink;C:\msys64\mingw64\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\CMake\bin;C:\Program Files\PostgreSQL\14\bin;C:\nrfutil;'.
[2105 ms] Start: Run in container: /bin/sh
[2106 ms] userEnvProbe: loginInteractiveShell (default)
[2106 ms] userEnvProbe shell: /bin/bash
[2109 ms] Start: Run in container: # Test for /root/.ssh/known_hosts and ssh
[2111 ms] /root/.ssh/known_hosts exists
[2111 ms] 
[2111 ms] Exit code 1
[2111 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --system --replace-all credential.helper '!f() { /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node /tmp/vscode-remote-containers-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js $*; }; f' || true
[2115 ms] 
[2116 ms] 
[2116 ms] Start: Preparing Extensions
[2116 ms] Start: Run in container: test ! -f '/root/.vscode-server-insiders/data/Machine/.installExtensionsMarker' && set -o noclobber && mkdir -p '/root/.vscode-server-insiders/data/Machine' && { > '/root/.vscode-server-insiders/data/Machine/.installExtensionsMarker' ; } 2> /dev/null
[2117 ms] 
[2117 ms] 
[2117 ms] Exit code 1
[2119 ms] Extensions cache, install extensions: None
[2120 ms] Start: Run in container: test -d /root/.vscode-server-insiders/extensionsCache && ls /root/.vscode-server-insiders/extensionsCache || true
[2123 ms] llvm-vs-code-extensions.vscode-clangd-0.1.15
ms-vscode.cmake-tools-1.9.2
twxs.cmake-0.0.17
xaver.clang-format-1.9.0
yzhang.markdown-all-in-one-3.4.0
[2123 ms] 
[2124 ms] Extensions cache, copy to remote: None
[2124 ms] Start: Run in container: for pid in `cd /proc && ls -d [0-9]*`; do { echo $pid ; readlink /proc/$pid/cwd ; readlink /proc/$pid/ns/mnt ; cat /proc/$pid/stat | tr "
[2168 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js' >/tmp/vscode-remote-containers-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js
[2187 ms] Start: Run in container: cat '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider' 2>/dev/null || (umask 377 && echo '92ed85b6-5222-4af9-a5ab-e0d1ec17b334' >'/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider-800d9524-54d8-4ac9-a877-bc9775e4c566' && mv -n '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider-800d9524-54d8-4ac9-a877-bc9775e4c566' '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider' && rm -f '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider-800d9524-54d8-4ac9-a877-bc9775e4c566' && cat '/root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider')
[2189 ms] fae685df-0f34-4af5-9919-436dab465a78
[2189 ms] 
[2190 ms] Start: Starting VS Code Server
[2564 ms] 
[2565 ms] 
[2565 ms] Start: Run in container: cat <<'EOF-/tmp/vscode-remote-containers-server-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js' >/tmp/vscode-remote-containers-server-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js_1645906948975
[2567 ms] 
[2567 ms] 
[2570 ms] Start: Run in Container: /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/bin/code-server-insiders --log debug --force-disable-user-env --server-data-dir /root/.vscode-server-insiders --use-host-proxy --accept-server-license-terms --host 127.0.0.1 --port 0 --connection-token-file /root/.vscode-server-insiders/data/Machine/.connection-token-8440b8f47231147823ba9696913d642e5f2d9d58-insider --extensions-download-dir /root/.vscode-server-insiders/extensionsCache --start-server --disable-websocket-compression
[2643 ms] userEnvProbe PATHs:
Probe:     '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
Container: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
[2645 ms] *
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
[2650 ms] Server bound to 127.0.0.1:42085 (IPv4)
Extension host agent listening on 42085

[2651 ms] Start: Run in container: echo 42085 >'/root/.vscode-server-insiders/data/Machine/.devport-8440b8f47231147823ba9696913d642e5f2d9d58-insider'
[2652 ms] 
[2653 ms] 
[2653 ms] Port forwarding for container port 42085 starts listening on local port.
[2654 ms] Port forwarding local port 42085 to container port 42085
[2654 ms] Start: Run in container: mkdir -p '/root/.vscode-server-insiders/data/Machine' && CONTENT="$(cat '/root/.vscode-server-insiders/data/Machine/.onCreateCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2022-02-26T20:12:05.315482743Z}" != '2022-02-26T20:12:05.315482743Z' ] && echo '2022-02-26T20:12:05.315482743Z' > '/root/.vscode-server-insiders/data/Machine/.onCreateCommandMarker'
[2658 ms] 
[2658 ms] 
[2658 ms] Exit code 1
[2658 ms] Start: Run in container: mkdir -p '/root/.vscode-server-insiders/data/Machine' && CONTENT="$(cat '/root/.vscode-server-insiders/data/Machine/.updateContentCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2022-02-26T20:12:05.315482743Z}" != '2022-02-26T20:12:05.315482743Z' ] && echo '2022-02-26T20:12:05.315482743Z' > '/root/.vscode-server-insiders/data/Machine/.updateContentCommandMarker'
[2662 ms] 
[2663 ms] 
[2663 ms] Exit code 1
[2663 ms] Start: Run in container: mkdir -p '/root/.vscode-server-insiders/data/Machine' && CONTENT="$(cat '/root/.vscode-server-insiders/data/Machine/.postCreateCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2022-02-26T20:12:05.315482743Z}" != '2022-02-26T20:12:05.315482743Z' ] && echo '2022-02-26T20:12:05.315482743Z' > '/root/.vscode-server-insiders/data/Machine/.postCreateCommandMarker'
[2667 ms] 
[2667 ms] 
[2667 ms] Exit code 1
[2667 ms] Start: Run in container: # Test for /root/.gitconfig and git
[2669 ms] /root/.gitconfig exists
[2669 ms] 
[2669 ms] Exit code 1
[2669 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global --replace-all credential.helper '!f() { /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node /tmp/vscode-remote-containers-2db8e5f259970f6c563e109d26b0442bdd2c87bc.js $*; }; f' || true
[2675 ms] Port forwarding connection from 63418 > 42085 > 42085 in the container.
[2675 ms] Start: Run in container: /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node -e 
[2676 ms] 
[2676 ms] 
[2676 ms] Start: Run in container: mkdir -p '/root/.vscode-server-insiders/data/Machine' && CONTENT="$(cat '/root/.vscode-server-insiders/data/Machine/.postStartCommandMarker' 2>/dev/null || echo ENOENT)" && [ "${CONTENT:-2022-02-26T20:20:52.62224788Z}" != '2022-02-26T20:20:52.62224788Z' ] && echo '2022-02-26T20:20:52.62224788Z' > '/root/.vscode-server-insiders/data/Machine/.postStartCommandMarker'
[2680 ms] 
[2680 ms] 
[2680 ms] Exit code 1
[2796 ms] [20:22:29] Extension host agent started.
[3173 ms] Port forwarding connection from 50442 > 42085 > 42085 in the container.
[3174 ms] Start: Run in container: /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node -e 
[3176 ms] [20:22:29] [127.0.0.1][d62e6d15][ManagementConnection] New connection established.
[4188 ms] [20:22:30] [127.0.0.1][b7e9f06c][ExtensionHostConnection] New connection established.
[4192 ms] [20:22:30] [127.0.0.1][b7e9f06c][ExtensionHostConnection] <1428> Launched Extension Host Process.
[5046 ms] Port forwarding connection from 58657 > 42085 > 42085 in the container.
[5047 ms] Start: Run in container: /root/.vscode-server-insiders/bin/8440b8f47231147823ba9696913d642e5f2d9d58-insider/node -e 
[10517 ms] Port forwarding 58657 > 42085 > 42085 stderr: Remote close
[10557 ms] Port forwarding 58657 > 42085 > 42085 terminated with code 0 and signal null.
[12145 ms] Extensions cache, remote removals: None
[72152 ms] Extensions cache, remote removals: None
[130565 ms] Port forwarding 58657 > 42085 > 42085: Local close with error
[132162 ms] Extensions cache, remote removals: None

@chrmarti
Copy link
Contributor

chrmarti commented Mar 1, 2022

It is forwarding to the ssh-agent on Windows (local host):

[2083 ms] ssh-agent: SSH_AUTH_SOCK in container (/tmp/vscode-ssh-auth-2db8e5f259970f6c563e109d26b0442bdd2c87bc.sock) forwarded to local host (\\.\pipe\openssh-ssh-agent).

I see you are opening a Windows folder, we only use Windows-side tools for this by default. Try enabling the Execute In WSL setting:
image

@Archie-Elvie
Copy link
Author

Enabling that gives this error when I rebuild:

[2022-03-01T14:05:10.748Z] Remote-Containers 0.217.4 in VS Code 1.64.2 (f80445acd5a3dadef24aa209168452a3d97cc326).
[2022-03-01T14:05:10.747Z] Start: Resolving Remote
[2022-03-01T14:05:10.751Z] Start: Run: wsl -l -v
[2022-03-01T14:05:10.812Z] Stop (61 ms): Run: wsl -l -v
[2022-03-01T14:05:10.812Z] Start: Run: wsl -d Ubuntu -e wslpath -u c:\Users\Archie.Atkinson\Documents\fw-cicd-test
[2022-03-01T14:05:10.892Z] Stop (80 ms): Run: wsl -d Ubuntu -e wslpath -u c:\Users\Archie.Atkinson\Documents\fw-cicd-test
[2022-03-01T14:05:10.894Z] Start: Run: wsl -d Ubuntu -e /bin/sh -c cd '/mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test' && /bin/sh
[2022-03-01T14:05:10.927Z] Start: Run in host: id -un
[2022-03-01T14:05:10.959Z] aa
[2022-03-01T14:05:10.960Z] 
[2022-03-01T14:05:10.960Z] Stop (33 ms): Run in host: id -un
[2022-03-01T14:05:10.960Z] Start: Run in host: cat /etc/passwd
[2022-03-01T14:05:10.961Z] Stop (1 ms): Run in host: cat /etc/passwd
[2022-03-01T14:05:10.962Z] Start: Run in host: echo ~
[2022-03-01T14:05:10.963Z] /home/aa
[2022-03-01T14:05:10.963Z] 
[2022-03-01T14:05:10.963Z] Stop (1 ms): Run in host: echo ~
[2022-03-01T14:05:10.964Z] Start: Run in host: test -x '/home/aa/.vscode-remote-containers/bin/f80445acd5a3dadef24aa209168452a3d97cc326/node'
[2022-03-01T14:05:10.964Z] 
[2022-03-01T14:05:10.964Z] 
[2022-03-01T14:05:10.964Z] Stop (0 ms): Run in host: test -x '/home/aa/.vscode-remote-containers/bin/f80445acd5a3dadef24aa209168452a3d97cc326/node'
[2022-03-01T14:05:10.964Z] Start: Run in host: test -f '/home/aa/.vscode-remote-containers/dist/vscode-remote-containers-server-0.217.4.js'
[2022-03-01T14:05:10.965Z] 
[2022-03-01T14:05:10.965Z] 
[2022-03-01T14:05:10.965Z] Stop (1 ms): Run in host: test -f '/home/aa/.vscode-remote-containers/dist/vscode-remote-containers-server-0.217.4.js'
[2022-03-01T14:05:10.967Z] userEnvProbe: loginInteractiveShell (default)
[2022-03-01T14:05:10.967Z] userEnvProbe shell: /bin/bash
[2022-03-01T14:05:11.074Z] userEnvProbe PATHs:
Probe:     '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/VMware/VMware Workstation/bin/:/mnt/c/Python310/Scripts/:/mnt/c/Python310/:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files/Git/cmd:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/CMake/bin:/mnt/c/HashiCorp/Vagrant/bin:/mnt/c/Program Files/usbipd-win/:/mnt/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit/:/mnt/c/Program Files (x86)/Nordic Semiconductor/nrf-command-line-tools/bin/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/Archie.Atkinson/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Archie.Atkinson/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Program Files (x86)/GitHub CLI/:/mnt/c/Program Files (x86)/GnuWin32/bin:/mnt/c/Python310:/mnt/c/Program Files/SEGGER/JLink:/mnt/c/msys64/mingw64/bin:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/CMake/bin:/mnt/c/Program Files/PostgreSQL/14/bin:/mnt/c/nrfutil:/snap/bin'
Container: None
[2022-03-01T14:05:11.075Z] Setting up container for folder or workspace: /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test
[2022-03-01T14:05:11.083Z] Start: Check Docker is running
[2022-03-01T14:05:11.083Z] Start: Run in Host: docker version --format {{.Server.APIVersion}}
[2022-03-01T14:05:11.183Z] Stop (100 ms): Run in Host: docker version --format {{.Server.APIVersion}}
[2022-03-01T14:05:11.184Z] Server API version: 1.41
[2022-03-01T14:05:11.184Z] Stop (101 ms): Check Docker is running
[2022-03-01T14:05:11.213Z] Start: Run in Host: git rev-parse --show-cdup
[2022-03-01T14:05:11.225Z] Stop (12 ms): Run in Host: git rev-parse --show-cdup
[2022-03-01T14:05:11.226Z] Start: Run in Host: docker ps -q -a --filter label=vsch.local.folder=c:\Users\Archie.Atkinson\Documents\fw-cicd-test --filter label=vsch.quality=stable
[2022-03-01T14:05:11.359Z] Stop (133 ms): Run in Host: docker ps -q -a --filter label=vsch.local.folder=c:\Users\Archie.Atkinson\Documents\fw-cicd-test --filter label=vsch.quality=stable
[2022-03-01T14:05:11.360Z] Start: Run in Host: docker inspect --type container 4e51473a34d3
[2022-03-01T14:05:11.480Z] Stop (120 ms): Run in Host: docker inspect --type container 4e51473a34d3
[2022-03-01T14:05:11.481Z] Start: Removing Existing Container
[2022-03-01T14:05:11.481Z] Start: Run in Host: docker rm -f 4e51473a34d3e1e63f74759b5be89edffbc9b36fce63126ed96813bbdd6464f3
[2022-03-01T14:05:11.675Z] Stop (194 ms): Run in Host: docker rm -f 4e51473a34d3e1e63f74759b5be89edffbc9b36fce63126ed96813bbdd6464f3
[2022-03-01T14:05:11.675Z] Stop (194 ms): Removing Existing Container
[2022-03-01T14:05:11.677Z] Start: Run in Host: docker build -f /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test/dockerfile -t vsc-fw-cicd-test-85412a1b2b3c78e6da2c6c0077475d18 /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test
[2022-03-01T14:05:11.970Z] [+] Building 0.0s (0/1)                                                         
[2022-03-01T14:05:11.998Z] [+] Building 0.0s (1/2)                                                         
 => ERROR [internal] load build definition from dockerfile                 0.0s
 => => transferring dockerfile: 86B                                        0.0s
[2022-03-01T14:05:11.998Z] ------
 > [internal] load build definition from dockerfile:
------
failed to solve with frontend dockerfile.v0: failed to read dockerfile: error from sender: open /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test/.cache: permission denied
[2022-03-01T14:05:12.017Z] Stop (340 ms): Run in Host: docker build -f /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test/dockerfile -t vsc-fw-cicd-test-85412a1b2b3c78e6da2c6c0077475d18 /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test
[2022-03-01T14:05:12.020Z] Command failed: docker build -f /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test/dockerfile -t vsc-fw-cicd-test-85412a1b2b3c78e6da2c6c0077475d18 /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test
[2022-03-01T14:05:12.020Z] Exit code 1
[2022-03-01T14:05:17.455Z] Start: Run in Host: wslpath -w /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test/dockerfile
[2022-03-01T14:05:17.461Z] Stop (6 ms): Run in Host: wslpath -w /mnt/c/Users/Archie.Atkinson/Documents/fw-cicd-test/dockerfile

I have the windows ssh-agent working correctly as well so I'm happy to forward either one. Which ever is simpler.

@chrmarti
Copy link
Contributor

chrmarti commented Mar 2, 2022

Does ssh-add -l on Windows list your keys? You might have to start the ssh-agent on Windows first.

@Archie-Elvie
Copy link
Author

ssh-add -l returns The agent has no identities. However ssh -T git@github.com returns Hi Archie-Elvie! You've successfully authenticated, but GitHub does not provide shell access..
Get-Service ssh-agent shows it running correctly.

I added my ssh key and it working correctly. I am able to use git correctly in my container.

Thank you for your help.

Do you know git worked in PowerShell without a key added?

@chrmarti
Copy link
Contributor

chrmarti commented Mar 7, 2022

I guess your private key is unencrypted on disk, so ssh can use it without you adding it to the ssh-agent or asking you for a passphrase. The ssh-agent probably (haven't checked the docs) does not use unencrypted private keys that have not been added with ssh-add first.

Closing as resolved, thanks.

@chrmarti chrmarti closed this as completed Mar 7, 2022
@chrmarti chrmarti added *question Issue represents a question, should be posted to StackOverflow (VS Code) and removed info-needed Issue requires more information from poster labels Mar 7, 2022
@shadycuz
Copy link

shadycuz commented Mar 19, 2022

@chrmarti I'm having a very similar error. My devcontainer used to work, but no longer does. It seems to have switched from getting its credentials from Windows instead of the WSL2.

I don't really want to add my credentials to windows? How can I make my devcontainer work again with the credentials (ssh keys) from WSL2?

Should I make a new issue?

Thanks

EDIT: Fixed it with a lot of weird hackery

@chrmarti
Copy link
Contributor

@shadycuz It should use the ssh-agent in WSL when there is one.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers *question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants