From ad606b251721f8c8fcd49e87d8954d7756ca2e4f Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Fri, 10 Oct 2025 10:35:25 +0100 Subject: [PATCH] Fix: Glibc error by pegging ubuntu version, appimage include extras like breez_sdk (#3397) --- .github/workflows/packaging.yml | 30 ++++----- lnbits.sh | 112 +++++++++++++++++++------------- 2 files changed, 80 insertions(+), 62 deletions(-) diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index 955df437..0426ffa3 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -5,23 +5,19 @@ on: types: [published] jobs: - build-linux-package: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - # Step 1: Checkout the repository - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - # Step 2: Set up Python (uv will still use this toolchain) - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - # Step 3: Install system deps (fuse) + uv - name: Install system deps and uv run: | sudo apt-get update @@ -30,7 +26,6 @@ jobs: echo "$HOME/.local/bin" >> $GITHUB_PATH shell: bash - # Optional: Cache uv + venv to speed up CI - name: Cache uv and venv uses: actions/cache@v4 with: @@ -39,7 +34,6 @@ jobs: .venv key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock', 'pyproject.toml') }} - # Step 4: Prepare packaging tree and clone LNbits - name: Prepare packaging & clone LNbits run: | mv .github/packaging packaging @@ -47,18 +41,11 @@ jobs: git clone https://github.com/lnbits/lnbits.git packaging/linux/AppDir/usr/lnbits shell: bash - # Step 5: Build the LNbits binary with uv + PyInstaller - name: Build LNbits binary (uv + PyInstaller) run: | cd packaging/linux/AppDir/usr/lnbits - - # Install project deps into .venv using uv - uv sync - - # Install PyInstaller into the same environment + uv sync --all-extras --no-dev uv pip install pyinstaller - - # Build the LNbits binary uv run pyinstaller \ --onefile \ --name lnbits \ @@ -66,6 +53,10 @@ jobs: --collect-all embit \ --collect-all lnbits \ --collect-all sqlalchemy \ + --collect-all breez_sdk \ + --collect-binaries breez_sdk \ + --collect-all breez_sdk_liquid \ + --collect-binaries breez_sdk_liquid \ --collect-all aiosqlite \ --hidden-import=passlib.handlers.bcrypt \ "$(uv run which lnbits)" @@ -75,7 +66,7 @@ jobs: chmod +x packaging/linux/AppDir/lnbits.desktop chmod +x packaging/linux/AppDir/usr/lnbits/dist/lnbits - # Clean out non-dist content from the app dir to keep AppImage slim + # keep AppDir slim find packaging/linux/AppDir/usr/lnbits -mindepth 1 -maxdepth 1 \ ! -name 'dist' \ ! -name 'lnbits' \ @@ -91,9 +82,14 @@ jobs: packaging/linux/AppDir "$APPIMAGE_NAME" chmod +x "$APPIMAGE_NAME" echo "APPIMAGE_NAME=$APPIMAGE_NAME" >> $GITHUB_ENV + + # 🔎 quick audit: show glibc versions referenced by the binary + echo "Runner glibc:" + ldd --version | head -n1 || true + echo "Symbols needed by lnbits:" + strings "$APPIMAGE_NAME" | grep -o 'GLIBC_[0-9.]*' | sort -u || true shell: bash - # Step 6: Upload Linux Release Asset - name: Upload Linux Release Asset uses: actions/upload-release-asset@v1 with: diff --git a/lnbits.sh b/lnbits.sh index 5ccbf571..648169e5 100644 --- a/lnbits.sh +++ b/lnbits.sh @@ -1,53 +1,75 @@ -#!/bin/bash +#!/usr/bin/env bash +set -euo pipefail -# Check install has not already run -if [ ! -d lnbits/data ]; then +# --- Config you might tweak --- +REPO_URL="https://github.com/lnbits/lnbits.git" +BRANCH="main" +APP_DIR="${PWD}/lnbits" +HOST="${HOST:-0.0.0.0}" +PORT="${PORT:-5000}" +ADMIN_UI="${LNBITS_ADMIN_UI:-true}" +# ------------------------------- - # Update package list and install prerequisites non-interactively - sudo apt update -y - sudo apt install -y software-properties-common +export DEBIAN_FRONTEND=noninteractive - # Add the deadsnakes PPA repository non-interactively - sudo add-apt-repository -y ppa:deadsnakes/ppa - - # Install Python 3.10 and distutils non-interactively - sudo apt install -y python3.10 python3.10-distutils - - # Install UV - curl -LsSf https://astral.sh/uv/install.sh | sh - - export PATH="/home/$USER/.local/bin:$PATH" - - if [ ! -d lnbits/wallets ]; then - # Clone the LNbits repository - git clone https://github.com/lnbits/lnbits.git - if [ $? -ne 0 ]; then - echo "Failed to clone the repository ... FAIL" - exit 1 - fi - # Ensure we are in the lnbits directory - cd lnbits || { echo "Failed to cd into lnbits ... FAIL"; exit 1; } - fi - - git checkout main - # Make data folder - mkdir data - - # Copy the .env.example to .env - cp .env.example .env - -elif [ ! -d lnbits/wallets ]; then - # cd into lnbits - cd lnbits || { echo "Failed to cd into lnbits ... FAIL"; exit 1; } +# Ensure basic tooling +if ! command -v curl >/dev/null 2>&1 || ! command -v git >/dev/null 2>&1; then + sudo apt-get update -y + sudo apt-get install -y curl git fi -# Install the dependencies using UV -uv sync --all-extras +# System build deps and secp headers +if command -v apt-get >/dev/null 2>&1; then + sudo apt-get update -y + sudo apt-get install -y \ + pkg-config \ + build-essential \ + libsecp256k1-dev \ + automake \ + autoconf \ + libtool \ + m4 +fi +# Install uv (if missing) +if ! command -v uv >/dev/null 2>&1; then + curl -LsSf https://astral.sh/uv/install.sh | sh + export PATH="$HOME/.local/bin:$PATH" +fi +# Ensure PATH for current session +if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then + export PATH="$HOME/.local/bin:$PATH" +fi -# Set environment variables for LNbits -export LNBITS_ADMIN_UI=true -export HOST=0.0.0.0 +# Clone or reuse repo +if [[ ! -d "$APP_DIR/.git" ]]; then + git clone "$REPO_URL" "$APP_DIR" +fi -# Run LNbits -uv run lnbits +cd "$APP_DIR" +git fetch --all --prune +git checkout "$BRANCH" +git pull --ff-only || true + +# First-run setup +mkdir -p data +[[ -f .env ]] || cp .env.example .env || true + +# Prefer system libsecp256k1 (avoid autotools path) +export SECP_BUNDLED=0 + +# Sync dependencies with Python 3.12 +uv sync --python 3.12 --all-extras --no-dev + +# Environment +export LNBITS_ADMIN_UI="$ADMIN_UI" +export HOST="$HOST" +export PORT="$PORT" + +# Open firewall (optional) +if command -v ufw >/dev/null 2>&1; then + sudo ufw allow "$PORT"/tcp || true +fi + +# Run LNbits with Python 3.12 via uv +exec uv run --python 3.12 lnbits