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

WrappedError(WrappedError { message: "file not found", original: "Permission denied (os error 13)" }) when attaching to container over SSH #10632

Open
6 tasks done
amoscao opened this issue Jan 15, 2025 · 2 comments
Assignees
Labels
ssh Issue in vscode-remote SSH

Comments

@amoscao
Copy link

amoscao commented Jan 15, 2025

Is there an existing issue for this bug?

  • I have searched the existing open issues and found none that apply.
  • If I find any issue of interest that is related or closed, I will included a link to it in this issue.

Required Troubleshooting Steps

  • I have read and performed the troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting
  • My issue was not covered in the Tips and Tricks linked from the Troubleshooting Wiki.
  • I will include a complete copy of my Remote - SSH logs by running Remote-SSH: Show Log in the command palette or from View > Output in the menu bar

[Optional] Diagnose with Copilot

I asked @remote-ssh but it did not help

In step 2 of the troubleshooting wiki, what was the result of running the generated SSH command verbatim outside of VS Code?

I COULD successfully SSH to the remote machine with the generated SSH command

Remote-SSH Log

Remote-SSH Log

[11:18:33.001] Log Level: 2
[11:18:33.017] SSH Resolver called for "ssh-remote+d02", attempt 1
[11:18:33.020] remote.SSH.useLocalServer = false
[11:18:33.020] remote.SSH.useExecServer = true
[11:18:33.020] remote.SSH.showLoginTerminal = false
[11:18:33.020] remote.SSH.remotePlatform = {}
[11:18:33.020] remote.SSH.path = 
[11:18:33.020] remote.SSH.configFile = 
[11:18:33.020] remote.SSH.useFlock = true
[11:18:33.020] remote.SSH.lockfilesInTmp = false
[11:18:33.020] remote.SSH.localServerDownload = auto
[11:18:33.020] remote.SSH.remoteServerListenOnSocket = false
[11:18:33.020] remote.SSH.defaultExtensions = []
[11:18:33.020] remote.SSH.loglevel = 2
[11:18:33.020] remote.SSH.enableDynamicForwarding = true
[11:18:33.020] remote.SSH.enableRemoteCommand = false
[11:18:33.020] remote.SSH.serverPickPortsFromRange = {}
[11:18:33.020] remote.SSH.serverInstallPath = {}
[11:18:33.021] remote.SSH.permitPtyAllocation = false
[11:18:33.021] remote.SSH.preferredLocalPortRange = undefined
[11:18:33.021] remote.SSH.useCurlAndWgetConfigurationFiles = false
[11:18:33.021] remote.SSH.experimental.chat = true
[11:18:33.021] remote.SSH.experimental.enhancedSessionLogs = true
[11:18:33.027] VS Code version: 1.96.2
[11:18:33.027] Remote-SSH version: remote-ssh@0.116.1
[11:18:33.027] linux x64
[11:18:33.029] SSH Resolver called for host: d02
[11:18:33.029] Setting up SSH remote "d02"
[11:18:33.033] Using commit id "fabdb6a30b49f79a7aba0f2ad9df9b399473380f" and quality "stable" for server
[11:18:33.037] Script variables:
 {
  "ExitCode.0": "OK",
  "ExitCode.64": "LinuxPrereqs",
  "ExitCode.65": "ProxyAuthenticationRequired",
  "ExitCode.128": "UnparsableOutput",
  "ExitCode.129": "EmptyOutput",
  "ExitCode.131": "UnhandledResolverExitCode",
  "ExitCode.132": "OfflineError",
  "ExitCode.133": "SshInstall",
  "ExitCode.134": "FindLocalPort",
  "ExitCode.135": "Timeout",
  "ExitCode.136": "ExhaustedRetries",
  "ExitCode.137": "PermissionDenied",
  "ExitCode.138": "MitmPortForwardingDisabled",
  "ExitCode.139": "Canceled",
  "ExitCode.140": "BadLocalDownloadRequest",
  "ExitCode.141": "LocalDownloadFailed",
  "ExitCode.142": "LocalLockTimeout",
  "ExitCode.143": "NoBash",
  "ExitCode.144": "InvalidHostName",
  "ExitCode.145": "BadInstallScriptResult",
  "ExitCode.146": "ShellRequestFailedOnChannel",
  "ExitCode.147": "InvalidPortRange",
  "ExitCode.148": "SendDisconnectBrokenPipe",
  "ExitCode.149": "LocalServerCrashed",
  "ExitCode.150": "NoFreePortInRange",
  "ExitCode.151": "InvalidCustomServerPath",
  "ExitCode.192": "AlreadyInProgress",
  "ExitCode.193": "ServerDownloadFailed",
  "ExitCode.194": "NoDownloaderAvailable",
  "ExitCode.195": "NoDownloaderAvailableForStatusCheck",
  "ExitCode.196": "UnsupportedArch",
  "ExitCode.197": "StatusCheckFailed",
  "ExitCode.198": "NeedInsidersArch",
  "ExitCode.199": "ServerTransferFailed",
  "ExitCode.200": "ServerFailedToStart",
  "ExitCode.201": "NeedInsidersWindows",
  "ExitCode.202": "CreateInstallDirFailed",
  "ExitCode.203": "UnsupportedPlatform",
  "ExitCode.204": "ServerTerminatedCVE20201416",
  "ExitCode.205": "UnpackFailed",
  "ExitCode.206": "ChangeDirFailed",
  "ExitCode.1023": "UnclassifiedError",
  "ExitCode.OK": "0",
  "ExitCode.LinuxPrereqs": "64",
  "ExitCode.ProxyAuthenticationRequired": "65",
  "ExitCode.UnparsableOutput": "128",
  "ExitCode.EmptyOutput": "129",
  "ExitCode.UnhandledResolverExitCode": "131",
  "ExitCode.OfflineError": "132",
  "ExitCode.SshInstall": "133",
  "ExitCode.FindLocalPort": "134",
  "ExitCode.Timeout": "135",
  "ExitCode.ExhaustedRetries": "136",
  "ExitCode.PermissionDenied": "137",
  "ExitCode.MitmPortForwardingDisabled": "138",
  "ExitCode.Canceled": "139",
  "ExitCode.BadLocalDownloadRequest": "140",
  "ExitCode.LocalDownloadFailed": "141",
  "ExitCode.LocalLockTimeout": "142",
  "ExitCode.NoBash": "143",
  "ExitCode.InvalidHostName": "144",
  "ExitCode.BadInstallScriptResult": "145",
  "ExitCode.ShellRequestFailedOnChannel": "146",
  "ExitCode.InvalidPortRange": "147",
  "ExitCode.SendDisconnectBrokenPipe": "148",
  "ExitCode.LocalServerCrashed": "149",
  "ExitCode.NoFreePortInRange": "150",
  "ExitCode.InvalidCustomServerPath": "151",
  "ExitCode.AlreadyInProgress": "192",
  "ExitCode.ServerDownloadFailed": "193",
  "ExitCode.NoDownloaderAvailable": "194",
  "ExitCode.NoDownloaderAvailableForStatusCheck": "195",
  "ExitCode.UnsupportedArch": "196",
  "ExitCode.StatusCheckFailed": "197",
  "ExitCode.NeedInsidersArch": "198",
  "ExitCode.ServerTransferFailed": "199",
  "ExitCode.ServerFailedToStart": "200",
  "ExitCode.NeedInsidersWindows": "201",
  "ExitCode.CreateInstallDirFailed": "202",
  "ExitCode.UnsupportedPlatform": "203",
  "ExitCode.ServerTerminatedCVE20201416": "204",
  "ExitCode.UnpackFailed": "205",
  "ExitCode.ChangeDirFailed": "206",
  "ExitCode.UnclassifiedError": "1023",
  "InstallUnpackCode.Success": "success",
  "InstallUnpackCode.Error": "error",
  "InstallUnpackCode.MissingFiles": "missingFiles",
  "uuid": "11c12721f2cf",
  "startMarker": "11c12721f2cf: running",
  "commitId": "fabdb6a30b49f79a7aba0f2ad9df9b399473380f",
  "quality": "stable",
  "token": "a111aa1a-1111-1111-a111-1a11a111a1aa",
  "vscodeAgentFolder": "$HOME/.vscode-server",
  "allowClientDownload": "1",
  "forceClientDownload": "0",
  "cliNameInArchive": "code",
  "ignoreWgetConfigFlag": " --no-config ",
  "ignoreCurlConfigFlag": " --disable ",
  "wgetTriesSegment": "--tries=1",
  "listenArgs": "--on-host=127.0.0.1 --on-port",
  "getDownloadServerStartTrigger": "11c12721f2cf:trigger_server_download",
  "getDownloadServerEndTrigger": "11c12721f2cf:trigger_server_download_end",
  "getProgressDownloading": "11c12721f2cf%%1%%",
  "getProgressInstalling": "11c12721f2cf%%2%%",
  "printVars": "echo \"SSH_AUTH_SOCK==$SSH_AUTH_SOCK==\"\necho \"DISPLAY==$DISPLAY==\""
}
[11:18:33.038] Install and start server if needed
[11:18:35.689] PATH: /snap/bin:/home/amos/.local/bin:/home/amos/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/amos/.fzf/bin
[11:18:35.689] Checking ssh with "ssh -V"
[11:18:35.696] > OpenSSH_8.2p1 Ubuntu-4ubuntu0.11, OpenSSL 1.1.1f  31 Mar 2020

[11:18:35.698] Running script with connection command: ssh -T -D 39703 -o ConnectTimeout=15 d02 sh
[11:18:35.698] Generated SSH command: 'ssh -T -D 39703 -o ConnectTimeout=15 d02 sh << 'EOSSH'
# shellcheck shell=sh

echo "11c12721f2cf: running"
echo "Script executing under PID: $$"

VSC_TMP="${XDG_RUNTIME_DIR:-/tmp}"

# Configuration
UUID="11c12721f2cf"
COMMIT_ID="fabdb6a30b49f79a7aba0f2ad9df9b399473380f"
QUALITY="stable"
TOKEN="f243dd9c-4704-4573-a876-4f55c574d5cd"
VSCODE_AGENT_FOLDER="$HOME/.vscode-server"
ALLOW_CLIENT_DOWNLOAD="1"
FORCE_CLIENT_DOWNLOAD="0"
CLI_NAME_IN_ARCHIVE="code"
IGNORE_WGET_CONFIG_FLAG=" --no-config "
IGNORE_CURL_CONFIG_FLAG=" --disable "
WGET_TRIES_SEGMENT="--tries=1"
LISTEN_ARGS="--on-host=127.0.0.1 --on-port"

CLI_NAME_ON_DISK="${CLI_NAME_IN_ARCHIVE}-${COMMIT_ID}"
CLI_PATH="${VSCODE_AGENT_FOLDER}/${CLI_NAME_ON_DISK}"
CLI_LOG_FILE="${VSCODE_AGENT_FOLDER}/.cli.${COMMIT_ID}.log"

# Marker strings
GET_DOWNLOAD_SERVER_START_TRIGGER="11c12721f2cf:trigger_server_download"
GET_DOWNLOAD_SERVER_END_TRIGGER="11c12721f2cf:trigger_server_download_end"
GET_PROGRESS_DOWNLOADING="11c12721f2cf%%1%%"
GET_PROGRESS_INSTALLING="11c12721f2cf%%2%%"

UNPACK_RESULT=
DID_LOCAL_DOWNLOAD=0
DOWNLOAD_TIME=
INSTALL_TIME=
SERVER_START_TIME=

fail_with_exitcode() {
	echo "${UUID}: start"
	echo "exitCode==$1=="
	echo_common_results
	echo "${UUID}: end"
	exit 0
}

echo_common_results() {
	echo "listeningOn==$LISTENING_ON=="
	echo "osReleaseId==$OSRELEASEID=="
	echo "arch==$ARCH=="
	echo "vscodeArch==$VSCODE_ARCH=="
	echo "bitness==$BITNESS=="
	echo "tmpDir==$VSC_TMP=="
	echo "platform==$PLATFORM=="
	echo "unpackResult==$UNPACK_RESULT=="
	echo "didLocalDownload==$DID_LOCAL_DOWNLOAD=="
	echo "downloadTime==$DOWNLOAD_TIME=="
	echo "installTime==$INSTALL_TIME=="
	echo "serverStartTime==$SERVER_START_TIME=="
	echo "execServerToken==${TOKEN}=="
	echo "platformDownloadPath==$PLATFORM_DOWNLOAD_PATH=="
	echo "SSH_AUTH_SOCK==$SSH_AUTH_SOCK=="
echo "DISPLAY==$DISPLAY=="
}

millis() {
	d=$(date +%s%N)
	# Test if 'd' contains any non-digit characters
	if [ -z "${d##*[!0-9]*}" ] || [ "$PLATFORM" != "linux" ]; then
	    # Fallback for MacOS or any date binary that doesn't handle '%N'
		echo $(($(date +%s)*1000))
		return
	fi
	echo $((d/1000000))
}

elapsed() {
	echo $(($(millis) - $1))
}

printenv_indent() {
	echo "printenv:"
	printenv | sed 's/^/    /'
}

#
# Get OS name
#
OSRELEASEID=$(cat /etc/os-release 2>/dev/null | grep -a -E '^ID=' | sed 's/^[Ii][Dd]=//g' | sed 's/"//g')
if [ -z "$OSRELEASEID" ]
then
	OSRELEASEID=$(cat /usr/lib/os-release 2>/dev/null | grep -a -E '^ID=' | sed 's/^[Ii][Dd]=//g' | sed 's/"//g')
	if [ -z "$OSRELEASEID" ]
	then
		OSRELEASEID=$(uname -s)
	fi
fi

#
# Get host platform/architecture
#
UNAME=$(uname -s)
case $UNAME in
	Linux) PLATFORM=linux;;
	Darwin) PLATFORM=macOS;;
	*)
		echo "Unsupported platform: $UNAME"
		fail_with_exitcode 203
		;;
esac

BITNESS=$(getconf LONG_BIT)
ARCH=$(uname -m)
case $ARCH in
	x86_64) VSCODE_ARCH="x64";;
	armv7l | armv8l)
		VSCODE_ARCH="armhf"
		;;
	arm64 | aarch64)
		if [ "$BITNESS" = 32 ]; then
			# Can have 32-bit userland on 64-bit kernel
			VSCODE_ARCH="armhf"
		else
			VSCODE_ARCH="arm64"
		fi
		;;
	*)
		OSRELEASE=$(uname -r)
		case $OSRELEASE in
			*x86_64*) VSCODE_ARCH="x64";;
			*)
				echo "Unsupported architecture: $ARCH"
				fail_with_exitcode 196
			;;
		esac
		;;
esac

if [ "$PLATFORM" = linux ]; then
	if [ "$VSCODE_ARCH" = armhf ]; then
		PLATFORM_DOWNLOAD_PATH=cli-linux-armhf
	else
		PLATFORM_DOWNLOAD_PATH=cli-alpine-$VSCODE_ARCH
	fi
elif [ "$VSCODE_ARCH" = "arm64" ]; then
	PLATFORM_DOWNLOAD_PATH=cli-darwin-arm64
else
	PLATFORM_DOWNLOAD_PATH=cli-darwin-x64
fi

if [ ! -d "$VSCODE_AGENT_FOLDER" ]; then
	mkdir -p "$VSCODE_AGENT_FOLDER"
	chmod 750 "$VSCODE_AGENT_FOLDER"

	error_code=$?
	if [ "${error_code}" -gt 0 ]; then
		echo "Creating the server install dir failed..."
		fail_with_exitcode 202
	fi
fi

#
# Delete old CLIs if needed
#

# shellcheck disable=SC2010
TO_DELETE=$(ls -1 -t "$VSCODE_AGENT_FOLDER" | grep -E "code(-insiders)?-[a-fA-F0-9]{40}" | tail -n +6)
for CLI_TO_DELETE in $TO_DELETE; do
	target_dir="$VSCODE_AGENT_FOLDER/$CLI_TO_DELETE"
	echo "Deleting old install $target_dir"
	rm -rf "$target_dir"
done

do_client_download() {
	DID_LOCAL_DOWNLOAD=1
	echo "Trigger local server download"
	echo "${GET_DOWNLOAD_SERVER_START_TRIGGER}"
	echo artifact==$PLATFORM_DOWNLOAD_PATH==
	echo destFolder==$VSCODE_AGENT_FOLDER==
	echo destFolder2==/vscode-cli-$COMMIT_ID.tar.gz==
	echo "${GET_DOWNLOAD_SERVER_END_TRIGGER}"
	echo "Waiting for client to transfer server archive..."
	echo "Waiting for $VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done and vscode-server.tar.gz to exist"

	while true; do
		if [ -f "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done" ]; then
			if [ ! -f "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz" ]; then
				echo "Found flag but not server tar - server transfer failed"
				fail_with_exitcode 199
			fi

			echo "Found flag and server on host"
			rm "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done"
			break
		else
			printf ' '
			sleep 3
		fi
	done
}

do_client_download_or_fail() {
	error_code="${1:-"1"}"
	if [ "$DID_LOCAL_DOWNLOAD" = "1" ]; then
		echo "Already attempted local download, failing"
		fail_with_exitcode "$error_code"
	elif [ $ALLOW_CLIENT_DOWNLOAD = "1" ]; then
		do_client_download
	else
		fail_with_exitcode "$error_code"
	fi
}

is_program_from_busybox() {
	program=$1
	if command -v busybox > /dev/null 2>&1
	then
		# Check symlink from program to busybox
		if [ -L "$(command -v "$program")" ] && [ "$(readlink -f "$(command -v "$program")")" = "$(command -v busybox)" ]
		then
			echo "Program '$program' is provided by busybox" >&2
			echo 'yes'
			return
		fi
	fi
	echo 'no'
}

supports_flag() {
    program="$1"
    flag="$2"

    if command -v "$program" > /dev/null 2>&1; then
        if "$program" --help 2>&1 | grep -q -- "$flag"
		then
			echo "Program '$program' appears to support flag '$flag'" >&2
			echo 'yes'
			return
		fi
    fi
		echo "Program '$program' is not available or does not appear to support flag '$flag'" >&2
        echo 'no'
}

do_host_download() {
	start=$(millis)
	echo "${GET_PROGRESS_DOWNLOADING}"

	DOWNLOAD_URL=https://update.code.visualstudio.com/commit:$COMMIT_ID/$PLATFORM_DOWNLOAD_PATH/${QUALITY}

	if command -v wget > /dev/null 2>&1
	then
		echo "Downloading with wget"
		IS_WGET_BUSYBOX=$(is_program_from_busybox wget)

		echo "wget is from busybox: $IS_WGET_BUSYBOX"

		if [ "$IS_WGET_BUSYBOX" = 'no' ]
		then
			# Not busybox.
			# Assuming its GNU wget or similar

			if [ -n "$IGNORE_WGET_CONFIG_FLAG" ] && [ "$(supports_flag 'wget' '--no-config')" = "no" ]; then
				echo "Detected that this version of wget does not support '--no-config'. Will not ignore wget default configuration files."
				IGNORE_WGET_CONFIG_FLAG=""
			fi

			WGET_ERRORS=$(2>&1 wget ${IGNORE_WGET_CONFIG_FLAG} ${WGET_TRIES_SEGMENT} --connect-timeout=7 --dns-timeout=7 -nv -O vscode-cli-$COMMIT_ID.tar.gz ${DOWNLOAD_URL})
		else
			# Is busybox.
			# Remove flags for the sake of compatibility

			WGET_ERRORS=$(2>&1 wget -O vscode-cli-$COMMIT_ID.tar.gz ${DOWNLOAD_URL})
		fi

		error_code=$?
		if [ $error_code -ne 0 ]
		then
			echo "wget download failed"
			echo "$WGET_ERRORS"
			printenv_indent

			do_client_download_or_fail 193
		else
			echo "Download complete"
			DOWNLOAD_TIME=$(elapsed $start)
		fi
	else
		command -v curl > /dev/null 2>&1
		error_code=$?
		if [ $error_code -eq 0 ]
		then
			echo "Downloading with curl"
			CURL_STATUS_CODE_RESULT=$(curl ${IGNORE_CURL_CONFIG_FLAG} --connect-timeout 7 -L $DOWNLOAD_URL --output vscode-cli-$COMMIT_ID.tar.gz -w "%{http_code}")
			error_code=$?
			curl_status_code_if_2xx=$(echo "$CURL_STATUS_CODE_RESULT" | grep -E "^2[0-9]{2}$")
			if [ $error_code -ne 0 ] || [ -z "$curl_status_code_if_2xx" ]
			then
				echo "curl download failed"
				echo "HTTP status code: $CURL_STATUS_CODE_RESULT"
				printenv_indent

				do_client_download_or_fail 193
			else
				echo "Download complete"
				DOWNLOAD_TIME=$(elapsed $start)
			fi
		else
			printenv_indent
			echo "Neither wget nor curl is installed"

			do_client_download_or_fail 194
		fi
	fi
}

do_install() {
	start=$(millis)
	echo "${GET_PROGRESS_INSTALLING}"
	UNPACK_RESULT="success"
	echo "tar --version: $(tar --version)"
	tar -xf vscode-cli-$COMMIT_ID.tar.gz --no-same-owner
	TAR_EXIT=$?
	INSTALL_TIME=$(elapsed $start)

	if [ $TAR_EXIT -ne 0 ]
	then
		echo "ERROR: tar exited with a non-zero exit code: $TAR_EXIT"
		UNPACK_RESULT="error"
		do_client_download_or_fail "205"
		do_install
		return
	fi

	mv "$CLI_NAME_IN_ARCHIVE" "$CLI_PATH"

	# cheap sanity check

	if ! eval "$CLI_PATH --version"
	then
		UNPACK_RESULT="missingFiles"
		echo "ERROR: $CLI_PATH don't exist"
		do_client_download_or_fail "205"
		do_install
		return
	fi

	# Delete the leftover folder which might have -web prefix, and the .tar.gz
	rm -rf vscode-cli*
}

#
# Install if needed
#
if [ ! -f "$CLI_PATH" ]
then
	echo "Installing to $VSCODE_AGENT_FOLDER..."
	STASHED_WORKING_DIR="$(pwd)"
	cd "$VSCODE_AGENT_FOLDER" || fail_with_exitcode 206

	if [ $FORCE_CLIENT_DOWNLOAD = "1" ]; then
		do_client_download
	else
		do_host_download
	fi

	do_install
	cd "$STASHED_WORKING_DIR" || fail_with_exitcode 206
else
	echo "Found existing installation at $VSCODE_AGENT_FOLDER..."
fi


#
# Start the server
#
start_server() {
	echo "Starting VS Code CLI..."
	printenv_indent
	start=$(millis)
	if [ -f $CLI_LOG_FILE ]; then
		echo "Removing old logfile at $CLI_LOG_FILE"
		rm "$CLI_LOG_FILE" # See #6265
	fi

	# Stop exporting VSCODE_AGENT_FOLDER once https://github.com/microsoft/vscode/pull/228287 is available and replace with:
	# --extensions-dir "$VSCODE_AGENT_FOLDER/extensions" --user-data-dir "$VSCODE_AGENT_FOLDER/data"
	# See https://github.com/microsoft/vscode-internalbacklog/issues/2604, https://github.com/microsoft/vscode-remote-release/issues/10255
	export VSCODE_AGENT_FOLDER

	touch $CLI_LOG_FILE
	chmod 600 $CLI_LOG_FILE

	VSCODE_CLI_REQUIRE_TOKEN=${TOKEN} "$CLI_PATH" command-shell --cli-data-dir "$VSCODE_AGENT_FOLDER/cli" --parent-process-id $$ ${LISTEN_ARGS} > "$CLI_LOG_FILE" 2>&1 < /dev/null &
	CLI_PID=$!
	echo "Spawned remote CLI: $!"

	count=0
	max_retries=15
	while [ $count -lt $max_retries ]; do
		count=$((count + 1))
		LISTENING_ON=$(cat "$CLI_LOG_FILE" | grep -a -E 'Listening on .+' | grep -v grep | sed 's/Listening on //')
		if [ "$LISTENING_ON" != '' ]
		then
			break
		fi

		# "If sig is 0 (the null signal), error checking is performed but no signal is actually sent.
		# The null signal can be used to check the validity of pid.""
		# Source: https://pubs.opengroup.org/onlinepubs/007908799/xsh/kill.html
		if ! kill -0 $CLI_PID > /dev/null; then
			echo "Exec server process not found"
			cat $CLI_LOG_FILE
			break
		fi

		echo "Waiting for server log..."
		sleep .03
	done
	SERVER_START_TIME=$(elapsed $start)
}

start_server

# What we echo below cannot be wider than 80 characters
echo "${UUID}: start"
echo_common_results
echo "${UUID}: end"

while true; do sleep 180; printf ' '; done

EOSSH'
[11:18:35.699] Using connect timeout of 17 seconds
[11:18:36.130] > UNAUTHORIZED ACCESS TO THIS DEVICE IS PROHIBITED
> You must have explicit, authorized permission to access or configure this device.
> Unauthorized attempts and actions to access or use this system may result in civil and/or criminal penalties.
> All activities performed on this device are logged and monitored.
[11:18:36.130] Got some output, clearing connection timeout
[11:18:36.243] > X11 forwarding request failed on channel 2
> 11c12721f2cf: running
> Script executing under PID: 158956
[11:18:36.257] > Found existing installation at /home/hri/.vscode-server...
> Starting VS Code CLI...
> printenv:
>     USER=hri
>     SSH_CLIENT=10.160.76.187 60474 22
>     XDG_SESSION_TYPE=tty
>     SHLVL=0
>     HOME=/home/hri
>     DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
>     LOGNAME=hri
>     _=/usr/bin/sh
>     XDG_SESSION_CLASS=user
>     XDG_SESSION_ID=176
>     PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
>     XDG_RUNTIME_DIR=/run/user/1000
>     LANG=C.UTF-8
>     SHELL=/bin/bash
>     PWD=/home/hri
>     SSH_CONNECTION=10.160.76.187 60474 10.160.33.244 22
> Removing old logfile at /home/hri/.vscode-server/.cli.fabdb6a30b49f79a7aba0f2ad9df9b399473380f.log
[11:18:36.263] > Spawned remote CLI: 158976
> Waiting for server log...
[11:18:36.300] > Waiting for server log...
[11:18:36.334] > 11c12721f2cf: start
> listeningOn==127.0.0.1:37029==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/1000==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==73==
> execServerToken==a111aa1a-1111-1111-a111-1a11a111a1aa==
> platformDownloadPath==cli-alpine-x64==
> SSH_AUTH_SOCK====
> DISPLAY====
> 11c12721f2cf: end
[11:18:36.334] Received install output: 
listeningOn==127.0.0.1:37029==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==73==
execServerToken==a111aa1a-1111-1111-a111-1a11a111a1aa==
platformDownloadPath==cli-alpine-x64==
SSH_AUTH_SOCK====
DISPLAY====

[11:18:36.334] Remote server is listening on port 37029
[11:18:36.334] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":37029},"osReleaseId":"ubuntu","arch":"x86_64","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","execServerToken":"a111aa1a-1111-1111-a111-1a11a111a1aa"},"serverStartTime":73,"installUnpackCode":""}
[11:18:36.337] Starting forwarding server. local port 33175 -> socksPort 39703 -> remotePort 37029
[11:18:36.337] Forwarding server listening on port 33175
[11:18:36.337] Waiting for ssh tunnel to be ready
[11:18:36.338] [Forwarding server port 33175] Got connection 0
[11:18:36.338] Tunneled port 37029 to local port 33175
[11:18:36.339] Resolved "ssh-remote+d02" to "port 33175"
[11:18:36.344] Initizing new exec server for ssh-remote+d02
[11:18:36.344] Resolving exec server at port 33175
[11:18:36.345] [Forwarding server port 33175] Got connection 1
[11:18:36.420] Exec server for ssh-remote+d02 created and cached
[11:18:36.425] ------




[11:18:36.425] No hints found in the recent session.
[11:18:36.439] [server] Checking /home/hri/.vscode-server/cli/servers/Stable-fabdb6a30b49f79a7aba0f2ad9df9b399473380f/log.txt and /home/hri/.vscode-server/cli/servers/Stable-fabdb6a30b49f79a7aba0f2ad9df9b399473380f/pid.txt for a running server...
[11:18:36.460] [server] Found running server (pid=147146)
[11:18:37.157] Opening exec server for ssh-remote+d02
[11:18:37.184] Verified and reusing cached exec server for ssh-remote+d02
[11:18:37.184] No hints found in the recent session.
[11:18:37.192] Opening exec server for ssh-remote+d02
[11:18:37.206] Verified and reusing cached exec server for ssh-remote+d02
[11:18:37.206] No hints found in the recent session.
[11:23:04.114] Exec server for ssh-remote+d02 closed (gracefully)
[11:23:04.139] ------




[11:23:04.139] SSH Resolver called for "ssh-remote+d02", attempt 2, (Reconnection)
[11:23:04.140] SSH Resolver called for host: d02
[11:23:04.140] Setting up SSH remote "d02"
[11:23:04.144] Using commit id "fabdb6a30b49f79a7aba0f2ad9df9b399473380f" and quality "stable" for server
[11:23:04.147] Script variables:
 {
  "ExitCode.0": "OK",
  "ExitCode.64": "LinuxPrereqs",
  "ExitCode.65": "ProxyAuthenticationRequired",
  "ExitCode.128": "UnparsableOutput",
  "ExitCode.129": "EmptyOutput",
  "ExitCode.131": "UnhandledResolverExitCode",
  "ExitCode.132": "OfflineError",
  "ExitCode.133": "SshInstall",
  "ExitCode.134": "FindLocalPort",
  "ExitCode.135": "Timeout",
  "ExitCode.136": "ExhaustedRetries",
  "ExitCode.137": "PermissionDenied",
  "ExitCode.138": "MitmPortForwardingDisabled",
  "ExitCode.139": "Canceled",
  "ExitCode.140": "BadLocalDownloadRequest",
  "ExitCode.141": "LocalDownloadFailed",
  "ExitCode.142": "LocalLockTimeout",
  "ExitCode.143": "NoBash",
  "ExitCode.144": "InvalidHostName",
  "ExitCode.145": "BadInstallScriptResult",
  "ExitCode.146": "ShellRequestFailedOnChannel",
  "ExitCode.147": "InvalidPortRange",
  "ExitCode.148": "SendDisconnectBrokenPipe",
  "ExitCode.149": "LocalServerCrashed",
  "ExitCode.150": "NoFreePortInRange",
  "ExitCode.151": "InvalidCustomServerPath",
  "ExitCode.192": "AlreadyInProgress",
  "ExitCode.193": "ServerDownloadFailed",
  "ExitCode.194": "NoDownloaderAvailable",
  "ExitCode.195": "NoDownloaderAvailableForStatusCheck",
  "ExitCode.196": "UnsupportedArch",
  "ExitCode.197": "StatusCheckFailed",
  "ExitCode.198": "NeedInsidersArch",
  "ExitCode.199": "ServerTransferFailed",
  "ExitCode.200": "ServerFailedToStart",
  "ExitCode.201": "NeedInsidersWindows",
  "ExitCode.202": "CreateInstallDirFailed",
  "ExitCode.203": "UnsupportedPlatform",
  "ExitCode.204": "ServerTerminatedCVE20201416",
  "ExitCode.205": "UnpackFailed",
  "ExitCode.206": "ChangeDirFailed",
  "ExitCode.1023": "UnclassifiedError",
  "ExitCode.OK": "0",
  "ExitCode.LinuxPrereqs": "64",
  "ExitCode.ProxyAuthenticationRequired": "65",
  "ExitCode.UnparsableOutput": "128",
  "ExitCode.EmptyOutput": "129",
  "ExitCode.UnhandledResolverExitCode": "131",
  "ExitCode.OfflineError": "132",
  "ExitCode.SshInstall": "133",
  "ExitCode.FindLocalPort": "134",
  "ExitCode.Timeout": "135",
  "ExitCode.ExhaustedRetries": "136",
  "ExitCode.PermissionDenied": "137",
  "ExitCode.MitmPortForwardingDisabled": "138",
  "ExitCode.Canceled": "139",
  "ExitCode.BadLocalDownloadRequest": "140",
  "ExitCode.LocalDownloadFailed": "141",
  "ExitCode.LocalLockTimeout": "142",
  "ExitCode.NoBash": "143",
  "ExitCode.InvalidHostName": "144",
  "ExitCode.BadInstallScriptResult": "145",
  "ExitCode.ShellRequestFailedOnChannel": "146",
  "ExitCode.InvalidPortRange": "147",
  "ExitCode.SendDisconnectBrokenPipe": "148",
  "ExitCode.LocalServerCrashed": "149",
  "ExitCode.NoFreePortInRange": "150",
  "ExitCode.InvalidCustomServerPath": "151",
  "ExitCode.AlreadyInProgress": "192",
  "ExitCode.ServerDownloadFailed": "193",
  "ExitCode.NoDownloaderAvailable": "194",
  "ExitCode.NoDownloaderAvailableForStatusCheck": "195",
  "ExitCode.UnsupportedArch": "196",
  "ExitCode.StatusCheckFailed": "197",
  "ExitCode.NeedInsidersArch": "198",
  "ExitCode.ServerTransferFailed": "199",
  "ExitCode.ServerFailedToStart": "200",
  "ExitCode.NeedInsidersWindows": "201",
  "ExitCode.CreateInstallDirFailed": "202",
  "ExitCode.UnsupportedPlatform": "203",
  "ExitCode.ServerTerminatedCVE20201416": "204",
  "ExitCode.UnpackFailed": "205",
  "ExitCode.ChangeDirFailed": "206",
  "ExitCode.UnclassifiedError": "1023",
  "InstallUnpackCode.Success": "success",
  "InstallUnpackCode.Error": "error",
  "InstallUnpackCode.MissingFiles": "missingFiles",
  "uuid": "6067f3bbc541",
  "startMarker": "6067f3bbc541: running",
  "commitId": "fabdb6a30b49f79a7aba0f2ad9df9b399473380f",
  "quality": "stable",
  "token": "a1111111-a111-11a1-a1aa-a1aa111a1111",
  "vscodeAgentFolder": "$HOME/.vscode-server",
  "allowClientDownload": "1",
  "forceClientDownload": "0",
  "cliNameInArchive": "code",
  "ignoreWgetConfigFlag": " --no-config ",
  "ignoreCurlConfigFlag": " --disable ",
  "wgetTriesSegment": "--tries=1",
  "listenArgs": "--on-host=127.0.0.1 --on-port",
  "getDownloadServerStartTrigger": "6067f3bbc541:trigger_server_download",
  "getDownloadServerEndTrigger": "6067f3bbc541:trigger_server_download_end",
  "getProgressDownloading": "6067f3bbc541%%1%%",
  "getProgressInstalling": "6067f3bbc541%%2%%",
  "printVars": "echo \"SSH_AUTH_SOCK==$SSH_AUTH_SOCK==\"\necho \"DISPLAY==$DISPLAY==\""
}
[11:23:04.149] Install and start server if needed
[11:23:04.150] > Connection to d02 closed by remote host.
[11:23:04.151] Running script with connection command: ssh -T -D 42379 -o ConnectTimeout=15 d02 sh
[11:23:04.151] Generated SSH command: 'ssh -T -D 42379 -o ConnectTimeout=15 d02 sh << 'EOSSH'
# shellcheck shell=sh

echo "6067f3bbc541: running"
echo "Script executing under PID: $$"

VSC_TMP="${XDG_RUNTIME_DIR:-/tmp}"

# Configuration
UUID="6067f3bbc541"
COMMIT_ID="fabdb6a30b49f79a7aba0f2ad9df9b399473380f"
QUALITY="stable"
TOKEN="b5440466-e809-45b7-a8be-d1fe139e3818"
VSCODE_AGENT_FOLDER="$HOME/.vscode-server"
ALLOW_CLIENT_DOWNLOAD="1"
FORCE_CLIENT_DOWNLOAD="0"
CLI_NAME_IN_ARCHIVE="code"
IGNORE_WGET_CONFIG_FLAG=" --no-config "
IGNORE_CURL_CONFIG_FLAG=" --disable "
WGET_TRIES_SEGMENT="--tries=1"
LISTEN_ARGS="--on-host=127.0.0.1 --on-port"

CLI_NAME_ON_DISK="${CLI_NAME_IN_ARCHIVE}-${COMMIT_ID}"
CLI_PATH="${VSCODE_AGENT_FOLDER}/${CLI_NAME_ON_DISK}"
CLI_LOG_FILE="${VSCODE_AGENT_FOLDER}/.cli.${COMMIT_ID}.log"

# Marker strings
GET_DOWNLOAD_SERVER_START_TRIGGER="6067f3bbc541:trigger_server_download"
GET_DOWNLOAD_SERVER_END_TRIGGER="6067f3bbc541:trigger_server_download_end"
GET_PROGRESS_DOWNLOADING="6067f3bbc541%%1%%"
GET_PROGRESS_INSTALLING="6067f3bbc541%%2%%"

UNPACK_RESULT=
DID_LOCAL_DOWNLOAD=0
DOWNLOAD_TIME=
INSTALL_TIME=
SERVER_START_TIME=

fail_with_exitcode() {
	echo "${UUID}: start"
	echo "exitCode==$1=="
	echo_common_results
	echo "${UUID}: end"
	exit 0
}

echo_common_results() {
	echo "listeningOn==$LISTENING_ON=="
	echo "osReleaseId==$OSRELEASEID=="
	echo "arch==$ARCH=="
	echo "vscodeArch==$VSCODE_ARCH=="
	echo "bitness==$BITNESS=="
	echo "tmpDir==$VSC_TMP=="
	echo "platform==$PLATFORM=="
	echo "unpackResult==$UNPACK_RESULT=="
	echo "didLocalDownload==$DID_LOCAL_DOWNLOAD=="
	echo "downloadTime==$DOWNLOAD_TIME=="
	echo "installTime==$INSTALL_TIME=="
	echo "serverStartTime==$SERVER_START_TIME=="
	echo "execServerToken==${TOKEN}=="
	echo "platformDownloadPath==$PLATFORM_DOWNLOAD_PATH=="
	echo "SSH_AUTH_SOCK==$SSH_AUTH_SOCK=="
echo "DISPLAY==$DISPLAY=="
}

millis() {
	d=$(date +%s%N)
	# Test if 'd' contains any non-digit characters
	if [ -z "${d##*[!0-9]*}" ] || [ "$PLATFORM" != "linux" ]; then
	    # Fallback for MacOS or any date binary that doesn't handle '%N'
		echo $(($(date +%s)*1000))
		return
	fi
	echo $((d/1000000))
}

elapsed() {
	echo $(($(millis) - $1))
}

printenv_indent() {
	echo "printenv:"
	printenv | sed 's/^/    /'
}

#
# Get OS name
#
OSRELEASEID=$(cat /etc/os-release 2>/dev/null | grep -a -E '^ID=' | sed 's/^[Ii][Dd]=//g' | sed 's/"//g')
if [ -z "$OSRELEASEID" ]
then
	OSRELEASEID=$(cat /usr/lib/os-release 2>/dev/null | grep -a -E '^ID=' | sed 's/^[Ii][Dd]=//g' | sed 's/"//g')
	if [ -z "$OSRELEASEID" ]
	then
		OSRELEASEID=$(uname -s)
	fi
fi

#
# Get host platform/architecture
#
UNAME=$(uname -s)
case $UNAME in
	Linux) PLATFORM=linux;;
	Darwin) PLATFORM=macOS;;
	*)
		echo "Unsupported platform: $UNAME"
		fail_with_exitcode 203
		;;
esac

BITNESS=$(getconf LONG_BIT)
ARCH=$(uname -m)
case $ARCH in
	x86_64) VSCODE_ARCH="x64";;
	armv7l | armv8l)
		VSCODE_ARCH="armhf"
		;;
	arm64 | aarch64)
		if [ "$BITNESS" = 32 ]; then
			# Can have 32-bit userland on 64-bit kernel
			VSCODE_ARCH="armhf"
		else
			VSCODE_ARCH="arm64"
		fi
		;;
	*)
		OSRELEASE=$(uname -r)
		case $OSRELEASE in
			*x86_64*) VSCODE_ARCH="x64";;
			*)
				echo "Unsupported architecture: $ARCH"
				fail_with_exitcode 196
			;;
		esac
		;;
esac

if [ "$PLATFORM" = linux ]; then
	if [ "$VSCODE_ARCH" = armhf ]; then
		PLATFORM_DOWNLOAD_PATH=cli-linux-armhf
	else
		PLATFORM_DOWNLOAD_PATH=cli-alpine-$VSCODE_ARCH
	fi
elif [ "$VSCODE_ARCH" = "arm64" ]; then
	PLATFORM_DOWNLOAD_PATH=cli-darwin-arm64
else
	PLATFORM_DOWNLOAD_PATH=cli-darwin-x64
fi

if [ ! -d "$VSCODE_AGENT_FOLDER" ]; then
	mkdir -p "$VSCODE_AGENT_FOLDER"
	chmod 750 "$VSCODE_AGENT_FOLDER"

	error_code=$?
	if [ "${error_code}" -gt 0 ]; then
		echo "Creating the server install dir failed..."
		fail_with_exitcode 202
	fi
fi

#
# Delete old CLIs if needed
#

# shellcheck disable=SC2010
TO_DELETE=$(ls -1 -t "$VSCODE_AGENT_FOLDER" | grep -E "code(-insiders)?-[a-fA-F0-9]{40}" | tail -n +6)
for CLI_TO_DELETE in $TO_DELETE; do
	target_dir="$VSCODE_AGENT_FOLDER/$CLI_TO_DELETE"
	echo "Deleting old install $target_dir"
	rm -rf "$target_dir"
done

do_client_download() {
	DID_LOCAL_DOWNLOAD=1
	echo "Trigger local server download"
	echo "${GET_DOWNLOAD_SERVER_START_TRIGGER}"
	echo artifact==$PLATFORM_DOWNLOAD_PATH==
	echo destFolder==$VSCODE_AGENT_FOLDER==
	echo destFolder2==/vscode-cli-$COMMIT_ID.tar.gz==
	echo "${GET_DOWNLOAD_SERVER_END_TRIGGER}"
	echo "Waiting for client to transfer server archive..."
	echo "Waiting for $VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done and vscode-server.tar.gz to exist"

	while true; do
		if [ -f "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done" ]; then
			if [ ! -f "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz" ]; then
				echo "Found flag but not server tar - server transfer failed"
				fail_with_exitcode 199
			fi

			echo "Found flag and server on host"
			rm "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done"
			break
		else
			printf ' '
			sleep 3
		fi
	done
}

do_client_download_or_fail() {
	error_code="${1:-"1"}"
	if [ "$DID_LOCAL_DOWNLOAD" = "1" ]; then
		echo "Already attempted local download, failing"
		fail_with_exitcode "$error_code"
	elif [ $ALLOW_CLIENT_DOWNLOAD = "1" ]; then
		do_client_download
	else
		fail_with_exitcode "$error_code"
	fi
}

is_program_from_busybox() {
	program=$1
	if command -v busybox > /dev/null 2>&1
	then
		# Check symlink from program to busybox
		if [ -L "$(command -v "$program")" ] && [ "$(readlink -f "$(command -v "$program")")" = "$(command -v busybox)" ]
		then
			echo "Program '$program' is provided by busybox" >&2
			echo 'yes'
			return
		fi
	fi
	echo 'no'
}

supports_flag() {
    program="$1"
    flag="$2"

    if command -v "$program" > /dev/null 2>&1; then
        if "$program" --help 2>&1 | grep -q -- "$flag"
		then
			echo "Program '$program' appears to support flag '$flag'" >&2
			echo 'yes'
			return
		fi
    fi
		echo "Program '$program' is not available or does not appear to support flag '$flag'" >&2
        echo 'no'
}

do_host_download() {
	start=$(millis)
	echo "${GET_PROGRESS_DOWNLOADING}"

	DOWNLOAD_URL=https://update.code.visualstudio.com/commit:$COMMIT_ID/$PLATFORM_DOWNLOAD_PATH/${QUALITY}

	if command -v wget > /dev/null 2>&1
	then
		echo "Downloading with wget"
		IS_WGET_BUSYBOX=$(is_program_from_busybox wget)

		echo "wget is from busybox: $IS_WGET_BUSYBOX"

		if [ "$IS_WGET_BUSYBOX" = 'no' ]
		then
			# Not busybox.
			# Assuming its GNU wget or similar

			if [ -n "$IGNORE_WGET_CONFIG_FLAG" ] && [ "$(supports_flag 'wget' '--no-config')" = "no" ]; then
				echo "Detected that this version of wget does not support '--no-config'. Will not ignore wget default configuration files."
				IGNORE_WGET_CONFIG_FLAG=""
			fi

			WGET_ERRORS=$(2>&1 wget ${IGNORE_WGET_CONFIG_FLAG} ${WGET_TRIES_SEGMENT} --connect-timeout=7 --dns-timeout=7 -nv -O vscode-cli-$COMMIT_ID.tar.gz ${DOWNLOAD_URL})
		else
			# Is busybox.
			# Remove flags for the sake of compatibility

			WGET_ERRORS=$(2>&1 wget -O vscode-cli-$COMMIT_ID.tar.gz ${DOWNLOAD_URL})
		fi

		error_code=$?
		if [ $error_code -ne 0 ]
		then
			echo "wget download failed"
			echo "$WGET_ERRORS"
			printenv_indent

			do_client_download_or_fail 193
		else
			echo "Download complete"
			DOWNLOAD_TIME=$(elapsed $start)
		fi
	else
		command -v curl > /dev/null 2>&1
		error_code=$?
		if [ $error_code -eq 0 ]
		then
			echo "Downloading with curl"
			CURL_STATUS_CODE_RESULT=$(curl ${IGNORE_CURL_CONFIG_FLAG} --connect-timeout 7 -L $DOWNLOAD_URL --output vscode-cli-$COMMIT_ID.tar.gz -w "%{http_code}")
			error_code=$?
			curl_status_code_if_2xx=$(echo "$CURL_STATUS_CODE_RESULT" | grep -E "^2[0-9]{2}$")
			if [ $error_code -ne 0 ] || [ -z "$curl_status_code_if_2xx" ]
			then
				echo "curl download failed"
				echo "HTTP status code: $CURL_STATUS_CODE_RESULT"
				printenv_indent

				do_client_download_or_fail 193
			else
				echo "Download complete"
				DOWNLOAD_TIME=$(elapsed $start)
			fi
		else
			printenv_indent
			echo "Neither wget nor curl is installed"

			do_client_download_or_fail 194
		fi
	fi
}

do_install() {
	start=$(millis)
	echo "${GET_PROGRESS_INSTALLING}"
	UNPACK_RESULT="success"
	echo "tar --version: $(tar --version)"
	tar -xf vscode-cli-$COMMIT_ID.tar.gz --no-same-owner
	TAR_EXIT=$?
	INSTALL_TIME=$(elapsed $start)

	if [ $TAR_EXIT -ne 0 ]
	then
		echo "ERROR: tar exited with a non-zero exit code: $TAR_EXIT"
		UNPACK_RESULT="error"
		do_client_download_or_fail "205"
		do_install
		return
	fi

	mv "$CLI_NAME_IN_ARCHIVE" "$CLI_PATH"

	# cheap sanity check

	if ! eval "$CLI_PATH --version"
	then
		UNPACK_RESULT="missingFiles"
		echo "ERROR: $CLI_PATH don't exist"
		do_client_download_or_fail "205"
		do_install
		return
	fi

	# Delete the leftover folder which might have -web prefix, and the .tar.gz
	rm -rf vscode-cli*
}

#
# Install if needed
#
if [ ! -f "$CLI_PATH" ]
then
	echo "Installing to $VSCODE_AGENT_FOLDER..."
	STASHED_WORKING_DIR="$(pwd)"
	cd "$VSCODE_AGENT_FOLDER" || fail_with_exitcode 206

	if [ $FORCE_CLIENT_DOWNLOAD = "1" ]; then
		do_client_download
	else
		do_host_download
	fi

	do_install
	cd "$STASHED_WORKING_DIR" || fail_with_exitcode 206
else
	echo "Found existing installation at $VSCODE_AGENT_FOLDER..."
fi


#
# Start the server
#
start_server() {
	echo "Starting VS Code CLI..."
	printenv_indent
	start=$(millis)
	if [ -f $CLI_LOG_FILE ]; then
		echo "Removing old logfile at $CLI_LOG_FILE"
		rm "$CLI_LOG_FILE" # See #6265
	fi

	# Stop exporting VSCODE_AGENT_FOLDER once https://github.com/microsoft/vscode/pull/228287 is available and replace with:
	# --extensions-dir "$VSCODE_AGENT_FOLDER/extensions" --user-data-dir "$VSCODE_AGENT_FOLDER/data"
	# See https://github.com/microsoft/vscode-internalbacklog/issues/2604, https://github.com/microsoft/vscode-remote-release/issues/10255
	export VSCODE_AGENT_FOLDER

	touch $CLI_LOG_FILE
	chmod 600 $CLI_LOG_FILE

	VSCODE_CLI_REQUIRE_TOKEN=${TOKEN} "$CLI_PATH" command-shell --cli-data-dir "$VSCODE_AGENT_FOLDER/cli" --parent-process-id $$ ${LISTEN_ARGS} > "$CLI_LOG_FILE" 2>&1 < /dev/null &
	CLI_PID=$!
	echo "Spawned remote CLI: $!"

	count=0
	max_retries=15
	while [ $count -lt $max_retries ]; do
		count=$((count + 1))
		LISTENING_ON=$(cat "$CLI_LOG_FILE" | grep -a -E 'Listening on .+' | grep -v grep | sed 's/Listening on //')
		if [ "$LISTENING_ON" != '' ]
		then
			break
		fi

		# "If sig is 0 (the null signal), error checking is performed but no signal is actually sent.
		# The null signal can be used to check the validity of pid.""
		# Source: https://pubs.opengroup.org/onlinepubs/007908799/xsh/kill.html
		if ! kill -0 $CLI_PID > /dev/null; then
			echo "Exec server process not found"
			cat $CLI_LOG_FILE
			break
		fi

		echo "Waiting for server log..."
		sleep .03
	done
	SERVER_START_TIME=$(elapsed $start)
}

start_server

# What we echo below cannot be wider than 80 characters
echo "${UUID}: start"
echo_common_results
echo "${UUID}: end"

while true; do sleep 180; printf ' '; done

EOSSH'
[11:23:04.152] Using connect timeout of 17 seconds
[11:23:04.305] > ssh: connect to host d02 port 22: Connection refused
[11:23:04.306] Got some output, clearing connection timeout
[11:23:04.366] "install" terminal command done
[11:23:04.366] Install terminal quit with output:  Connection to d02 closed by remote host.
[11:23:04.547] "install" terminal command done
[11:23:04.547] Install terminal quit with output: ssh: connect to host d02 port 22: Connection refused
[11:23:04.547] Received install output: ssh: connect to host d02 port 22: Connection refused
[11:23:04.548] WARN: $PLATFORM is undefined in installation script output.  Errors may be dropped.
[11:23:04.548] Failed to parse remote port from server output
[11:23:04.549] Resolver error: Error: 
	at v.Create (/home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:696499)
	at t.handleInstallOutput (/home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:694580)
	at t.tryInstall (/home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:812473)
	at async /home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:771431
	at async t.withShowDetailsEvent (/home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:774668)
	at async x (/home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:768087)
	at async t.resolve (/home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:772083)
	at async /home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:1055245
[11:23:04.551] ------




[11:23:04.551] No hints found in the recent session.

Expected Behavior

Expected to be able to SSH into a remote machine, then use "Attach to Running Container..." to attach to an existing running docker container.

Actual Behavior

Successfully SSH'd to remote machine, but attaching to docker container fails with the following error:

[753 ms] Error: WrappedError(WrappedError { message: "file not found", original: "Permission denied (os error 13)" })
at Object.resolve (/home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:295026)
at /home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/extension.js:2:293725
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[753 ms] Exit code -1

Steps To Reproduce

  1. Start a container manually on the remote machine.
  2. Use VS Code to "Connect to Host..." and connect to the remote machine.
  3. After successfully connecting, select "Attach to Running Container..." and choose the container.
  4. Observe the failure and the associated log output.

Anything else?

VS Code Version:
1.96.2

Type of Remote Connection:
SSH

Local Operating System:
Ubuntu 20.04.6 LTS

Remote Operating System:
Ubuntu 22.04.4 LTS

Installed Extensions:

Remote - SSH (0.116.1)
Dev Containers (0.394.0)

@amoscao amoscao added the ssh Issue in vscode-remote SSH label Jan 15, 2025
@joshspicer
Copy link
Member

Thanks for the detailed issue. Are you able to open/save files directly in VS Code on the remote machine (outside of the container)? We're seeing ssh errors in the logs, which might explain why, when then using the dev containers extension, you're seeing 'file not found' (since you aren't actually connected).

Is the attempt to Attach to container causing any SSH connection errors once you try it? I'm trying to understand where the 'connection refused' is happening

> ssh: connect to host d02 port 22: Connection refused

@amoscao
Copy link
Author

amoscao commented Jan 15, 2025

Thank you for the quick response. I am able to SSH into the machine and everything works correctly as far as I can tell. We are able to reproduce this on ~6 other remote machines that are the same hardware and environment.

I'm not sure of the log, it may be something else unrelated/red herring. I reset everything and tried to connect again. Here is the Remote-SSH: Show Log output from the remote machine after the container attach fails:

[14:30:52.962] Log Level: 2
[14:30:52.980] VS Code version: 1.96.2
[14:30:52.980] Remote-SSH version: remote-ssh@0.116.1
[14:30:52.980] linux x64
[14:30:53.002] Opening exec server for ssh-remote+d02
[14:30:53.027] Initizing new exec server for ssh-remote+d02
[14:30:53.029] Acquiring local install lock: /tmp/vscode-remote-ssh-23c88511-install.lock
[14:30:53.030] Looking for existing server data file at /home/amos/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-23c88511-fabdb6a30b49f79a7aba0f2ad9df9b399473380f-0.116.1-es/data.json
[14:30:53.030] Found existing data file
[14:30:53.030] Found local server running: {"remoteListeningOn":{"port":41351},"osReleaseId":"ubuntu","arch":"x86_64","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","execServerToken":"eb5148e6-17cb-4bbe-8db9-404165c7ff79","pid":1172986,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-96c5c73dd86e0488f79d84d63795d3ed4e182d0f.sock","socksPort":40741,"startupTime":1736969444983}
[14:30:53.034] Found running server - short-circuiting install
[14:30:53.035] Starting forwarding server. local port 38079 -> socksPort 40741 -> remotePort 41351
[14:30:53.035] Forwarding server listening on port 38079
[14:30:53.035] Waiting for ssh tunnel to be ready
[14:30:53.036] [Forwarding server port 38079] Got connection 0
[14:30:53.037] Tunneled port 41351 to local port 38079
[14:30:53.037] Resolved "ssh-remote+d02" to "port 38079"
[14:30:53.037] Resolving exec server at port 38079
[14:30:53.037] [Forwarding server port 38079] Got connection 1
[14:30:53.077] Exec server for ssh-remote+d02 created and cached
[14:30:53.077] No hints found in the recent session.

Here is the Remote-SSH: Show Log from the window that was connected to the remote machine, where I attempted to connect to the container:

[14:30:44.916] Log Level: 2
[14:30:44.931] SSH Resolver called for "ssh-remote+d02", attempt 1
[14:30:44.933] remote.SSH.useLocalServer = true
[14:30:44.934] remote.SSH.useExecServer = true
[14:30:44.934] remote.SSH.path = 
[14:30:44.934] remote.SSH.configFile = 
[14:30:44.934] remote.SSH.useFlock = true
[14:30:44.934] remote.SSH.lockfilesInTmp = false
[14:30:44.934] remote.SSH.localServerDownload = auto
[14:30:44.934] remote.SSH.remoteServerListenOnSocket = false
[14:30:44.934] remote.SSH.defaultExtensions = []
[14:30:44.934] remote.SSH.loglevel = 2
[14:30:44.934] remote.SSH.enableDynamicForwarding = true
[14:30:44.934] remote.SSH.enableRemoteCommand = false
[14:30:44.934] remote.SSH.serverPickPortsFromRange = {}
[14:30:44.934] remote.SSH.serverInstallPath = {}
[14:30:44.934] remote.SSH.permitPtyAllocation = false
[14:30:44.934] remote.SSH.preferredLocalPortRange = undefined
[14:30:44.934] remote.SSH.useCurlAndWgetConfigurationFiles = false
[14:30:44.934] remote.SSH.experimental.chat = true
[14:30:44.934] remote.SSH.experimental.enhancedSessionLogs = true
[14:30:44.941] VS Code version: 1.96.2
[14:30:44.941] Remote-SSH version: remote-ssh@0.116.1
[14:30:44.941] linux x64
[14:30:44.944] SSH Resolver called for host: d02
[14:30:44.944] Setting up SSH remote "d02"
[14:30:44.947] Acquiring local install lock: /tmp/vscode-remote-ssh-23c88511-install.lock
[14:30:44.950] Looking for existing server data file at /home/amos/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-23c88511-fabdb6a30b49f79a7aba0f2ad9df9b399473380f-0.116.1-es/data.json
[14:30:44.960] No existing data file
[14:30:44.960] Using commit id "fabdb6a30b49f79a7aba0f2ad9df9b399473380f" and quality "stable" for server
[14:30:44.967] Script variables:
 {
  "ExitCode.0": "OK",
  "ExitCode.64": "LinuxPrereqs",
  "ExitCode.65": "ProxyAuthenticationRequired",
  "ExitCode.128": "UnparsableOutput",
  "ExitCode.129": "EmptyOutput",
  "ExitCode.131": "UnhandledResolverExitCode",
  "ExitCode.132": "OfflineError",
  "ExitCode.133": "SshInstall",
  "ExitCode.134": "FindLocalPort",
  "ExitCode.135": "Timeout",
  "ExitCode.136": "ExhaustedRetries",
  "ExitCode.137": "PermissionDenied",
  "ExitCode.138": "MitmPortForwardingDisabled",
  "ExitCode.139": "Canceled",
  "ExitCode.140": "BadLocalDownloadRequest",
  "ExitCode.141": "LocalDownloadFailed",
  "ExitCode.142": "LocalLockTimeout",
  "ExitCode.143": "NoBash",
  "ExitCode.144": "InvalidHostName",
  "ExitCode.145": "BadInstallScriptResult",
  "ExitCode.146": "ShellRequestFailedOnChannel",
  "ExitCode.147": "InvalidPortRange",
  "ExitCode.148": "SendDisconnectBrokenPipe",
  "ExitCode.149": "LocalServerCrashed",
  "ExitCode.150": "NoFreePortInRange",
  "ExitCode.151": "InvalidCustomServerPath",
  "ExitCode.192": "AlreadyInProgress",
  "ExitCode.193": "ServerDownloadFailed",
  "ExitCode.194": "NoDownloaderAvailable",
  "ExitCode.195": "NoDownloaderAvailableForStatusCheck",
  "ExitCode.196": "UnsupportedArch",
  "ExitCode.197": "StatusCheckFailed",
  "ExitCode.198": "NeedInsidersArch",
  "ExitCode.199": "ServerTransferFailed",
  "ExitCode.200": "ServerFailedToStart",
  "ExitCode.201": "NeedInsidersWindows",
  "ExitCode.202": "CreateInstallDirFailed",
  "ExitCode.203": "UnsupportedPlatform",
  "ExitCode.204": "ServerTerminatedCVE20201416",
  "ExitCode.205": "UnpackFailed",
  "ExitCode.206": "ChangeDirFailed",
  "ExitCode.1023": "UnclassifiedError",
  "ExitCode.OK": "0",
  "ExitCode.LinuxPrereqs": "64",
  "ExitCode.ProxyAuthenticationRequired": "65",
  "ExitCode.UnparsableOutput": "128",
  "ExitCode.EmptyOutput": "129",
  "ExitCode.UnhandledResolverExitCode": "131",
  "ExitCode.OfflineError": "132",
  "ExitCode.SshInstall": "133",
  "ExitCode.FindLocalPort": "134",
  "ExitCode.Timeout": "135",
  "ExitCode.ExhaustedRetries": "136",
  "ExitCode.PermissionDenied": "137",
  "ExitCode.MitmPortForwardingDisabled": "138",
  "ExitCode.Canceled": "139",
  "ExitCode.BadLocalDownloadRequest": "140",
  "ExitCode.LocalDownloadFailed": "141",
  "ExitCode.LocalLockTimeout": "142",
  "ExitCode.NoBash": "143",
  "ExitCode.InvalidHostName": "144",
  "ExitCode.BadInstallScriptResult": "145",
  "ExitCode.ShellRequestFailedOnChannel": "146",
  "ExitCode.InvalidPortRange": "147",
  "ExitCode.SendDisconnectBrokenPipe": "148",
  "ExitCode.LocalServerCrashed": "149",
  "ExitCode.NoFreePortInRange": "150",
  "ExitCode.InvalidCustomServerPath": "151",
  "ExitCode.AlreadyInProgress": "192",
  "ExitCode.ServerDownloadFailed": "193",
  "ExitCode.NoDownloaderAvailable": "194",
  "ExitCode.NoDownloaderAvailableForStatusCheck": "195",
  "ExitCode.UnsupportedArch": "196",
  "ExitCode.StatusCheckFailed": "197",
  "ExitCode.NeedInsidersArch": "198",
  "ExitCode.ServerTransferFailed": "199",
  "ExitCode.ServerFailedToStart": "200",
  "ExitCode.NeedInsidersWindows": "201",
  "ExitCode.CreateInstallDirFailed": "202",
  "ExitCode.UnsupportedPlatform": "203",
  "ExitCode.ServerTerminatedCVE20201416": "204",
  "ExitCode.UnpackFailed": "205",
  "ExitCode.ChangeDirFailed": "206",
  "ExitCode.UnclassifiedError": "1023",
  "InstallUnpackCode.Success": "success",
  "InstallUnpackCode.Error": "error",
  "InstallUnpackCode.MissingFiles": "missingFiles",
  "uuid": "dd190dc70c15",
  "startMarker": "dd190dc70c15: running",
  "commitId": "fabdb6a30b49f79a7aba0f2ad9df9b399473380f",
  "quality": "stable",
  "token": "aa1111a1-11aa-1aaa-1aa1-111111a1aa11",
  "vscodeAgentFolder": "$HOME/.vscode-server",
  "allowClientDownload": "1",
  "forceClientDownload": "0",
  "cliNameInArchive": "code",
  "ignoreWgetConfigFlag": " --no-config ",
  "ignoreCurlConfigFlag": " --disable ",
  "wgetTriesSegment": "--tries=1",
  "listenArgs": "--on-host=127.0.0.1 --on-port",
  "getDownloadServerStartTrigger": "dd190dc70c15:trigger_server_download",
  "getDownloadServerEndTrigger": "dd190dc70c15:trigger_server_download_end",
  "getProgressDownloading": "dd190dc70c15%%1%%",
  "getProgressInstalling": "dd190dc70c15%%2%%",
  "printVars": "echo \"SSH_AUTH_SOCK==$SSH_AUTH_SOCK==\"\necho \"DISPLAY==$DISPLAY==\""
}
[14:30:44.969] Install and start server if needed
[14:30:44.972] PATH: /snap/bin:/home/amos/.local/bin:/home/amos/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/amos/.fzf/bin
[14:30:44.972] Checking ssh with "ssh -V"
[14:30:44.978] > OpenSSH_8.2p1 Ubuntu-4ubuntu0.11, OpenSSL 1.1.1f  31 Mar 2020

[14:30:44.980] askpass server listening on /run/user/1000/vscode-ssh-askpass-d9e4a3724c33de05d90b4e62ec98a382a0a26030.sock
[14:30:44.980] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-96c5c73dd86e0488f79d84d63795d3ed4e182d0f.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","40741","-o","ConnectTimeout=15","d02","bash"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/amos/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-23c88511-fabdb6a30b49f79a7aba0f2ad9df9b399473380f-0.116.1-es/data.json"}
[14:30:44.980] Local server env: {"SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SHELL":"/usr/bin/zsh","DISPLAY":":1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/179/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"","VSCODE_SSH_ASKPASS_MAIN":"/home/amos/.vscode/extensions/ms-vscode-remote.remote-ssh-0.116.1/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-d9e4a3724c33de05d90b4e62ec98a382a0a26030.sock"}
[14:30:44.983] Spawned 1172986
[14:30:44.983] Using connect timeout of 17 seconds
[14:30:45.046] > local-server-1> Running ssh connection command: ssh -v -T -D 40741 -o ConnectTimeout=15 d02 bash
[14:30:45.049] > local-server-1> Spawned ssh, pid=1172994
[14:30:45.050] stderr> OpenSSH_8.2p1 Ubuntu-4ubuntu0.11, OpenSSL 1.1.1f  31 Mar 2020
[14:30:45.062] stderr> debug1: Server host key: ecdsa-sha2-nistp256 SHA256:uJPxx8ZTXLRMWR6RujZd1zboQ4WciLvGNPO6ve5Sq2E
[14:30:45.115] stderr> UNAUTHORIZED ACCESS TO THIS DEVICE IS PROHIBITED
[14:30:45.116] stderr> You must have explicit, authorized permission to access or configure this device.
[14:30:45.116] stderr> Unauthorized attempts and actions to access or use this system may result in civil and/or criminal penalties.
[14:30:45.116] stderr> All activities performed on this device are logged and monitored.
[14:30:45.135] stderr> Authenticated to d02 ([10.160.33.206]:22).
[14:30:45.191] stderr> X11 forwarding request failed on channel 2
[14:30:45.194] > ready: dd190dc70c15
[14:30:45.195] > Linux 5.15.0-94-generic #104-Ubuntu SMP Tue Jan 9 15:25:40 UTC 2024
[14:30:45.196] Platform: linux
[14:30:45.196] > /bin/bash
[14:30:45.196] Parent Shell: bash
[14:30:45.196] Parent Shell pid: 1172986
[14:30:45.197] > 12740
[14:30:45.198] Waiting for pid of spawned 'sh' subshell: '12740'...
[14:30:45.199] > dd190dc70c15: running
> Script executing under PID: 12740
[14:30:45.204] > Found existing installation at /home/hri/.vscode-server...
> Starting VS Code CLI...
> printenv:
[14:30:45.205] >     USER=hri
>     SSH_CLIENT=10.160.33.244 57664 22
>     XDG_SESSION_TYPE=tty
>     SHLVL=1
>     HOME=/home/hri
>     DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
>     LOGNAME=hri
>     _=/usr/bin/sh
>     XDG_SESSION_CLASS=user
>     XDG_SESSION_ID=9
>     PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
>     XDG_RUNTIME_DIR=/run/user/1000
>     LANG=C.UTF-8
>     SHELL=/bin/bash
>     PWD=/home/hri
>     SSH_CONNECTION=10.160.33.244 57664 10.160.33.206 22
[14:30:45.205] > Removing old logfile at /home/hri/.vscode-server/.cli.fabdb6a30b49f79a7aba0f2ad9df9b399473380f.log
[14:30:45.207] > Spawned remote CLI: 12760
[14:30:45.209] > Waiting for server log...
[14:30:45.242] > dd190dc70c15: start
> listeningOn==127.0.0.1:41351==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/1000==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==36==
> execServerToken==aa1111a1-11aa-1aaa-1aa1-111111a1aa11==
> platformDownloadPath==cli-alpine-x64==
> SSH_AUTH_SOCK====
> DISPLAY====
> dd190dc70c15: end
[14:30:45.243] Received install output: 
listeningOn==127.0.0.1:41351==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==36==
execServerToken==aa1111a1-11aa-1aaa-1aa1-111111a1aa11==
platformDownloadPath==cli-alpine-x64==
SSH_AUTH_SOCK====
DISPLAY====

[14:30:45.243] Remote server is listening on port 41351
[14:30:45.243] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":41351},"osReleaseId":"ubuntu","arch":"x86_64","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","execServerToken":"aa1111a1-11aa-1aaa-1aa1-111111a1aa11"},"serverStartTime":36,"installUnpackCode":""}
[14:30:45.244] Persisting server connection details to /home/amos/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-23c88511-fabdb6a30b49f79a7aba0f2ad9df9b399473380f-0.116.1-es/data.json
[14:30:45.247] Starting forwarding server. local port 41231 -> socksPort 40741 -> remotePort 41351
[14:30:45.247] Forwarding server listening on port 41231
[14:30:45.247] Waiting for ssh tunnel to be ready
[14:30:45.248] [Forwarding server port 41231] Got connection 0
[14:30:45.248] Tunneled port 41351 to local port 41231
[14:30:45.248] Resolved "ssh-remote+d02" to "port 41231"
[14:30:45.253] Initizing new exec server for ssh-remote+d02
[14:30:45.254] Resolving exec server at port 41231
[14:30:45.254] [Forwarding server port 41231] Got connection 1
[14:30:45.292] Exec server for ssh-remote+d02 created and cached
[14:30:45.297] ------




[14:30:45.297] No hints found in the recent session.
[14:30:45.307] [server] Checking /home/hri/.vscode-server/cli/servers/Stable-fabdb6a30b49f79a7aba0f2ad9df9b399473380f/log.txt and /home/hri/.vscode-server/cli/servers/Stable-fabdb6a30b49f79a7aba0f2ad9df9b399473380f/pid.txt for a running server...
[14:30:45.326] [server] Found running server (pid=1620)
[14:30:45.943] Opening exec server for ssh-remote+d02
[14:30:45.950] Verified and reusing cached exec server for ssh-remote+d02
[14:30:45.950] No hints found in the recent session.
[14:30:45.952] Opening exec server for ssh-remote+d02
[14:30:45.955] Verified and reusing cached exec server for ssh-remote+d02
[14:30:45.955] No hints found in the recent session.

I attempted this other experiment: I SSH'd from my development machine into itself (ssh amos@127.0.0.1), then attempted to attach to a container which is created in the same fashion as on the remote machine. This attachment succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

2 participants