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

Error: Couldn't install vscode server on remote server, install script returned non-zero exit status #148

Closed
archisman-panigrahi opened this issue Apr 13, 2024 · 10 comments

Comments

@archisman-panigrahi
Copy link

I am getting the following error.

Error  - 15:01:17.341] Error resolving authority
Error: Couldn't install vscode server on remote server, install script returned non-zero exit status
	at t.installCodeServer (/home/archisman/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.45-universal/out/extension.js:1:441144)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async /home/archisman/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.45-universal/out/extension.js:1:404941

My ssh keys are correctly configured, and the proprietary Remote SSH client in Visual Studio Code can connect successfully.

@rishikeshrmadan
Copy link

Started having this error around the same time as your post, does it have something to do with expired certificates or something? Will look into this more soon..

@rishikeshrmadan
Copy link

Reverting the codium version with snap fixed the issue for me, reverted from 1.88.1.24104 to 1.88.1.24102. So will probably need to upgrade stuff on the server side but I won't bother with that since I don't have full access on the specific machine I'm using..

@rrthomas
Copy link

rrthomas commented Apr 15, 2024

I am having this problem, again just today (was working fine last week), with Codium 1.88.1.24104 at both ends. I too have no problem with ssh connection to the remote machine. Downgrading to 1.88.1.24102 (at both ends, in my case) fixed things for me too.

Thanks for this extension, I really appreciate having a libre remote dev solution, and it's extended the lifetime of my laptop, which can no longer cope easily with some of the dev envs I need to run.

@fooryo
Copy link

fooryo commented Apr 15, 2024

When I try to connect the terminal shows the script that I think it tries to execute on the remote host :

OS: Archlinux
pks: vscodium-bin. vscodium-bin-marketplace, vscodium-bin-features

enabled this extension via editing argv.json as written in readme

script
# Server installation script

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

DISTRO_VERSION="1.88.1"
DISTRO_COMMIT="0d01a72525276e5e3771fe5851b9c83de0de1e2b"
DISTRO_QUALITY="stable"
DISTRO_VSCODIUM_RELEASE="24104"

SERVER_APP_NAME="code-server"
SERVER_INITIAL_EXTENSIONS=""
SERVER_LISTEN_FLAG="--port=0"
SERVER_DATA_DIR="$HOME/.vscode-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 "0f723c9eec45bf43fc86d79e: 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 "0f723c9eec45bf43fc86d79e: 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"
        ;;
    *)
        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="eb842453-f7ec-45f3-8e23-2ab9b71a7591"
    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

The script tries to download (in my case) this file from https://github.com/VSCodium/vscodium/releases/download/1.88.1.24104/vscodium-reh-linux-x64-1.88.1.24104.tar.gz and naming it vscode-server.tar.gz and then extracting it into the home dir.

After that the script fails to locate something that should be at $HOME/.vscode-server/bin/$DISTRO_COMMIT/bin/code-server ($DISTRO_COMMIT is a string defined in the script) but inside the archive there is nothing like that path, btw I can find a ./bin/codium-server

I hope my investigation is correct

@fooryo
Copy link

fooryo commented Apr 17, 2024

small update:

the whole error, for me, is :

Error server contents are corrupted
21ffcead3c62f349482e5c51: start
exitCode==1==
listeningOn====
connectionToken====
logFile==/home/USER/.vscode-server/.0d01a72525276e5e3771fe5851b9c83de0de1e2b.log==
osReleaseId==arch==
arch==x86_64==
platform==linux==
tmpDir==/run/user/1000==
21ffcead3c62f349482e5c51: end

[Error  - 15:27:33.229] Error resolving authority
Error: Couldn't install vscode server on remote server, install script returned non-zero exit status
	at t.installCodeServer (/home/salotto/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.45/out/extension.js:1:441144)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async /home/salotto/.vscode-oss/extensions/jeanp413.open-remote-ssh-0.0.45/out/extension.js:1:404941

OS: Archlinux
installed packages:

  • vscodium-bin 1.88.1.24104-1
  • vscodium-bin-features 1.82.0-4
  • vscodium-bin-marketplace 1.76.0-1
  • ssh remote extension installed as written on the readme (edit argv.json file)

My homemade fix (not a fix, just bypass, I dont know how to contrinute, I'm a failure as a computer engineer) was symbolically link (ln -s)
/home/USER/.vscode-server/bin/0d01a72525276e5e3771fe5851b9c83de0de1e2b/bin/codium-server
into
/home/USER/.vscode-server/bin/0d01a72525276e5e3771fe5851b9c83de0de1e2b/bin/code-server

I think my steps were:

  1. try to connect to vscodium via ssh via the extension such that the script, executed into the remote host, at least downloads and unpacks the archive but fail to locate and run the activation script (blablabla/bin/codium-server)
  2. link that file in the remote machine (code-server -> codium-server)
  3. retry to connect
  4. ???
  5. profit!

@archisman-panigrahi @rrthomas @rishikeshrmadan : if you have had the same error my so-called-fix could help

@fooryo
Copy link

fooryo commented Apr 17, 2024

A weird thing happened, by the way:
In my remote host's home directory there are now .vscode-server & .vscodium-server directories.
.vscode-server directory holds the server stuff that I got via the setup-script (the one that download that archive, unpack it and then fail to execute the server because it cannot find code-server because it is called codium-server).
.vscodium-server appeared afterward and holds two directories: data & extensions.
I dont know if it is a legit behaviour or not.

@rrthomas
Copy link

Nice work @fooryo, sounds like either a name has changed, or it has failed to be search-and-replaced in a particular release.

@archisman-panigrahi
Copy link
Author

archisman-panigrahi commented May 3, 2024

I updated VSCodium to the latest version. Then, rm -rf .vscodium-server in the server side worked for me.

@rrthomas
Copy link

rrthomas commented May 3, 2024

Worked for me, many thanks!

@fooryo
Copy link

fooryo commented Aug 4, 2024

I dont know about you, guys but I still need to create a link code-server that points to codium-server

Both my machines are Arch derivatives.
Both my machines have installed (from the aur)

  • vscodium-bin 1.91.1.24193-1
  • vscodium-bin-features 1.82.0-4
  • vscodium-bin-marketplace 1.76.0-1

EDIT: it seems the culprit, at least for me, is an AUR packages that patched my vscodium

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

4 participants