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

Win 10 can't connect to remote #9

Open
agreedSkiing opened this issue May 23, 2024 · 2 comments
Open

Win 10 can't connect to remote #9

agreedSkiing opened this issue May 23, 2024 · 2 comments

Comments

@agreedSkiing
Copy link

agreedSkiing commented May 23, 2024

Windows verison

Utgåva	Windows 10 Enterprise
Version	22H2
Installed	‎2023-‎04-‎04
OS-version	19045.4412
Gränssnitt	Windows Feature Experience Pack 1000.19056.1000.0

VSCodium version

Version: 1.89.1
Release: 24130
Commit: a045dcfceda27f896936bfd8cbf524f6a93a2f46
Date: 2024-05-09T18:37:15.872Z
Electron: 28.2.8
ElectronBuildId: undefined
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.19045

Codium print

[Info  - 12:56:15.665] Resolving wsl remote authority 'wsl+Ubuntu-22.04' (attemp #1)
[Trace  - 12:56:15.669] Running WSL command: wsl.exe --distribution Ubuntu-22.04 -- bash -c '
# Server installation script

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

DISTRO_VERSION="1.89.1"
DISTRO_COMMIT="a045dcfceda27f896936bfd8cbf524f6a93a2f46"
DISTRO_QUALITY="stable"
DISTRO_VSCODIUM_RELEASE="24130"

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_OS=
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 "f20f642a37d51dc16a64c513: 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 "f20f642a37d51dc16a64c513: end"
    exit 0
}

# Check if platform is supported
PLATFORM="$(uname -s)"
case $PLATFORM in
    Linux)
        SERVER_OS="linux"
        ;;
    *)
        echo "Error platform not supported: $PLATFORM"
        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"
        ;;
    *)
        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}/$SERVER_OS/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 [[ "$SERVER_OS" = "dragonfly" ]] || [[ "$SERVER_OS" = "freebsd" ]]; then
        echo "Error "$SERVER_OS" 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="5a1c16c9-a464-4094-91a1-f4aae79d2de9"
    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 --use-host-proxy --disable-websocket-compression --without-browser-env-var --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 and keep script running
if [[ -z $SERVER_RUNNING_PROCESS ]]; then
    echo "f20f642a37d51dc16a64c513: start"
    echo "exitCode==0=="
    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 "f20f642a37d51dc16a64c513: end"

    echo "f20f642a37d51dc16a64c513: Server installation script done"

    SERVER_PID="$(cat $SERVER_PIDFILE)"
    SERVER_RUNNING_PROCESS="$(ps -o pid,args -p $SERVER_PID | grep $SERVER_SCRIPT)"
    while [[ -n $SERVER_RUNNING_PROCESS ]]; do
        sleep 300;
        SERVER_RUNNING_PROCESS="$(ps -o pid,args -p $SERVER_PID | grep $SERVER_SCRIPT)"
    done
else
    print_install_results_and_exit 0
fi
'
[Trace  - 12:56:48.797] Server install command stdout:
Error downloading server from https://github.com/VSCodium/vscodium/releases/download/1.89.1.24130/vscodium-reh-linux-x64-1.89.1.24130.tar.gz
f20f642a37d51dc16a64c513: start
exitCode==1==
listeningOn====
connectionToken====
logFile==/home/eriase/.vscodium-server/.a045dcfceda27f896936bfd8cbf524f6a93a2f46.log==
osReleaseId==ubuntu==
arch==x86_64==
platform==Linux==
tmpDir==/run/user/1000==
f20f642a37d51dc16a64c513: end

[Error  - 12:56:48.797] Error resolving authority
Error: Couldn't install vscode server on remote server, install script returned non-zero exit status
	at t.installCodeServer (c:\Users\eriase\.vscode-oss\extensions\jeanp413.open-remote-wsl-0.0.4-universal\out\extension.js:1:26854)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async c:\Users\eriase\.vscode-oss\extensions\jeanp413.open-remote-wsl-0.0.4-universal\out\extension.js:1:1801

bild

Devtools file

vscode-app-1716469417921.log

Powershell info

PS C:\Users\user> wsl --list
Windows-undersystem för Linux-distributioner:
Ubuntu-22.04 (standardinställning)
@agreedSkiing
Copy link
Author

Fixed by predownloading the codium server in wsl

#! /usr/bin/bash
WINDOWS_CODIUM_PATH="/mnt/c/Program/VSCodium"
WINDOWS_CODIUM_PRODUCT_JSON_PATH=$WINDOWS_CODIUM_PATH/resources/app/product.json
WSL_CODIUM_TAR_PATH=$HOME/vscodium-reh-linux.tar.gz

set_codium_repo_name() {
        CODIUM_QUALITY=$(jq ".[0].quality" -rs "$WINDOWS_CODIUM_PRODUCT_JSON_PATH")
        if [[ "$CODIUM_QUALITY" == "stable" ]]; then
                CODIUM_REPO_NAME=vscodium
        elif [[ "$CODIUM_QUALITY" == "insider" ]]; then
                CODIUM_REPO_NAME=vscodium-insiders
        else
                echo Unknowm quality: "$CODIUM_QUALITY"
                exit 1
        fi
}

set_codium_download_version() {
        WINDOWS_CODIUM_RELEASE=$(jq ".[0].release" -rs "$WINDOWS_CODIUM_PRODUCT_JSON_PATH")
        WINDOWS_CODIUM_VERSION=$(jq ".[0].version" -rs "$WINDOWS_CODIUM_PRODUCT_JSON_PATH")
        if [[ "$CODIUM_QUALITY" == "stable" ]]; then
                CODIUM_DOWNLOAD_VERSION="$WINDOWS_CODIUM_VERSION"."$WINDOWS_CODIUM_RELEASE"
        elif [[ "$CODIUM_QUALITY" == "insider" ]]; then
                CODIUM_DOWNLOAD_VERSION="$WINDOWS_CODIUM_VERSION"."$WINDOWS_CODIUM_RELEASE"-"$CODIUM_QUALITY"
        fi
}

determin_wsl_distro_platform() {
        WSL_MACHINE=$(uname -m)
        if [[ "$WSL_MACHINE" == "x86_64" ]]; then
                CODIUM_PLATFORM=x64
        elif [[ "$WSL_MACHINE" == "armv7l" ]]; then
                CODIUM_PLATFORM=armhf
        elif [[ "$WSL_MACHINE" == "armv8l" ]]; then
                CODIUM_PLATFORM=armhf
        elif [[ "$WSL_MACHINE" == "arm64" ]]; then
                CODIUM_PLATFORM=arm64
        elif [[ "$WSL_MACHINE" == "aarch64" ]]; then
                CODIUM_PLATFORM=arm65
        else
                echo Unknown machine: "$WSL_MACHINE"
                exit 1
        fi
}

determin_wsl_kernel() {
        WSL_KERNEL=$(uname -s)
        WSL_KERNEL_LOWERCASE=${WSL_KERNEL,,}
        if [[ "$WSL_KERNEL_LOWERCASE" == "linux" ]]; then
                CODIUM_KERNEL=linux
        elif [[ "$WSL_KERNEL_LOWERCASE" == "alpine" ]]; then
                CODIUM_KERNEL=alpine
        elif [[ "$WSL_KERNEL_LOWERCASE" == "darwin" ]]; then
                CODIUM_KERNEL=darwin
        else
                echo Unkown kernal: "$WSL_KERNEL_LOWERCASE"
                exit 1
        fi
}

download_codium_artifact() {
        if [[ "$CODIUM_REPO_NAME" == "" ]]; then
                echo CODIUM_REPO_NAME not set
                exit 1
        fi
        if [[ "$CODIUM_DOWNLOAD_VERSION" == "" ]]; then
                echo CODIUM_DOWNLOAD_VERSION not set
                exit 1
        fi
        if [[ "$CODIUM_KERNEL" == "" ]]; then
                echo CODIUM_KERNEL not set
                exit 1
        fi
        if [[ "$CODIUM_PLATFORM" == "" ]]; then
                echo CODIUM_PLATFORM not set
                exit 1
        fi
        wget -O "$WSL_CODIUM_TAR_PATH" https://github.com/VSCodium/"$CODIUM_REPO_NAME"/releases/download/"$CODIUM_DOWNLOAD_VERSION"/vscodium-reh-"$CODIUM_KERNEL"-"$CODIUM_PLATFORM"-"$CODIUM_DOWNLOAD_VERSION".tar.gz
}

install_codium_artificat() {
        CODIUM_COMMIT=$(jq ".[0].commit" -rs "$WINDOWS_CODIUM_PRODUCT_JSON_PATH")
        if [[ -d "$HOME"/.vscodium-server/bin/"$CODIUM_COMMIT" ]]; then
                echo Removing old artifact with same commit folder
                rm -fr "$HOME"/.vscodium-server/bin/"$CODIUM_COMMIT"
        fi
        mkdir -p "$HOME"/.vscodium-server/bin/"$CODIUM_COMMIT"
        tar -vxf "$WSL_CODIUM_TAR_PATH" -C "$HOME"/.vscodium-server/bin/"$CODIUM_COMMIT"
        rm "$WSL_CODIUM_TAR_PATH"
}

set_codium_repo_name
set_codium_download_version
determin_wsl_distro_platform
determin_wsl_kernel
download_codium_artifact
install_codium_artificat

@agreedSkiing
Copy link
Author

So my previous post was more a workaround since the download still does not work when i remove my old server

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

1 participant