Tip for install_kdb.sh curl install

So, if you end up running the curl plus install_kdb.sh command that is given on the website, you will find that modules don't download, or download sporadically, depending on your connection. This is annoying. So, here's a tip:

Platform: Linux (tested on Manjaro x86_64)
Symptom: Module downloads (AI, kurl, objstor, parquet, REST, dashboards) time out during installation with a message like:

-------- Downloading AI module --------
Fetching the latest stable version
From: https://portal.dl.kx.com/assets/raw/kdb-x/modules/ai/~latest~/l64-ai.zip
-=O=#   #    #     #
curl: (28) Connection timed out after 300737 milliseconds
Warning: Failed to download AI module. Continuing without AI module

What's happening

The installer's download_file() function calls curl without a --max-time flag. When the KX download server responds with a 307 redirect to the versioned URL (e.g. .../ai/1.0.0/l64-ai.zip), curl occasionally stalls on the redirected connection. Without a timeout, it just hangs until the OS-level TCP timeout fires — which on most Linux systems is around 300 seconds. It then fails rather than retrying.

The main KDB-X binary download works fine because it uses a different, authenticated code path. The module downloads all go through this unprotected download_file() helper.

You can confirm the files are actually accessible by curling them manually:

bash

curl -L --max-time 60 "https://portal.dl.kx.com/assets/raw/kdb-x/modules/ai/1.0.0/l64-ai.zip" -o /tmp/test.zip

If that succeeds, your network is fine — it's the installer that needs fixing.


The fix

Download the installer script from the KX Developer Centre as normal, then apply this one-line patch before running it:

bash

sed -i 's/curl --fail --progress-bar -Lo/curl --fail --progress-bar --max-time 120 --retry 3 --retry-delay 5 -Lo/' install_kdb.sh
sed -i 's/curl --fail -Lo/curl --fail --max-time 120 --retry 3 --retry-delay 5 -Lo/' install_kdb.sh

Then run the patched installer as normal:

bash

bash install_kdb.sh --b64lic <your_license_key>

What the patch does

It modifies the download_file() function (around line 198) from:

bash

download_file() {
    local url="$1"
    local output_file="$2"

    if [ -t 1 ]; then
        curl --fail --progress-bar -Lo "$output_file" "$url"
    else
        curl --fail -Lo "$output_file" "$url"
    fi

    return $?
}

To:

bash

download_file() {
    local url="$1"
    local output_file="$2"

    if [ -t 1 ]; then
        curl --fail --progress-bar --max-time 120 --retry 3 --retry-delay 5 -Lo "$output_file" "$url"
    else
        curl --fail --max-time 120 --retry 3 --retry-delay 5 -Lo "$output_file" "$url"
    fi

    return $?
}

The flags added:

  • --max-time 120 — give up after 2 minutes rather than hanging indefinitely

  • --retry 3 — automatically retry up to 3 times on failure

  • --retry-delay 5 — wait 5 seconds between retries


Already ran the installer and modules are missing?

If you've already installed and just want the modules, you can download them manually and extract into the right place:

bash

# AI module (replace with whichever modules you need)
curl -L --max-time 120 "https://portal.dl.kx.com/assets/raw/kdb-x/modules/ai/~latest~/l64-ai.zip" -o /tmp/l64-ai.zip
unzip /tmp/l64-ai.zip -d ~/.kx/

The URL pattern for all modules is:

https://portal.dl.kx.com/assets/raw/kdb-x/modules/<name>/~latest~/l64-<name>.zip

Known module names: ai, kurl, objstor, pq (parquet), rest-server, dashboards.


Hopefully KX adds retry logic to the official installer soon. In the meantime this workaround gets you a complete install.

1 Answer

1

Thank you for sharing @lz4_8fs3 !