From 8e8261be317a22593ad10a5ffc4b824945ad9a14 Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Tue, 28 Jul 2026 23:42:36 +1000 Subject: [PATCH] fix(ha/cluster-init): drop bash -c wrapper for NODE2 drbdmeta calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drbdmeta is in /run/current-system/sw/bin which is already on sudo's PATH on the HA nodes; the bash -c wrapper with PATH manipulation was adding complexity without benefit and introduced quoting hazards that likely caused write-dev-uuid to fail or run in the wrong context. Use direct n2_ssh calls instead — the same pattern that works when tested manually on NODE2. Co-Authored-By: Claude Sonnet 4.6 --- scripts/ha/cluster-init.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/ha/cluster-init.sh b/scripts/ha/cluster-init.sh index d2aa74b..3528dcb 100755 --- a/scripts/ha/cluster-init.sh +++ b/scripts/ha/cluster-init.sh @@ -192,9 +192,8 @@ fi log "Initialising DRBD metadata on $NODE2..." if ! n2_ssh "drbdadm dstate ha-data 2>/dev/null | grep -q UpToDate" 2>/dev/null; then UUID2=$(n2_ssh "cat /proc/sys/kernel/random/uuid 2>/dev/null | tr -d '-' | cut -c1-16 | tr '[:lower:]' '[:upper:]'") - # PATH on NODE2 may not include drbdmeta when run via sudo; resolve via drbdadm's directory. - n2_ssh "bash -c 'export PATH=\"\$(dirname \"\$(command -v drbdadm)\"):\$PATH\"; drbdmeta --force 0 v08 /dev/sdb internal create-md'" - n2_ssh "bash -c 'export PATH=\"\$(dirname \"\$(command -v drbdadm)\"):\$PATH\"; drbdmeta --force 0 v08 /dev/sdb internal write-dev-uuid \"${UUID2}\"'" + n2_ssh "drbdmeta --force 0 v08 /dev/sdb internal create-md" + n2_ssh "drbdmeta --force 0 v08 /dev/sdb internal write-dev-uuid ${UUID2}" fi log "Bringing up DRBD on both nodes..."