@@ -981,8 +981,11 @@ ensure_docker_for_apps() {
981981 fi
982982}
983983
984- ensure_container_runtime
985- ensure_docker_for_apps
984+ # Container/Docker setup is optional for the core controller. On hosts where it
985+ # cannot complete (WSL without systemd, minimal VMs, incus/docker iptables that
986+ # fail under set -e), warn and continue rather than aborting the whole install.
987+ ensure_container_runtime || warn " container runtime setup did not complete -- agent containers may be unavailable; continuing"
988+ ensure_docker_for_apps || warn " Docker setup did not complete -- Store Docker apps will be unavailable; continuing"
986989
987990# --- clone / update the repo ---------------------------------------------
988991
@@ -1166,7 +1169,10 @@ ensure_litellm_postgres() {
11661169 log " litellm postgres: data/.litellm_db_url written — virtual keys enabled"
11671170}
11681171
1169- ensure_litellm_postgres
1172+ # Postgres backs LiteLLM virtual keys; without it the controller still runs and
1173+ # falls back gracefully. Never let DB setup abort the core install (e.g. WSL
1174+ # without systemd, where the postgres daemon cannot start).
1175+ ensure_litellm_postgres || warn " litellm postgres setup did not complete -- virtual keys disabled, controller still runs; continuing"
11701176
11711177# --- desktop SPA bundle --------------------------------------------------
11721178# The bundle is not committed to git (static/desktop/ is gitignored), so it has
@@ -1672,7 +1678,94 @@ install_linux_systemd_user() {
16721678 log " logs: journalctl --user -u tinyagentos -f"
16731679}
16741680
1681+ # True when systemd is the running init, so the systemd path will actually work.
1682+ # On WSL without systemd (or a minimal container), systemctl is either missing or
1683+ # reports the system was not booted with systemd as PID 1.
1684+ _systemd_is_init () {
1685+ command -v systemctl > /dev/null 2>&1 || return 1
1686+ case " $( systemctl is-system-running 2> /dev/null) " in
1687+ running|degraded|starting|initializing|maintenance) return 0 ;;
1688+ * ) return 1 ;;
1689+ esac
1690+ }
1691+
1692+ # Fallback when systemd is not the init (e.g. WSL without systemd): start the
1693+ # controller as a plain background process so the Web UI is reachable now. It
1694+ # will NOT auto-start on reboot; we leave a re-launch helper and explain how to
1695+ # get a managed service. This is the controller-equivalent of the no-systemd
1696+ # Docker daemon ladder above, so a WSL box is not left with a dead UI.
1697+ install_linux_nohup () {
1698+ local pyenv=" $INSTALL_DIR /.venv/bin/python"
1699+ local logf=" $INSTALL_DIR /data/controller.log"
1700+ local runner=" $INSTALL_DIR /scripts/taos-run.sh"
1701+ local runuser
1702+ if [[ " $( id -u) " == " 0" ]]; then
1703+ ensure_taos_user
1704+ set_data_dir_ownership
1705+ runuser=" taos"
1706+ else
1707+ runuser=" $( id -un) "
1708+ fi
1709+
1710+ # Re-launch helper so the user can start taOS again after a reboot.
1711+ cat > " $runner " << EOF
1712+ #!/bin/bash
1713+ # Start the taOS controller without systemd (background-free; runs in foreground).
1714+ cd "$INSTALL_DIR " || exit 1
1715+ # The live install ran the controller as '$runuser '. If this helper is later
1716+ # re-run as root (the documented post-reboot path), re-drop to that user so
1717+ # data/ ownership stays consistent. Minimal boxes may lack sudo, so prefer
1718+ # runuser/su (util-linux) over sudo.
1719+ if [ "\$ (id -u)" = "0" ] && [ "\$ (id -un)" != "$runuser " ]; then
1720+ if command -v runuser >/dev/null 2>&1; then exec runuser -u "$runuser " -- /bin/bash "\$ 0"
1721+ elif command -v sudo >/dev/null 2>&1; then exec sudo -u "$runuser " /bin/bash "\$ 0"
1722+ elif command -v su >/dev/null 2>&1; then exec su -s /bin/bash "$runuser " -c "exec /bin/bash '\$ 0'"; fi
1723+ fi
1724+ export PYTHONUNBUFFERED=1 TAOS_HOST=0.0.0.0 TAOS_PORT=$TAOS_PORT TAOS_BROWSER_PROXY_PORT=$TAOS_BROWSER_PROXY_PORT
1725+ exec "$pyenv " -m tinyagentos
1726+ EOF
1727+ chmod +x " $runner "
1728+ [[ " $runuser " != " $( id -un) " ]] && chown " $runuser " : " $runner " 2> /dev/null || true
1729+
1730+ log " systemd is not the init here (e.g. WSL without systemd) -- starting the controller directly"
1731+ local launch=" cd '$INSTALL_DIR '; PYTHONUNBUFFERED=1 TAOS_HOST=0.0.0.0 TAOS_PORT=$TAOS_PORT TAOS_BROWSER_PROXY_PORT=$TAOS_BROWSER_PROXY_PORT nohup '$pyenv ' -m tinyagentos >> '$logf ' 2>&1 &"
1732+ if [[ " $runuser " != " $( id -un) " ]]; then
1733+ # Drop to the service user without assuming sudo: minimal containers (a
1734+ # target of this fallback) frequently run as root with no sudo binary.
1735+ # Prefer runuser/su (util-linux, present on minimal boxes), then sudo.
1736+ if command -v runuser > /dev/null 2>&1 ; then
1737+ runuser -u " $runuser " -- bash -c " $launch "
1738+ elif command -v sudo > /dev/null 2>&1 ; then
1739+ sudo -u " $runuser " bash -c " $launch "
1740+ else
1741+ su -s /bin/bash " $runuser " -c " $launch "
1742+ fi
1743+ else
1744+ bash -c " $launch "
1745+ fi
1746+
1747+ local i=0
1748+ while (( i < 15 )) && ! curl -sf -o /dev/null " http://localhost:$TAOS_PORT /api/health" 2> /dev/null; do
1749+ sleep 1; i=$(( i+ 1 ))
1750+ done
1751+ if curl -sf -o /dev/null " http://localhost:$TAOS_PORT /api/health" 2> /dev/null; then
1752+ log " controller started (no-systemd mode), reachable on port $TAOS_PORT "
1753+ else
1754+ warn " controller did not answer on port $TAOS_PORT yet -- see $logf "
1755+ fi
1756+ warn " no systemd: taOS will NOT auto-start on reboot."
1757+ warn " start it again later with: bash $runner "
1758+ warn " for a managed auto-start service, enable systemd and re-run this installer:"
1759+ warn " WSL: put '[boot]' then 'systemd=true' in /etc/wsl.conf, run 'wsl --shutdown', reopen."
1760+ }
1761+
16751762install_linux_systemd () {
1763+ # WSL/minimal boxes may not run systemd; the systemctl path would just fail
1764+ # and leave the UI dead. Fall back to a direct background launch instead.
1765+ if ! _systemd_is_init; then
1766+ install_linux_nohup
1767+ return
1768+ fi
16761769 if have_root_or_sudo; then
16771770 install_linux_systemd_system
16781771 else
0 commit comments