From 804b93a4ff659e2e7f95578aab2aacb9b117199f Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Wed, 24 Dec 2025 18:03:13 +0100 Subject: [PATCH] fix: create tmp directories to prevent opkg lock file errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During firmware image creation, opkg tries to create a lock file in the staging root filesystem's /tmp directory, but this directory doesn't always exist, causing the build to fail at the final packaging stage. Error: opkg_conf_load: Could not create lock file .../root.orig-mvebu//tmp/opkg.lock: No such file or directory ERROR: target/linux failed to build Solution: - Create tmp directories in all staging root filesystems before build - Apply fix in both parallel and single-threaded build paths - Use wildcard patterns to catch all target architectures Changes: - local-build.sh: Create tmp dirs before and during retry - build-secubox-images.yml: Create tmp dirs in workflow - .gitignore: Ignore build artifacts (openwrt/, local-feed/, .vscode/) This ensures the build can complete the final image packaging step successfully, generating the firmware images. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/build-secubox-images.yml | 6 ++++++ .gitignore | 5 +++++ secubox-tools/local-build.sh | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/.github/workflows/build-secubox-images.yml b/.github/workflows/build-secubox-images.yml index 02f35a52..5f3aa77c 100644 --- a/.github/workflows/build-secubox-images.yml +++ b/.github/workflows/build-secubox-images.yml @@ -455,6 +455,9 @@ jobs: START_TIME=$(date +%s) + # Ensure staging directories exist to prevent opkg lock file errors + mkdir -p build_dir/target-*/root*/tmp 2>/dev/null || true + # Build with explicit profile specification to ensure images are generated if make -j$(nproc) PROFILE="${{ matrix.profile }}" V=s 2>&1 | tee build.log; then END_TIME=$(date +%s) @@ -483,6 +486,9 @@ jobs: echo "Retrying with -j1 (single thread) for better stability..." echo "" + # Ensure staging directories exist before retry + mkdir -p build_dir/target-*/root*/tmp 2>/dev/null || true + if make -j1 PROFILE="${{ matrix.profile }}" V=s 2>&1 | tee build-retry.log; then END_TIME=$(date +%s) DURATION=$((END_TIME - START_TIME)) diff --git a/.gitignore b/.gitignore index 9029242f..8cd00621 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,8 @@ secubox-tools/sdk/ secubox-tools/cache/ secubox-tools/build/ +secubox-tools/openwrt/ +secubox-tools/local-feed/ + +# IDE settings +.vscode/ diff --git a/secubox-tools/local-build.sh b/secubox-tools/local-build.sh index abf7d081..eec04315 100755 --- a/secubox-tools/local-build.sh +++ b/secubox-tools/local-build.sh @@ -1068,6 +1068,11 @@ build_firmware_image() { print_header "Compiling Firmware (This may take 1-2 hours)" echo "" + # Create necessary directories to avoid opkg lock file errors + # Find all root directories and ensure tmp subdirectories exist + find build_dir -type d -name "root.orig-*" -exec mkdir -p {}/tmp \; 2>/dev/null || true + find build_dir -type d -name "root-*" -exec mkdir -p {}/tmp \; 2>/dev/null || true + # Build with explicit PROFILE if make -j$(nproc) PROFILE="$FW_PROFILE" V=s 2>&1 | tee build.log; then local end_time=$(date +%s) @@ -1078,6 +1083,11 @@ build_firmware_image() { print_success "Build completed in ${minutes}m ${seconds}s" else print_error "Parallel build failed, retrying single-threaded..." + + # Ensure staging directories exist before retry + find build_dir -type d -name "root.orig-*" -exec mkdir -p {}/tmp \; 2>/dev/null || true + find build_dir -type d -name "root-*" -exec mkdir -p {}/tmp \; 2>/dev/null || true + if make -j1 PROFILE="$FW_PROFILE" V=s 2>&1 | tee build-retry.log; then local end_time=$(date +%s) local duration=$((end_time - start_time))