mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
Fix/led panel permissions 224 (#226)
* fix(install): exclude rpi-rgb-led-matrix from permission normalization The permission normalization step in first_time_install.sh was running chmod 644 on all files, which stripped executable bits from compiled library files (librgbmatrix.so.1) after make build-python created them. This caused LED panels to not work after fresh installation until users manually ran chmod on the rpi-rgb-led-matrix-master directory. Fixes #224 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(install): resolve install script issues and speed up web UI startup Issues addressed: - Remove redundant python3-pillow from apt (Debian maps it to python3-pil) - Only upgrade pip, not setuptools/wheel (they conflict with apt versions) - Remove separate apt numpy install (pip handles it from requirements.txt) - Install web interface deps during first-time setup, not on every startup - Add marker file (.web_deps_installed) to skip redundant pip installs - Add user-friendly message about wait time after installation The web UI was taking 30-60+ seconds to start because it ran pip install on every startup. Now it only installs dependencies on first run. Fixes #208 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(install): prevent duplicate web dependency installation Step 7 was installing web dependencies again even though they were already installed in Step 5. Now Step 7 checks for the .web_deps_installed marker file and skips the installation if it already exists. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(install): only create web deps marker on successful install The .web_deps_installed marker file should only be created when pip install actually succeeds. Previously it was created regardless of the pip exit status, which could cause subsequent runs to skip installing missing dependencies. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(install): create config files before starting services The services were being started before config files existed, causing the web service to fail with "config.json not found". Reordered steps so config files are created (Step 4) before services are installed and started (Step 4.1). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(install): remove pip upgrade step (apt version is sufficient) The apt-installed pip cannot be upgraded because it doesn't have a RECORD file. Since the apt version (25.1.1) is already recent enough, we can skip the upgrade step entirely. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(install): reorder script to install services after dependencies Moved main LED Matrix service installation (Step 7.5) to after all Python dependencies are installed (Steps 5-7). Previously services were being started before pip packages and rgbmatrix were ready, causing startup failures. New order: - Step 5: Python pip dependencies - Step 6: rpi-rgb-led-matrix build - Step 7: Web interface dependencies - Step 7.5: Main LED Matrix service (moved here) - Step 8: Web interface service Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(install): update step list and fix setcap symlink handling - Updated step list header to match actual step order after reordering (Step 4 is now "Ensure configuration files exist", added Step 7.5 for main service, added Step 8.1 for systemd permissions) - Fixed Python capabilities configuration: - Check if setcap command exists before attempting to use it - Resolve symlinks with readlink -f to get the real binary path - Only print success message when setcap actually succeeds - Print clear warning with helpful info when setcap fails Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Chuck <chuck@example.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -220,11 +220,13 @@ echo "1. Install system dependencies"
|
||||
echo "2. Fix cache permissions"
|
||||
echo "3. Fix assets directory permissions"
|
||||
echo "3.1. Fix plugin directory permissions"
|
||||
echo "4. Install main LED Matrix service"
|
||||
echo "4. Ensure configuration files exist"
|
||||
echo "5. Install Python project dependencies (requirements.txt)"
|
||||
echo "6. Build and install rpi-rgb-led-matrix and test import"
|
||||
echo "7. Install web interface dependencies"
|
||||
echo "7.5. Install main LED Matrix service"
|
||||
echo "8. Install web interface service"
|
||||
echo "8.1. Harden systemd unit file permissions"
|
||||
echo "8.5. Install WiFi monitor service"
|
||||
echo "9. Configure web interface permissions"
|
||||
echo "10. Configure passwordless sudo access"
|
||||
@@ -511,43 +513,9 @@ find "$PLUGIN_REPOS_DIR" -type f -exec chmod 664 {} \;
|
||||
echo "✓ Plugin-repos directory permissions fixed"
|
||||
echo ""
|
||||
|
||||
CURRENT_STEP="Install main LED Matrix service"
|
||||
echo "Step 4: Installing main LED Matrix service..."
|
||||
echo "---------------------------------------------"
|
||||
|
||||
# Run the main service installation (idempotent)
|
||||
# Note: install_service.sh always overwrites the service file, so it will update paths automatically
|
||||
if [ -f "$PROJECT_ROOT_DIR/scripts/install/install_service.sh" ]; then
|
||||
echo "Running main service installation/update..."
|
||||
bash "$PROJECT_ROOT_DIR/scripts/install/install_service.sh"
|
||||
echo "✓ Main LED Matrix service installed/updated"
|
||||
else
|
||||
echo "✗ Main service installation script not found at $PROJECT_ROOT_DIR/scripts/install/install_service.sh"
|
||||
echo "Please ensure you are running this script from the project root: $PROJECT_ROOT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Configure Python capabilities for hardware timing
|
||||
echo "Configuring Python capabilities for hardware timing..."
|
||||
if [ -f "/usr/bin/python3.13" ]; then
|
||||
sudo setcap 'cap_sys_nice=eip' /usr/bin/python3.13 2>/dev/null || echo "⚠ Could not set cap_sys_nice on python3.13 (may need manual setup)"
|
||||
echo "✓ Python3.13 capabilities configured"
|
||||
elif [ -f "/usr/bin/python3" ]; then
|
||||
PYTHON_VER=$(python3 --version 2>&1 | grep -oP '(?<=Python )\d\.\d+' || echo "unknown")
|
||||
if command -v setcap >/dev/null 2>&1; then
|
||||
sudo setcap 'cap_sys_nice=eip' /usr/bin/python3 2>/dev/null || echo "⚠ Could not set cap_sys_nice on python3"
|
||||
echo "✓ Python3 capabilities configured (version: $PYTHON_VER)"
|
||||
else
|
||||
echo "⚠ setcap not found, skipping capability configuration"
|
||||
fi
|
||||
else
|
||||
echo "⚠ Python3 not found, skipping capability configuration"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
CURRENT_STEP="Ensure configuration files exist"
|
||||
echo "Step 4.1: Ensuring configuration files exist..."
|
||||
echo "------------------------------------------------"
|
||||
echo "Step 4: Ensuring configuration files exist..."
|
||||
echo "----------------------------------------------"
|
||||
|
||||
# Ensure config directory exists
|
||||
mkdir -p "$PROJECT_ROOT_DIR/config"
|
||||
@@ -666,16 +634,10 @@ cd "$PROJECT_ROOT_DIR"
|
||||
if [ -f "$PROJECT_ROOT_DIR/requirements.txt" ]; then
|
||||
echo "Reading requirements from: $PROJECT_ROOT_DIR/requirements.txt"
|
||||
|
||||
# Check pip version and upgrade if needed
|
||||
# Check pip version (apt-installed pip is sufficient, no upgrade needed)
|
||||
echo "Checking pip version..."
|
||||
python3 -m pip --version
|
||||
|
||||
# Upgrade pip for better compatibility (setuptools/wheel are already installed via apt)
|
||||
echo "Upgrading pip..."
|
||||
python3 -m pip install --break-system-packages --upgrade pip || {
|
||||
echo "⚠ Warning: Failed to upgrade pip, continuing anyway..."
|
||||
}
|
||||
|
||||
|
||||
# Count total packages for progress
|
||||
TOTAL_PACKAGES=$(grep -v '^#' "$PROJECT_ROOT_DIR/requirements.txt" | grep -v '^$' | wc -l)
|
||||
echo "Found $TOTAL_PACKAGES package(s) to install"
|
||||
@@ -935,6 +897,57 @@ else
|
||||
fi
|
||||
echo ""
|
||||
|
||||
CURRENT_STEP="Install main LED Matrix service"
|
||||
echo "Step 7.5: Installing main LED Matrix service..."
|
||||
echo "------------------------------------------------"
|
||||
|
||||
# Run the main service installation (idempotent)
|
||||
# Note: install_service.sh always overwrites the service file, so it will update paths automatically
|
||||
# This step runs AFTER all Python dependencies are installed (Steps 5-7)
|
||||
if [ -f "$PROJECT_ROOT_DIR/scripts/install/install_service.sh" ]; then
|
||||
echo "Running main service installation/update..."
|
||||
bash "$PROJECT_ROOT_DIR/scripts/install/install_service.sh"
|
||||
echo "✓ Main LED Matrix service installed/updated"
|
||||
else
|
||||
echo "✗ Main service installation script not found at $PROJECT_ROOT_DIR/scripts/install/install_service.sh"
|
||||
echo "Please ensure you are running this script from the project root: $PROJECT_ROOT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Configure Python capabilities for hardware timing
|
||||
echo "Configuring Python capabilities for hardware timing..."
|
||||
|
||||
# Check if setcap is available first
|
||||
if ! command -v setcap >/dev/null 2>&1; then
|
||||
echo "⚠ setcap not found, skipping capability configuration"
|
||||
echo " Install libcap2-bin if you need hardware timing capabilities"
|
||||
else
|
||||
# Find the Python binary and resolve symlinks to get the real binary
|
||||
PYTHON_BIN=""
|
||||
PYTHON_VER=""
|
||||
if [ -f "/usr/bin/python3.13" ]; then
|
||||
PYTHON_BIN=$(readlink -f /usr/bin/python3.13)
|
||||
PYTHON_VER="3.13"
|
||||
elif [ -f "/usr/bin/python3" ]; then
|
||||
PYTHON_BIN=$(readlink -f /usr/bin/python3)
|
||||
PYTHON_VER=$(python3 --version 2>&1 | grep -oP '(?<=Python )\d+\.\d+' || echo "unknown")
|
||||
fi
|
||||
|
||||
if [ -n "$PYTHON_BIN" ] && [ -f "$PYTHON_BIN" ]; then
|
||||
echo "Setting cap_sys_nice on $PYTHON_BIN (Python $PYTHON_VER)..."
|
||||
if sudo setcap 'cap_sys_nice=eip' "$PYTHON_BIN" 2>/dev/null; then
|
||||
echo "✓ Python $PYTHON_VER capabilities configured ($PYTHON_BIN)"
|
||||
else
|
||||
echo "⚠ Could not set cap_sys_nice on $PYTHON_BIN"
|
||||
echo " This may require manual setup or running as root"
|
||||
echo " The LED display may have timing issues without this capability"
|
||||
fi
|
||||
else
|
||||
echo "⚠ Python3 not found, skipping capability configuration"
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
|
||||
CURRENT_STEP="Install web interface service"
|
||||
echo "Step 8: Installing web interface service..."
|
||||
echo "-------------------------------------------"
|
||||
|
||||
Reference in New Issue
Block a user