Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

WSL support

Open gustojs opened this issue 1 year ago • 41 comments

Feature Description

Following up on Discord discussion, it would be good to have instructions for WSL setup in the docs.

What I found working for me on Windows 10 + WSL 2, was installing the suggested open-remote-wsl extension.

I can confirm it also works for terminal commands run from the AI chat window.

Additional Context

It requires a step that's easy to miss. The following is taken from the extensions readme but with updated path.

Enable the extension in your .kiro/argv.json file. You can also open it by running the Preferences: Configure Runtime Arguments command.

{
    "enable-proposed-api": [
        "jeanp413.open-remote-wsl",
    ]
}

gustojs avatar Jul 14 '25 22:07 gustojs

A little gotchya for the docs: With the plugin installed I can load the project from WSL, but it consistently tries to run terminal commands in PowerShell instead of the available wsl terminal. I had to change the default terminal profile to the WSL profile for it to use it.

dylancm avatar Jul 14 '25 23:07 dylancm

Updating to 0.1.6 resulted with broken WSL. The output each time was as follows. Reinstalling 0.1.6 from scratch didn't help. Reinstalling the extension didn't help either.

What helped was downgrading back to 0.1.0

[Error  - 08:17:25.57] Error resolving authority
Error: Couldn't install vscode server on remote server, install script returned non-zero exit status
	at t.installCodeServer (c:\Users\gusto\.kiro\extensions\jeanp413.open-remote-wsl-0.0.5-universal\out\extension.js:1:26792)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async c:\Users\gusto\.kiro\extensions\jeanp413.open-remote-wsl-0.0.5-universal\out\extension.js:1:1739

gustojs avatar Jul 16 '25 18:07 gustojs

Hey @gustojs, tried reproducing this issue with Kiro v0.1.9 but did not observe this issue. Could you provide us some additional information on the current setup such as terminal being used? additionally, was there any recent changes to rc files?

ykethan avatar Jul 17 '25 01:07 ykethan

Also confirming the authority issue. The console output is below. This happened immediately after updating from 0.1.0 to 0.1.6, no other changes. Restarting Kiro did make that particular error go away, but it seems to not be fully working, as the actual Kiro chat sidebar only displays the "Drag a view here to display" placeholder text with no chat window at all. The chat window works fine if I don't use WSL.

Not too sure what logs I can provide on that, the dev tools reported the following but I'm not sure if it's related or not: ERR Timed out waiting for authentication provider to register

[Info  - 07:07:05.727] Resolving wsl remote authority 'wsl+Ubuntu' (attemp #1)
[Trace  - 07:07:05.730] Running WSL command: wsl.exe --distribution Ubuntu -- bash -c '
# Server installation script

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

DISTRO_VERSION="1.94.0"
DISTRO_COMMIT="015541f529fdda73324c9ff4a2c9d434ce36cef4"
DISTRO_QUALITY="stable"
DISTRO_VSCODIUM_RELEASE=""

SERVER_APP_NAME="kiro-server"
SERVER_INITIAL_EXTENSIONS=""
SERVER_LISTEN_FLAG="--port=0"
SERVER_DATA_DIR="$HOME/.kiro-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 "becd259e45cbb4ec6959121c: 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 "becd259e45cbb4ec6959121c: 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://prod.download.desktop.kiro.dev/releases/remotes/\${commit}/kiro-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}/$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="27775666-e7cb-498e-8371-9d5f41592425"
    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 "becd259e45cbb4ec6959121c: 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 "becd259e45cbb4ec6959121c: end"

    echo "becd259e45cbb4ec6959121c: 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  - 07:07:16.757] Server install command stdout:
Error while extracting server contents
becd259e45cbb4ec6959121c: start
exitCode==1==
listeningOn====
connectionToken====
logFile==/home/brandon/.kiro-server/.015541f529fdda73324c9ff4a2c9d434ce36cef4.log==
osReleaseId==ubuntu==
arch==x86_64==
platform==Linux==
tmpDir==/run/user/1000/==
becd259e45cbb4ec6959121c: end

[Error  - 07:07:16.758] Error resolving authority
Error: Couldn't install vscode server on remote server, install script returned non-zero exit status
	at t.installCodeServer (c:\Users\brand\.kiro\extensions\jeanp413.open-remote-wsl-0.0.5-universal\out\extension.js:1:26792)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async c:\Users\brand\.kiro\extensions\jeanp413.open-remote-wsl-0.0.5-universal\out\extension.js:1:1739

bakkerme avatar Jul 17 '25 07:07 bakkerme

Hey @gustojs, tried reproducing this issue with Kiro v0.1.9 but did not observe this issue.

I confirm WSL in 0.1.9 works fine for me. The issue was with 0.1.6

gustojs avatar Jul 17 '25 09:07 gustojs

Here's still not working, what the exactly whey to do it? someone have photos or a video how to do it?

nelsonholanda avatar Jul 18 '25 12:07 nelsonholanda

I'm on version 0.1.15 and I'm seeing the exact same issue since this morning

MarcusRosen avatar Jul 21 '25 22:07 MarcusRosen

also not working on 0.1.15

codesjedi avatar Jul 22 '25 14:07 codesjedi

When we goes with wsl2 insinde another folder and type "kiro ." when kiro opens wsl2 doesnt start automatically.

nelsonholanda avatar Jul 22 '25 19:07 nelsonholanda

While Kiro functions, it does not understand WSL2 paths well. Oftentimes, it'll make calls like cd "\\wsl.localhost\Ubuntu\home\..." that fail (issues with escaping).

Qworg avatar Jul 23 '25 06:07 Qworg

Here's still not working, what the exactly whey to do it? someone have photos or a video how to do it?

install the jeanp413.open-remote-wsl extension, add it to your .kiro/argv.json and ualá

codesjedi avatar Jul 23 '25 11:07 codesjedi

Had some troubles to make it work properly. If you have any issues, delete the content of your argv.json file and copy paste the code below as suggested, then restart Kiro

{
    "enable-proposed-api": [
        "jeanp413.open-remote-wsl",
    ]
}

YohannHommet avatar Jul 23 '25 20:07 YohannHommet

版本: 0.1.25 (user setup) 提交: 1.94.0 日期: 6124c448360adbeb0adbc771a86db283d2d3f4db Electron: 2025-07-23T19:45:58.809Z ElectronBuildId: 30.5.1 Chromium: undefined Node.js: 124.0.6367.243 V8: 20.16.0 OS: 12.4.254.20-electron.0

[Error  - 03:32:48.277] Error resolving authority
Error: Couldn't install vscode server on remote server, install script returned non-zero exit status
	at t.installCodeServer (c:\Users\chen\.kiro\extensions\jeanp413.open-remote-wsl-0.0.5-universal\out\extension.js:1:26792)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async c:\Users\chen\.kiro\extensions\jeanp413.open-remote-wsl-0.0.5-universal\out\extension.js:1:1739

I can't connect to WSL after updating to 0.1.25 today.

944750720 avatar Jul 24 '25 03:07 944750720

版本: 0.1.25 (user setup) 提交: 1.94.0 日期: 6124c448360adbeb0adbc771a86db283d2d3f4db Electron: 2025-07-23T19:45:58.809Z ElectronBuildId: 30.5.1 Chromium: undefined Node.js: 124.0.6367.243 V8: 20.16.0 OS: 12.4.254.20-electron.0

[Error  - 03:32:48.277] Error resolving authority
Error: Couldn't install vscode server on remote server, install script returned non-zero exit status
	at t.installCodeServer (c:\Users\chen\.kiro\extensions\jeanp413.open-remote-wsl-0.0.5-universal\out\extension.js:1:26792)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async c:\Users\chen\.kiro\extensions\jeanp413.open-remote-wsl-0.0.5-universal\out\extension.js:1:1739

I can't connect to WSL after updating to 0.1.25 today.

Amazing. Claude Code fixed it. It seems it's because some downloaded packages are broken.

944750720 avatar Jul 25 '25 15:07 944750720

The issues I was having with WSL were cleared up with the v0.1.25 release.

bakkerme avatar Jul 29 '25 00:07 bakkerme

Quick Fix for Kiro v0.1.25 + WSL 🌐

After updating to Kiro version 0.1.25, I hit a snag where WSL and remote integration stopped working entirely. After tons of trial and error, I found that deleting the .kiro-server folder located at: /home/user/.kiro-server ...did the trick. A restart later, and everything was back on track. Sharing this in case anyone else runs into the same wall—hope it saves you some time!

sai-praveen-os avatar Jul 29 '25 08:07 sai-praveen-os

Is it possible that context menu item can be added to open folder instantly through WSL side?

Image

Mgrmjp avatar Jul 30 '25 10:07 Mgrmjp

Can't WSL just be added as an extension? It's such a heavily used tool. Was surprised to see it not available.

macaw2000 avatar Aug 02 '25 14:08 macaw2000

I am not going to use Kiro if the official WSL extension is not supported.

slinden2 avatar Aug 13 '25 19:08 slinden2

IMHO, Kiro is completely useless without native WSL support. I'm not even going to be able to try it since I do all my development within the WSL environment. I got my invite code, installed it, and found out that WSL doesn't work without installing a 3rd party SSH tool. And after reading this thread, even that is hit-or-miss. Let me know when this is available and I'll give it a shot, but not happening until then. Guess we'll see if it's really true that the welcome bonus expiration clock waits until you actually start using it. 😁

dsmaher avatar Aug 16 '25 14:08 dsmaher