Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

$SSH_AUTH_SOCK - No such file or directory #1456

Open
jleni opened this issue Dec 7, 2024 · 3 comments
Open

$SSH_AUTH_SOCK - No such file or directory #1456

jleni opened this issue Dec 7, 2024 · 3 comments
Labels

Comments

@jleni
Copy link

jleni commented Dec 7, 2024

What happened?

Local SSH credentials are not available in the remote host.

Also it seems the socket is not linked/mount correctly?

ls -la $SSH_AUTH_SOCK 
ls: cannot access '/tmp/auth-agent2010668863/listener.sock': No such file or directory

What did you expect to happen instead?

My devcontainer.json:

{
    "name": "Python Development",
    "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
    "customizations": {
        "vscode": {
            "extensions": [
                "ms-python.python",
                "ms-python.vscode-pylance",
                "anysphere.pyright",
                "redhat.vscode-yaml",
                "ms-python.black-formatter"
            ],
            "settings": {
                "[python]": {
                    "editor.formatOnSave": true
                }
            }
        }
    },
    "postCreateCommand": "sudo apt-get update && sudo apt-get install -y python3 python3-pip git gh"
}

Local Environment:

  • DevPod Version: 0.6.4
  • Operating System: mac
  • ARCH of the OS: ARM64

DevPod Provider:

  • Cloud Provider: selfhosted
  • Kubernetes Provider: Client Version: v1.31.3 / Kustomize Version: v5.4.2 / Server Version: v1.30.6+rke2r1

Anything else we need to know?

@jleni jleni added the kind/bug label Dec 7, 2024
@jleni
Copy link
Author

jleni commented Dec 7, 2024

I think this part of the log (when using cursor) is relevant

[10:14:41] debug Received ping from agent
[10:14:41] debug Start setting up container...
[10:14:41] debug Credentials server started on port 14951...
[10:14:42] debug Incoming client connection at /
[10:14:42] debug Credentials server started...
[10:14:42] debug Patch etc environment & profile...
[10:14:42] debug Run lifecycle hooks commands...
[10:14:42] debug running user env probe with shell "bash", probe "loginInteractiveShell", user "vscode" and command "cat /proc/self/environ"
[10:14:42] debug Done setting up environment
[10:14:42] debug Setup cursor...
[10:14:42] info Install extensions 'ms-python.python,ms-python.vscode-pylance,anysphere.pyright,redhat.vscode-yaml,ms-python.black-formatter' in the background
[10:14:42] debug Start DevPod Container Daemon with Inactivity Timeout 180m
[10:14:42] debug Unset setup system credential helper
[10:14:42] error unset system credential helper exit status 5
[10:14:42] debug Connection to SSH Server closed
[10:14:42] info Error piping stdin: write |1: file already closed
[10:14:42] debug Done setting up container
[10:14:42] debug Done executing ssh server helper command
[10:14:42] debug Connection to SSH Server closed
[10:14:42] debug Done executing ssh server helper command
[10:14:42] debug Done creating devcontainer
[10:14:42] info Run 'ssh poc-pulsar.devpod' to ssh into the devcontainer
[10:14:42] debug No dotfiles repo specified, skipping
[10:14:42] info Starting cursor...
[10:14:43] debug Run vscode command cursor --install-extension ms-vscode-remote.remote-ssh
[10:14:44] debug Error opening cursor via cli: install ssh extension: Installing extensions...

Extension 'ms-vscode-remote.remote-ssh' not found.

@jleni
Copy link
Author

jleni commented Dec 7, 2024

I tried to manually install that extension (ms-vscode-remote.remote-ssh) in cursor and I got this error

image

It seems that cursor by default uses some kind of fork that is already integrated.

@jleni
Copy link
Author

jleni commented Dec 7, 2024

This is the remote ssh log in cursor in case this is useful

[Info  - 09:32:12.632] Resolving ssh remote authority 'ssh-remote+project-name.devpod' (attemp #1)
[Trace  - 09:32:12.696] Identity keys:
[OOB] [SSH] Key1 ssh-ed25519 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
[SSH] user@domain.com ssh-ed25519 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
SSH Key - Key2 ssh-ed25519 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
SSH Key - Key3 ssh-rsa SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
[SSH] Key4 ssh-ed25519 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
/Users/username/.ssh/id_ed25519 ssh-ed25519 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
[Trace  - 09:32:12.696] Spawning ProxyCommand: /Applications/DevPod.app/Contents/MacOS/devpod-cli ssh --stdio --context default --user vscode project-name
[Info  - 09:32:14.751] Trying no-auth authentication
[Trace  - 09:32:14.790] Server install command:

# Server installation script

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

DISTRO_VERSION="1.93.1"
DISTRO_COMMIT="a846435528b4b760494a836f96f0739889253530"
DISTRO_QUALITY="stable"
DISTRO_VSCODIUM_RELEASE=""

SERVER_APP_NAME="cursor-server"
SERVER_INITIAL_EXTENSIONS=""
SERVER_LISTEN_FLAG="--port=0"
SERVER_DATA_DIR="$HOME/.cursor-server"
SERVER_DIR="$SERVER_DATA_DIR/bin/$DISTRO_COMMIT"
SERVER_SCRIPT="$SERVER_DIR/bin/$SERVER_APP_NAME"
SERVER_LOGFILE="$SERVER_DATA_DIR/.$DISTRO_COMMIT.log"
SERVER_PIDFILE="$SERVER_DATA_DIR/.$DISTRO_COMMIT.pid"
SERVER_TOKENFILE="$SERVER_DATA_DIR/.$DISTRO_COMMIT.token"
SERVER_ARCH=
SERVER_CONNECTION_TOKEN=
SERVER_DOWNLOAD_URL=

LISTENING_ON=
OS_RELEASE_ID=
ARCH=
PLATFORM=

# Mimic output from logs of remote-ssh extension
print_install_results_and_exit() {
    echo "9fcba8ba48d0303d58bf46d2: start"
    echo "exitCode==$1=="
    echo "listeningOn==$LISTENING_ON=="
    echo "connectionToken==$SERVER_CONNECTION_TOKEN=="
    echo "logFile==$SERVER_LOGFILE=="
    echo "osReleaseId==$OS_RELEASE_ID=="
    echo "arch==$ARCH=="
    echo "platform==$PLATFORM=="
    echo "tmpDir==$TMP_DIR=="
    echo "SSH_AUTH_SOCK==$SSH_AUTH_SOCK=="
    echo "9fcba8ba48d0303d58bf46d2: end"
    exit 0
}

# Check if platform is supported
KERNEL="$(uname -s)"
case $KERNEL in
    Darwin)
        PLATFORM="darwin"
        ;;
    Linux)
        PLATFORM="linux"
        ;;
    FreeBSD)
        PLATFORM="freebsd"
        ;;
    DragonFly)
        PLATFORM="dragonfly"
        ;;
    *)
        echo "Error platform not supported: $KERNEL"
        print_install_results_and_exit 1
        ;;
esac

# Check machine architecture
ARCH="$(uname -m)"
case $ARCH in
    x86_64 | amd64)
        SERVER_ARCH="x64"
        ;;
    armv7l | armv8l)
        SERVER_ARCH="armhf"
        ;;
    arm64 | aarch64)
        SERVER_ARCH="arm64"
        ;;
    ppc64le)
        SERVER_ARCH="ppc64le"
        ;;
    riscv64)
        SERVER_ARCH="riscv64"
        ;;
    loongarch64)
        SERVER_ARCH="loong64"
        ;;
    s390x)
        SERVER_ARCH="s390x"
        ;;
    *)
        echo "Error architecture not supported: $ARCH"
        print_install_results_and_exit 1
        ;;
esac

# https://www.freedesktop.org/software/systemd/man/os-release.html
OS_RELEASE_ID="$(grep -i '^ID=' /etc/os-release 2>/dev/null | sed 's/^ID=//gi' | sed 's/"//g')"
if [[ -z $OS_RELEASE_ID ]]; then
    OS_RELEASE_ID="$(grep -i '^ID=' /usr/lib/os-release 2>/dev/null | sed 's/^ID=//gi' | sed 's/"//g')"
    if [[ -z $OS_RELEASE_ID ]]; then
        OS_RELEASE_ID="unknown"
    fi
fi

# Create installation folder
if [[ ! -d $SERVER_DIR ]]; then
    mkdir -p $SERVER_DIR
    if (( $? > 0 )); then
        echo "Error creating server install directory"
        print_install_results_and_exit 1
    fi
fi

# adjust platform for vscodium download, if needed
if [[ $OS_RELEASE_ID = alpine ]]; then
    PLATFORM=$OS_RELEASE_ID
fi

SERVER_DOWNLOAD_URL="$(echo "https://cursor.blob.core.windows.net/remote-releases/\${commit}/vscode-reh-\${os}-\${arch}.tar.gz" | sed "s/\${quality}/$DISTRO_QUALITY/g" | sed "s/\${version}/$DISTRO_VERSION/g" | sed "s/\${commit}/$DISTRO_COMMIT/g" | sed "s/\${os}/$PLATFORM/g" | sed "s/\${arch}/$SERVER_ARCH/g" | sed "s/\${release}/$DISTRO_VSCODIUM_RELEASE/g")"

# Check if server script is already installed
if [[ ! -f $SERVER_SCRIPT ]]; then
    case "$PLATFORM" in
        darwin | linux | alpine )
            ;;
        *)
            echo "Error '$PLATFORM' needs manual installation of remote extension host"
            print_install_results_and_exit 1
            ;;
    esac

    pushd $SERVER_DIR > /dev/null

    if [[ ! -z $(which wget) ]]; then
        wget --tries=3 --timeout=10 --continue --no-verbose -O vscode-server.tar.gz $SERVER_DOWNLOAD_URL
    elif [[ ! -z $(which curl) ]]; then
        curl --retry 3 --connect-timeout 10 --location --show-error --silent --output vscode-server.tar.gz $SERVER_DOWNLOAD_URL
    else
        echo "Error no tool to download server binary"
        print_install_results_and_exit 1
    fi

    if (( $? > 0 )); then
        echo "Error downloading server from $SERVER_DOWNLOAD_URL"
        print_install_results_and_exit 1
    fi

    tar -xf vscode-server.tar.gz --strip-components 1
    if (( $? > 0 )); then
        echo "Error while extracting server contents"
        print_install_results_and_exit 1
    fi

    if [[ ! -f $SERVER_SCRIPT ]]; then
        echo "Error server contents are corrupted"
        print_install_results_and_exit 1
    fi

    rm -f vscode-server.tar.gz

    popd > /dev/null
else
    echo "Server script already installed in $SERVER_SCRIPT"
fi

# Try to find if server is already running
if [[ -f $SERVER_PIDFILE ]]; then
    SERVER_PID="$(cat $SERVER_PIDFILE)"
    SERVER_RUNNING_PROCESS="$(ps -o pid,args -p $SERVER_PID | grep $SERVER_SCRIPT)"
else
    SERVER_RUNNING_PROCESS="$(ps -o pid,args -A | grep $SERVER_SCRIPT | grep -v grep)"
fi

if [[ -z $SERVER_RUNNING_PROCESS ]]; then
    if [[ -f $SERVER_LOGFILE ]]; then
        rm $SERVER_LOGFILE
    fi
    if [[ -f $SERVER_TOKENFILE ]]; then
        rm $SERVER_TOKENFILE
    fi

    touch $SERVER_TOKENFILE
    chmod 600 $SERVER_TOKENFILE
    SERVER_CONNECTION_TOKEN="c35a3fe4-bc85-4363-a924-973580d6b8eb"
    echo $SERVER_CONNECTION_TOKEN > $SERVER_TOKENFILE

    $SERVER_SCRIPT --start-server --host=127.0.0.1 $SERVER_LISTEN_FLAG $SERVER_INITIAL_EXTENSIONS --connection-token-file $SERVER_TOKENFILE --telemetry-level off --enable-remote-auto-shutdown --accept-server-license-terms &> $SERVER_LOGFILE &
    echo $! > $SERVER_PIDFILE
else
    echo "Server script is already running $SERVER_SCRIPT"
fi

if [[ -f $SERVER_TOKENFILE ]]; then
    SERVER_CONNECTION_TOKEN="$(cat $SERVER_TOKENFILE)"
else
    echo "Error server token file not found $SERVER_TOKENFILE"
    print_install_results_and_exit 1
fi

if [[ -f $SERVER_LOGFILE ]]; then
    for i in {1..5}; do
        LISTENING_ON="$(cat $SERVER_LOGFILE | grep -E 'Extension host agent listening on .+' | sed 's/Extension host agent listening on //')"
        if [[ -n $LISTENING_ON ]]; then
            break
        fi
        sleep 0.5
    done

    if [[ -z $LISTENING_ON ]]; then
        echo "Error server did not start sucessfully"
        print_install_results_and_exit 1
    fi
else
    echo "Error server log file not found $SERVER_LOGFILE"
    print_install_results_and_exit 1
fi

# Finish server setup
print_install_results_and_exit 0

[Trace  - 09:32:15.337] Server install command stdout:
Server script already installed in /home/vscode/.cursor-server/bin/a846435528b4b760494a836f96f0739889253530/bin/cursor-server
9fcba8ba48d0303d58bf46d2: start
exitCode==0==
listeningOn==42659==
connectionToken==c35a3fe4-bc85-4363-a924-973580d6b8eb==
logFile==/home/vscode/.cursor-server/.a846435528b4b760494a836f96f0739889253530.log==
osReleaseId==ubuntu==
arch==x86_64==
platform==linux==
tmpDir==/tmp==
SSH_AUTH_SOCK==/tmp/auth-agent1371082708/listener.sock==
9fcba8ba48d0303d58bf46d2: end

[Trace  - 09:32:15.340] Creating forwarding server 59158(local) => 59157(socks) => 42659(remote)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant