From bb1ec9e608e5bc766bdb5a4da5b91d069a1d9391 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Thu, 8 Oct 2026 15:13:16 +0200 Subject: [PATCH] Homarr: replace the musl better-sqlite3 that v2.3.0 ships for Debian (#17789) The build-debian tarballs of v2.3.0 carry the Alpine build of better_sqlite3.node, so the DB migration dies with ERR_DLOPEN_FAILED on libc.musl and Homarr no longer starts after an update (#17783, homarr-labs/homarr#7097). When the bundled module is musl, swap in better-sqlite3's own glibc prebuild for the running Node ABI. The update runs the check outside the release check, so containers already on 2.3.0 are repaired too; it does nothing once upstream ships a correct tarball. --- ct/homarr.sh | 12 ++++++++++++ install/homarr-install.sh | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/ct/homarr.sh b/ct/homarr.sh index 0be009037..c44f1945a 100644 --- a/ct/homarr.sh +++ b/ct/homarr.sh @@ -85,6 +85,18 @@ EOF msg_ok "Started Services" msg_ok "Updated successfully!" fi + # v2.3.0's Debian build ships a musl better-sqlite3 (homarr-labs/homarr#7097). + mapfile -t MUSL_MODULES < <(find /opt/homarr -name better_sqlite3.node -exec grep -aqE "ld-musl|libc\.musl" {} \; -print) + if ((${#MUSL_MODULES[@]})); then + msg_info "Replacing musl better-sqlite3 build" + BSQ_VERSION=$(jq -r .version /opt/homarr/node_modules/better-sqlite3/package.json) + curl_with_retry "https://github.com/WiseLibs/better-sqlite3/releases/download/v${BSQ_VERSION}/better-sqlite3-v${BSQ_VERSION}-node-v$(node -p process.versions.modules)-linux-$(arch_resolve "x64" "arm64").tar.gz" /tmp/better-sqlite3.tar.gz + tar -xzf /tmp/better-sqlite3.tar.gz -C /tmp build/Release/better_sqlite3.node + for module in "${MUSL_MODULES[@]}"; do cp /tmp/build/Release/better_sqlite3.node "$module"; done + rm -rf /tmp/better-sqlite3.tar.gz /tmp/build + systemctl restart homarr + msg_ok "Replaced musl better-sqlite3 build" + fi exit } diff --git a/install/homarr-install.sh b/install/homarr-install.sh index 108430fdc..12a4b6e36 100644 --- a/install/homarr-install.sh +++ b/install/homarr-install.sh @@ -25,6 +25,18 @@ NODE_VERSION=$(curl -s https://raw.githubusercontent.com/homarr-labs/homarr/dev/ setup_nodejs fetch_and_deploy_gh_release "homarr" "homarr-labs/homarr" "prebuild" "latest" "/opt/homarr" "build-debian-$(arch_resolve).tar.gz" +# v2.3.0's Debian build ships a musl better-sqlite3 (homarr-labs/homarr#7097). +mapfile -t MUSL_MODULES < <(find /opt/homarr -name better_sqlite3.node -exec grep -aqE "ld-musl|libc\.musl" {} \; -print) +if ((${#MUSL_MODULES[@]})); then + msg_info "Replacing musl better-sqlite3 build" + BSQ_VERSION=$(jq -r .version /opt/homarr/node_modules/better-sqlite3/package.json) + curl_with_retry "https://github.com/WiseLibs/better-sqlite3/releases/download/v${BSQ_VERSION}/better-sqlite3-v${BSQ_VERSION}-node-v$(node -p process.versions.modules)-linux-$(arch_resolve "x64" "arm64").tar.gz" /tmp/better-sqlite3.tar.gz + tar -xzf /tmp/better-sqlite3.tar.gz -C /tmp build/Release/better_sqlite3.node + for module in "${MUSL_MODULES[@]}"; do cp /tmp/build/Release/better_sqlite3.node "$module"; done + rm -rf /tmp/better-sqlite3.tar.gz /tmp/build + msg_ok "Replaced musl better-sqlite3 build" +fi + msg_info "Installing Homarr" mkdir -p /opt/homarr_db touch /opt/homarr_db/db.sqlite