Skip to content

smarttechlabs-projects/strix-halo-lmstudio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

LM Studio Launcher for Ubuntu

A launcher script for managing and running LM Studio AppImage on Ubuntu/Linux systems with automatic version management.

Overview

LM Studio is distributed as an AppImage for Linux. This launcher script provides:

  • Automatic version management - Detects new downloads and updates installation
  • Clean installation directory - Maintains LM Studio in /opt/lmstudio
  • Version tracking - Tracks installed version for update comparison
  • Auto shell configuration - Automatically adds PATH and lmstudio alias to your shell
  • Graceful cleanup - Handles signals and cleans up processes on exit

Requirements

  • Ubuntu (or other Linux distribution)
  • LM Studio AppImage downloaded from lmstudio.ai

⚠️ Important: AMD Strix Point GPU Users

If you have an AMD Ryzen AI MAX+ 395 (or similar Strix Point APU with Radeon 8060S graphics), the ROCm backend will not work. The gfx1151 GPU architecture is too new and not yet supported by the bundled llama.cpp ROCm binaries.

Symptoms: Model crashes immediately with "Exit code: null" error when trying to load any model.

Solution: Switch to the Vulkan backend instead:

  1. Close LM Studio completely
  2. Edit ~/.lmstudio/.internal/backend-preferences-v1.json:
    [
      {
        "model_format": "gguf",
        "name": "llama.cpp-linux-x86_64-vulkan-avx2",
        "version": "1.62.0"
      }
    ]
  3. Restart LM Studio

Alternatively, you can change the backend in LM Studio Settings → Runtime (if accessible before crash).

Installation

1. Create the Installation Directory

The script requires /opt/lmstudio to exist with user write permissions:

sudo mkdir -p /opt/lmstudio
sudo chown $USER:$USER /opt/lmstudio

2. Download LM Studio

Download the latest LM Studio AppImage from lmstudio.ai to your ~/Downloads folder.

The file should match the pattern: LM-Studio-X.Y.Z-N-x64.AppImage

Example: LM-Studio-0.3.34-1-x64.AppImage

3. Clone or Copy the Script

git clone <repository-url> ~/Projects/strix-lmstudio
# or copy run_lmstudio.sh to your preferred location

4. Make Executable

chmod +x run_lmstudio.sh

Usage

Starting LM Studio

./run_lmstudio.sh

The script will:

  1. Configure shell PATH and alias (first run only)
  2. Check ~/Downloads for new LM Studio AppImage files
  3. Compare versions with currently installed version
  4. Install/update if a newer version is found
  5. Launch LM Studio with required parameters

After the first run, you can use the lmstudio alias from anywhere:

lmstudio

Stopping LM Studio

Press Ctrl+C in the terminal. The script will:

  1. Gracefully terminate LM Studio
  2. Clean up any remaining processes
  3. Remove temporary files and lock files

How It Works

Directory Structure

/opt/lmstudio/
├── LMStudio.AppImage      # The installed AppImage (renamed for consistency)
└── lmstudio.version       # Text file containing version string (e.g., "0.3.34-1")

~/Downloads/
└── LM-Studio-X.Y.Z-N-x64.AppImage   # New downloads detected here

Version Management

The script extracts version information from the AppImage filename:

LM-Studio-0.3.34-1-x64.AppImage
           ^^^^^^^^
           Version: 0.3.34-1 (semver + build number)

Version comparison logic:

Scenario Current New Action
Major update 0.3.34-1 0.4.0-1 Update
Minor update 0.3.34-1 0.3.35-1 Update
Build update 0.3.34-1 0.3.34-2 Update
Same version 0.3.34-1 0.3.34-1 Skip (remove duplicate)
Older version 0.3.34-1 0.3.33-1 Skip

Shell Configuration (Auto)

On first run, the script automatically configures your shell:

File What's Added
~/.bashrc PATH + lmstudio alias
~/.profile PATH only (login shells)
~/.zshrc PATH + lmstudio alias

The configuration is idempotent - it only adds entries if they don't exist. After configuration, reload your shell or run:

source ~/.bashrc   # or source ~/.zshrc

Update Workflow

┌─────────────────────────────────────────────────────────────┐
│ 0. Configure shell PATH/alias (first run only)              │
│ 1. Scan ~/Downloads for LM-Studio-*-x64.AppImage            │
│ 2. Extract version from filename                            │
│ 3. Compare with /opt/lmstudio/lmstudio.version              │
│ 4. If newer:                                                │
│    ├─ Remove old AppImage                                   │
│    ├─ Move new AppImage to /opt/lmstudio/LMStudio.AppImage  │
│    ├─ Set executable permission                             │
│    ├─ Update version file                                   │
│    └─ Clean up old downloads                                │
│ 5. Launch /opt/lmstudio/LMStudio.AppImage --no-sandbox      │
└─────────────────────────────────────────────────────────────┘

Why --no-sandbox?

LM Studio (built on Electron) requires the --no-sandbox flag when running as an AppImage on Linux. This is due to how AppImage bundles work with Chrome's sandbox requirements. The script handles this automatically.

Configuration

All configuration is at the top of run_lmstudio.sh:

INSTALL_DIR="/opt/lmstudio"           # Installation directory
VERSION_FILE="$INSTALL_DIR/lmstudio.version"  # Version tracking
APPIMAGE_NAME="LMStudio.AppImage"     # Canonical name after install
DOWNLOADS_DIR="$HOME/Downloads"       # Where to look for new versions
DOWNLOAD_PATTERN="LM-Studio-*-x64.AppImage"  # Filename pattern to match

Troubleshooting

"Installation directory does not exist"

Create the directory with proper permissions:

sudo mkdir -p /opt/lmstudio
sudo chown $USER:$USER /opt/lmstudio

"Installation directory is not writable"

Fix permissions:

sudo chown $USER:$USER /opt/lmstudio

"No LM Studio AppImage found"

Download LM Studio from lmstudio.ai to ~/Downloads.

LM Studio Already Running

The script detects running instances and prompts to kill them:

WARNING: LM Studio appears to be already running.
Do you want to kill existing instances and continue? (y/N):

Display Issues

Ensure your DISPLAY environment variable is set (shown in startup output). For Wayland users, you may need additional configuration.

Files and Directories

Path Purpose
/opt/lmstudio/ Installation directory
/opt/lmstudio/LMStudio.AppImage The executable AppImage
/opt/lmstudio/lmstudio.version Installed version string
~/.lmstudio/ LM Studio user configuration
~/.config/LM Studio/ LM Studio cache and settings
/tmp/.mount_LM-Stu* Temporary AppImage mount (cleaned on exit)

Cleanup on Exit

The script sets up signal handlers for SIGINT (Ctrl+C) and SIGTERM to:

  1. Terminate the LM Studio process gracefully
  2. Force kill if graceful shutdown fails after 3 seconds
  3. Kill any remaining related processes
  4. Remove temporary mount directories
  5. Remove lock files

License

This launcher script is provided as-is. LM Studio itself is a separate product - see lmstudio.ai for its licensing terms.

About

Simple installer script which take a download (if newer) and installs it globally. Sets Vulkan support

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages