Skip to content

4.0.3: install.sh crashes on headless Linux — hardcodes --mode gui with no display detection #912

@zeddy303

Description

@zeddy303

Environment

  • PAI Version: v4.0.3
  • OS: Linux x86_64 (headless server, no X11/Wayland)
  • Bun: v1.3.8
  • Git: 2.47.3

Description

Running install.sh on a headless Linux server (no display server) crashes immediately after the prerequisite checks
pass. The script hardcodes --mode gui which launches Electron, but Electron requires X11 or Wayland.

This affects all headless environments: servers, SSH sessions, containers, CI/CD, WSL without display forwarding.

Steps to Reproduce

  1. SSH into a headless Linux server
  2. Run ./install.sh from the PAI v4.0.3 release

Expected Behavior

The installer detects the headless environment and falls back to the CLI wizard (--mode cli), which main.ts already
supports.

Actual Behavior

ℹ Platform: Linux (x86_64)
✓ curl found
✓ Git found: git version 2.47.3
✓ Bun found: v1.3.8
✓ Claude Code found
ℹ Launching installer...

Starting PAI Installer GUI...

pai-installer@4.0.3 start
electron .

[2569344:0305/022508.591188:ERROR:ozone_platform_x11.cc(246)] Missing X server or $DISPLAY
[2569344:0305/022508.591253:ERROR:env_config_provider.cc(29)] The platform failed to initialize. Exiting.

Electron segfaults (SIGSEGV). Installation fails completely.

Root Cause

install.sh line 156:
exec bun run "$INSTALLER_DIR/main.ts" --mode gui

This unconditionally forces GUI mode. Meanwhile, main.ts already supports three modes (cli, web, gui) — the bootstrap
script just never uses anything other than gui.

Suggested Fix

Replace line 156 in install.sh with display detection:

Detect display availability — default to CLI, upgrade to GUI if display present

if [[ -n "${DISPLAY:-}" ]] || [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
INSTALL_MODE="gui"
else
info "No display detected — using CLI installer"
INSTALL_MODE="cli"
fi

exec bun run "$INSTALLER_DIR/main.ts" --mode "$INSTALL_MODE"

This keeps GUI as the default on desktops while making headless environments work out of the box.

Workaround

Skip install.sh and invoke main.ts directly:

bun run /path/to/PAI-Install/main.ts --mode cli

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions