fix: add timeout to pmxcfs operations in install-sensor-proxy.sh
Reading and writing container config from /etc/pve/lxc/ can hang indefinitely if the Proxmox cluster filesystem (pmxcfs) is slow or unresponsive. This causes the installer to appear to hang after "Configuring socket bind mount..." with no further output. Add 10-second timeouts to both cp operations and provide helpful error messages suggesting the user check cluster health with 'pvecm status'. Related to #738
This commit is contained in:
parent
a3eb81778f
commit
a74e4d046a
1 changed files with 15 additions and 2 deletions
|
|
@ -3215,7 +3215,14 @@ if [[ "$STANDALONE" == false && "$CONTAINER_ON_THIS_NODE" == true ]]; then
|
|||
# Must use temp file and copy back to trigger cluster sync
|
||||
# Also, config file contains snapshots sections - only modify main section (before first [)
|
||||
TEMP_CONFIG=$(mktemp)
|
||||
cp "$LXC_CONFIG" "$TEMP_CONFIG"
|
||||
print_info "Reading container config from $LXC_CONFIG..."
|
||||
if ! timeout 10 cp "$LXC_CONFIG" "$TEMP_CONFIG" 2>/dev/null; then
|
||||
print_error "Timed out or failed reading container config from $LXC_CONFIG"
|
||||
print_error "The Proxmox cluster filesystem (pmxcfs) may be slow or unresponsive."
|
||||
print_error "Try: pvecm status # to check cluster health"
|
||||
rm -f "$TEMP_CONFIG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract line number where snapshots start (first line starting with [)
|
||||
SNAPSHOT_START=$(grep -n '^\[' "$TEMP_CONFIG" | head -1 | cut -d: -f1)
|
||||
|
|
@ -3256,7 +3263,13 @@ if [[ "$STANDALONE" == false && "$CONTAINER_ON_THIS_NODE" == true ]]; then
|
|||
|
||||
# Copy back to trigger pmxcfs sync
|
||||
if [[ "$MOUNT_UPDATED" = true ]]; then
|
||||
cp "$TEMP_CONFIG" "$LXC_CONFIG"
|
||||
print_info "Writing updated config to $LXC_CONFIG..."
|
||||
if ! timeout 10 cp "$TEMP_CONFIG" "$LXC_CONFIG" 2>/dev/null; then
|
||||
print_error "Timed out or failed writing container config to $LXC_CONFIG"
|
||||
print_error "The Proxmox cluster filesystem (pmxcfs) may be slow or unresponsive."
|
||||
rm -f "$TEMP_CONFIG"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
rm -f "$TEMP_CONFIG"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue