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

Can no longer connect #171

Open
gothicVI opened this issue Oct 8, 2024 · 3 comments
Open

Can no longer connect #171

gothicVI opened this issue Oct 8, 2024 · 3 comments

Comments

@gothicVI
Copy link
Contributor

gothicVI commented Oct 8, 2024

Version of the extension: v0.0.46
Version of VSCodium:

Version: 1.94.0
Release: 24281
Commit: e3ecc7b1f165b02bbce073afbe9ab016559e91cb
Date: 2024-10-07T16:22:10.210Z
Electron: 30.5.1
ElectronBuildId: undefined
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Linux x64 6.1.0-26-amd64

Client and host are Debian 12 instances. All of a sudden I'm getting on a machine I could access yesterday:

[Info  - 06:13:40.150] Resolving ssh remote authority 'ssh-remote+hostname' (attemp #1)
[Trace  - 06:13:40.170] Identity keys:
/home/user/.ssh/id_rsa ssh-rsa SHA256:XXX=
[Trace  - 06:13:40.172] Identity keys:
/home/user/.ssh/id_rsa ssh-rsa SHA256:XXX=
[Info  - 06:13:40.293] Trying no-auth authentication
[Info  - 06:13:40.342] Trying publickey authentication: /home/user/.ssh/id_rsa ssh-rsa SHA256:XXX=
[Error  - 06:13:40.469] Error resolving authority
Error: All configured authentication methods failed
	at me (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:155776)
	at /home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:409410
	at authHandler (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:403927)
	at Se (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:158994)
	at USERAUTH_FAILURE (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:147797)
	at 51 (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:311810)
	at e.exports.M (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:178339)
	at H.decrypt (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:274675)
	at e.exports.F [as _parse] (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:177863)
	at e.exports.parse (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:182250)
	at Socket.<anonymous> (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:154516)
	at Socket.emit (node:events:519:28)
	at Socket.emit (node:domain:488:12)
	at addChunk (node:internal/streams/readable:559:12)
	at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
	at Readable.push (node:internal/streams/readable:390:5)
	at TCP.onStreamRead (node:internal/stream_base_commons:191:23)

The machine is behind a 2FA jump host and I do not even get the prompt for 2FA.
The 2FA host I also can no longer access but at least I'm getting the prompt:

[Info  - 06:17:42.598] Resolving ssh remote authority 'ssh-remote+jumphostname' (attemp #1)
[Trace  - 06:17:42.613] Identity keys:
/home/user/.ssh/id_rsa ssh-rsa SHA256:XXX=
[Info  - 06:17:42.734] Trying no-auth authentication
[Info  - 06:17:42.789] Trying publickey authentication: /home/user/.ssh/id_rsa ssh-rsa SHA256:XXX=
[Info  - 06:17:42.900] Trying keyboard-interactive authentication
[Trace  - 06:17:46.933] Server install command:

# Server installation script

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

DISTRO_VERSION="1.94.0"
DISTRO_COMMIT="e3ecc7b1f165b02bbce073afbe9ab016559e91cb"
DISTRO_QUALITY="stable"
DISTRO_VSCODIUM_RELEASE="24281"

SERVER_APP_NAME="codium-server"
SERVER_INITIAL_EXTENSIONS=""
SERVER_LISTEN_FLAG="--port=0"
SERVER_DATA_DIR="$HOME/.vscodium-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 "01077d1051173abf5d9fdd2f: 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 "01077d1051173abf5d9fdd2f: 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"
        ;;
    *)
        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

SERVER_DOWNLOAD_URL="$(echo "https://github.com/VSCodium/vscodium/releases/download/\${version}.\${release}/vscodium-reh-\${os}-\${arch}-\${version}.\${release}.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
    if [[ "$PLATFORM" != "darwin" ]] && [[ "$PLATFORM" != "linux" ]]; then
        echo "Error "$PLATFORM" needs manual installation of remote extension host"
        print_install_results_and_exit 1
    fi

    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="76b5f4b0-e541-4274-ab7b-541fd5fd9f04"
    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  - 06:17:49.563] Server install command stdout:
Server script already installed in /local/home/user/.vscodium-server/bin/e3ecc7b1f165b02bbce073afbe9ab016559e91cb/bin/codium-server
Error server did not start sucessfully
01077d1051173abf5d9fdd2f: start
exitCode==1==
listeningOn====
connectionToken==76b5f4b0-e541-4274-ab7b-541fd5fd9f04==
logFile==/local/home/user/.vscodium-server/.e3ecc7b1f165b02bbce073afbe9ab016559e91cb.log==
osReleaseId==sles==
arch==x86_64==
platform==linux==
tmpDir==/run/user/4154591==
SSH_AUTH_SOCK==/tmp/ssh-XXXXf3fFXQ/agent.99088==
01077d1051173abf5d9fdd2f: end

[Error  - 06:17:49.564] Error resolving authority
Error: Couldn't install vscode server on remote server, install script returned non-zero exit status
	at t.installCodeServer (/home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:441139)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async /home/user/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.46-universal/out/extension.js:1:404879

Using Visual Studio Code and the SSH extension works though.

@PigeonF
Copy link

PigeonF commented Oct 8, 2024

I believe this is related to VSCodium/vscodium#2049.

If you look at /local/home/user/.vscodium-server/.e3ecc7b1f165b02bbce073afbe9ab016559e91cb.log, and you see the following error message you can use the workaround described in the above issue.

$ tail -n 7 ~/.vscodium-server/.e3ecc7b1f165b02bbce073afbe9ab016559e91cb.log
SyntaxError: The requested module 'node:module' does not provide an export named 'register'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
    at async loadESM (node:internal/process/esm_loader:91:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)

@lahwaacz
Copy link

lahwaacz commented Oct 9, 2024

I believe this is related to VSCodium/vscodium#2049.

Yes. This is fixed by VSCodium 1.94.0.24282.

@gothicVI
Copy link
Contributor Author

gothicVI commented Oct 9, 2024

Yes. This is fixed by VSCodium 1.94.0.24282.

Can only partially confirm. I can again connect to the jump host but not to any hosts behind that. The error remains the same.

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

No branches or pull requests

3 participants