mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-08-30 08:11:00 +02:00
fix: sync error_handler fallback, Alpine APK repair, retry limit
error_handler.func: - Sync fallback explain_exit_code() with api.func: add 25+ codes that were missing (curl 16/18/24/26/27/32-34/36/39/44-48/51/52/55/57/59/ 61/63/79/92/95, signals 125/129/131/132/144/146, npm 239, code 3/8) - Ensures consistent error descriptions even when api.func isn't loaded build.func: - Alpine APK repair: detect var_os=alpine and run 'apk fix && apk cache clean && apk update' instead of apt-get/dpkg commands - Show 'Repair APK state' instead of 'APT/DPKG' in menu for Alpine - Retry safety counter: OOM x2 retry limited to max 2 attempts (prevents infinite RAM doubling via RECOVERY_ATTEMPT env var) - Show attempt count in rebuild summary
This commit is contained in:
+36
-16
@@ -4262,17 +4262,26 @@ EOF'
|
|||||||
local APT_OPTION="" OOM_OPTION="" DNS_OPTION=""
|
local APT_OPTION="" OOM_OPTION="" DNS_OPTION=""
|
||||||
|
|
||||||
if [[ "$is_apt_issue" == true ]]; then
|
if [[ "$is_apt_issue" == true ]]; then
|
||||||
echo -e " ${GN}${next_option})${CL} Repair APT/DPKG state and re-run install (in-place)"
|
if [[ "$var_os" == "alpine" ]]; then
|
||||||
|
echo -e " ${GN}${next_option})${CL} Repair APK state and re-run install (in-place)"
|
||||||
|
else
|
||||||
|
echo -e " ${GN}${next_option})${CL} Repair APT/DPKG state and re-run install (in-place)"
|
||||||
|
fi
|
||||||
APT_OPTION=$next_option
|
APT_OPTION=$next_option
|
||||||
next_option=$((next_option + 1))
|
next_option=$((next_option + 1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$is_oom" == true ]]; then
|
if [[ "$is_oom" == true ]]; then
|
||||||
local new_ram=$((RAM_SIZE * 2))
|
local recovery_attempt="${RECOVERY_ATTEMPT:-0}"
|
||||||
local new_cpu=$((CORE_COUNT * 2))
|
if [[ $recovery_attempt -lt 2 ]]; then
|
||||||
echo -e " ${GN}${next_option})${CL} Retry with more resources (RAM: ${RAM_SIZE}→${new_ram} MiB, CPU: ${CORE_COUNT}→${new_cpu} cores)"
|
local new_ram=$((RAM_SIZE * 2))
|
||||||
OOM_OPTION=$next_option
|
local new_cpu=$((CORE_COUNT * 2))
|
||||||
next_option=$((next_option + 1))
|
echo -e " ${GN}${next_option})${CL} Retry with more resources (RAM: ${RAM_SIZE}→${new_ram} MiB, CPU: ${CORE_COUNT}→${new_cpu} cores)"
|
||||||
|
OOM_OPTION=$next_option
|
||||||
|
next_option=$((next_option + 1))
|
||||||
|
else
|
||||||
|
echo -e " ${DGN}-)${CL} ${DGN}OOM retry exhausted (already retried ${recovery_attempt}x)${CL}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$is_network_issue" == true ]]; then
|
if [[ "$is_network_issue" == true ]]; then
|
||||||
@@ -4340,16 +4349,26 @@ EOF'
|
|||||||
local handled=false
|
local handled=false
|
||||||
|
|
||||||
if [[ -n "${APT_OPTION}" && "${response}" == "${APT_OPTION}" ]]; then
|
if [[ -n "${APT_OPTION}" && "${response}" == "${APT_OPTION}" ]]; then
|
||||||
# APT/DPKG in-place repair: fix broken package state and re-run install script
|
# Package manager in-place repair: fix broken state and re-run install script
|
||||||
handled=true
|
handled=true
|
||||||
echo -e "\n${TAB}${HOLD}${YW}Repairing APT/DPKG state in container ${CTID}...${CL}"
|
if [[ "$var_os" == "alpine" ]]; then
|
||||||
pct exec "$CTID" -- bash -c "
|
echo -e "\n${TAB}${HOLD}${YW}Repairing APK state in container ${CTID}...${CL}"
|
||||||
DEBIAN_FRONTEND=noninteractive dpkg --configure -a 2>/dev/null || true
|
pct exec "$CTID" -- ash -c "
|
||||||
apt-get -f install -y 2>/dev/null || true
|
apk fix 2>/dev/null || true
|
||||||
apt-get clean 2>/dev/null
|
apk cache clean 2>/dev/null || true
|
||||||
apt-get update 2>/dev/null || true
|
apk update 2>/dev/null || true
|
||||||
" >/dev/null 2>&1 || true
|
" >/dev/null 2>&1 || true
|
||||||
echo -e "${BFR}${CM}${GN}APT/DPKG state repaired in container ${CTID}${CL}"
|
echo -e "${BFR}${CM}${GN}APK state repaired in container ${CTID}${CL}"
|
||||||
|
else
|
||||||
|
echo -e "\n${TAB}${HOLD}${YW}Repairing APT/DPKG state in container ${CTID}...${CL}"
|
||||||
|
pct exec "$CTID" -- bash -c "
|
||||||
|
DEBIAN_FRONTEND=noninteractive dpkg --configure -a 2>/dev/null || true
|
||||||
|
apt-get -f install -y 2>/dev/null || true
|
||||||
|
apt-get clean 2>/dev/null
|
||||||
|
apt-get update 2>/dev/null || true
|
||||||
|
" >/dev/null 2>&1 || true
|
||||||
|
echo -e "${BFR}${CM}${GN}APT/DPKG state repaired in container ${CTID}${CL}"
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
export VERBOSE="yes"
|
export VERBOSE="yes"
|
||||||
export var_verbose="yes"
|
export var_verbose="yes"
|
||||||
@@ -4410,8 +4429,9 @@ EOF'
|
|||||||
export var_cpu="$CORE_COUNT"
|
export var_cpu="$CORE_COUNT"
|
||||||
export VERBOSE="yes"
|
export VERBOSE="yes"
|
||||||
export var_verbose="yes"
|
export var_verbose="yes"
|
||||||
|
export RECOVERY_ATTEMPT=$(( ${RECOVERY_ATTEMPT:-0} + 1 ))
|
||||||
|
|
||||||
echo -e "${YW}Rebuilding with increased resources:${CL}"
|
echo -e "${YW}Rebuilding with increased resources (attempt ${RECOVERY_ATTEMPT}/2):${CL}"
|
||||||
echo -e " Container ID: ${old_ctid} → ${CTID}"
|
echo -e " Container ID: ${old_ctid} → ${CTID}"
|
||||||
echo -e " RAM: ${old_ram} → ${GN}${RAM_SIZE}${CL} MiB (x2)"
|
echo -e " RAM: ${old_ram} → ${GN}${RAM_SIZE}${CL} MiB (x2)"
|
||||||
echo -e " CPU: ${old_cpu} → ${GN}${CORE_COUNT}${CL} cores (x2)"
|
echo -e " CPU: ${old_cpu} → ${GN}${CORE_COUNT}${CL} cores (x2)"
|
||||||
|
|||||||
+35
-2
@@ -37,21 +37,47 @@ if ! declare -f explain_exit_code &>/dev/null; then
|
|||||||
case "$code" in
|
case "$code" in
|
||||||
1) echo "General error / Operation not permitted" ;;
|
1) echo "General error / Operation not permitted" ;;
|
||||||
2) echo "Misuse of shell builtins (e.g. syntax error)" ;;
|
2) echo "Misuse of shell builtins (e.g. syntax error)" ;;
|
||||||
|
3) echo "General syntax or argument error" ;;
|
||||||
10) echo "Docker / privileged mode required (unsupported environment)" ;;
|
10) echo "Docker / privileged mode required (unsupported environment)" ;;
|
||||||
4) echo "curl: Feature not supported or protocol error" ;;
|
4) echo "curl: Feature not supported or protocol error" ;;
|
||||||
5) echo "curl: Could not resolve proxy" ;;
|
5) echo "curl: Could not resolve proxy" ;;
|
||||||
6) echo "curl: DNS resolution failed (could not resolve host)" ;;
|
6) echo "curl: DNS resolution failed (could not resolve host)" ;;
|
||||||
7) echo "curl: Failed to connect (network unreachable / host down)" ;;
|
7) echo "curl: Failed to connect (network unreachable / host down)" ;;
|
||||||
8) echo "curl: FTP server reply error" ;;
|
8) echo "curl: Server reply error (FTP/SFTP or apk untrusted key)" ;;
|
||||||
|
16) echo "curl: HTTP/2 framing layer error" ;;
|
||||||
|
18) echo "curl: Partial file (transfer not completed)" ;;
|
||||||
22) echo "curl: HTTP error returned (404, 429, 500+)" ;;
|
22) echo "curl: HTTP error returned (404, 429, 500+)" ;;
|
||||||
23) echo "curl: Write error (disk full or permissions)" ;;
|
23) echo "curl: Write error (disk full or permissions)" ;;
|
||||||
|
24) echo "curl: Write to local file failed" ;;
|
||||||
25) echo "curl: Upload failed" ;;
|
25) echo "curl: Upload failed" ;;
|
||||||
|
26) echo "curl: Read error on local file (I/O)" ;;
|
||||||
|
27) echo "curl: Out of memory (memory allocation failed)" ;;
|
||||||
28) echo "curl: Operation timeout (network slow or server not responding)" ;;
|
28) echo "curl: Operation timeout (network slow or server not responding)" ;;
|
||||||
30) echo "curl: FTP port command failed" ;;
|
30) echo "curl: FTP port command failed" ;;
|
||||||
|
32) echo "curl: FTP SIZE command failed" ;;
|
||||||
|
33) echo "curl: HTTP range error" ;;
|
||||||
|
34) echo "curl: HTTP post error" ;;
|
||||||
35) echo "curl: SSL/TLS handshake failed (certificate error)" ;;
|
35) echo "curl: SSL/TLS handshake failed (certificate error)" ;;
|
||||||
|
36) echo "curl: FTP bad download resume" ;;
|
||||||
|
39) echo "curl: LDAP search failed" ;;
|
||||||
|
44) echo "curl: Internal error (bad function call order)" ;;
|
||||||
|
45) echo "curl: Interface error (failed to bind to specified interface)" ;;
|
||||||
|
46) echo "curl: Bad password entered" ;;
|
||||||
|
47) echo "curl: Too many redirects" ;;
|
||||||
|
48) echo "curl: Unknown command line option specified" ;;
|
||||||
|
51) echo "curl: SSL peer certificate or SSH host key verification failed" ;;
|
||||||
|
52) echo "curl: Empty reply from server (got nothing)" ;;
|
||||||
|
55) echo "curl: Failed sending network data" ;;
|
||||||
56) echo "curl: Receive error (connection reset by peer)" ;;
|
56) echo "curl: Receive error (connection reset by peer)" ;;
|
||||||
|
57) echo "curl: Unrecoverable poll/select error (system I/O failure)" ;;
|
||||||
|
59) echo "curl: Couldn't use specified SSL cipher" ;;
|
||||||
|
61) echo "curl: Bad/unrecognized transfer encoding" ;;
|
||||||
|
63) echo "curl: Maximum file size exceeded" ;;
|
||||||
75) echo "Temporary failure (retry later)" ;;
|
75) echo "Temporary failure (retry later)" ;;
|
||||||
78) echo "curl: Remote file not found (404 on FTP/file)" ;;
|
78) echo "curl: Remote file not found (404 on FTP/file)" ;;
|
||||||
|
79) echo "curl: SSH session error (key exchange/auth failed)" ;;
|
||||||
|
92) echo "curl: HTTP/2 stream error (protocol violation)" ;;
|
||||||
|
95) echo "curl: HTTP/3 layer error" ;;
|
||||||
64) echo "Usage error (wrong arguments)" ;;
|
64) echo "Usage error (wrong arguments)" ;;
|
||||||
65) echo "Data format error (bad input data)" ;;
|
65) echo "Data format error (bad input data)" ;;
|
||||||
66) echo "Input file not found (cannot open input)" ;;
|
66) echo "Input file not found (cannot open input)" ;;
|
||||||
@@ -69,15 +95,21 @@ if ! declare -f explain_exit_code &>/dev/null; then
|
|||||||
101) echo "APT: Configuration error (bad sources.list, malformed config)" ;;
|
101) echo "APT: Configuration error (bad sources.list, malformed config)" ;;
|
||||||
102) echo "APT: Lock held by another process (dpkg/apt still running)" ;;
|
102) echo "APT: Lock held by another process (dpkg/apt still running)" ;;
|
||||||
124) echo "Command timed out (timeout command)" ;;
|
124) echo "Command timed out (timeout command)" ;;
|
||||||
|
125) echo "Command failed to start (Docker daemon or execution error)" ;;
|
||||||
126) echo "Command invoked cannot execute (permission problem?)" ;;
|
126) echo "Command invoked cannot execute (permission problem?)" ;;
|
||||||
127) echo "Command not found" ;;
|
127) echo "Command not found" ;;
|
||||||
128) echo "Invalid argument to exit" ;;
|
128) echo "Invalid argument to exit" ;;
|
||||||
130) echo "Terminated by Ctrl+C (SIGINT)" ;;
|
129) echo "Killed by SIGHUP (terminal closed / hangup)" ;;
|
||||||
|
130) echo "Aborted by user (SIGINT)" ;;
|
||||||
|
131) echo "Killed by SIGQUIT (core dumped)" ;;
|
||||||
|
132) echo "Killed by SIGILL (illegal CPU instruction)" ;;
|
||||||
134) echo "Process aborted (SIGABRT - possibly Node.js heap overflow)" ;;
|
134) echo "Process aborted (SIGABRT - possibly Node.js heap overflow)" ;;
|
||||||
137) echo "Killed (SIGKILL / Out of memory?)" ;;
|
137) echo "Killed (SIGKILL / Out of memory?)" ;;
|
||||||
139) echo "Segmentation fault (core dumped)" ;;
|
139) echo "Segmentation fault (core dumped)" ;;
|
||||||
141) echo "Broken pipe (SIGPIPE - output closed prematurely)" ;;
|
141) echo "Broken pipe (SIGPIPE - output closed prematurely)" ;;
|
||||||
143) echo "Terminated (SIGTERM)" ;;
|
143) echo "Terminated (SIGTERM)" ;;
|
||||||
|
144) echo "Killed by signal 16 (SIGUSR1 / SIGSTKFLT)" ;;
|
||||||
|
146) echo "Killed by signal 18 (SIGTSTP)" ;;
|
||||||
150) echo "Systemd: Service failed to start" ;;
|
150) echo "Systemd: Service failed to start" ;;
|
||||||
151) echo "Systemd: Service unit not found" ;;
|
151) echo "Systemd: Service unit not found" ;;
|
||||||
152) echo "Permission denied (EACCES)" ;;
|
152) echo "Permission denied (EACCES)" ;;
|
||||||
@@ -123,6 +155,7 @@ if ! declare -f explain_exit_code &>/dev/null; then
|
|||||||
224) echo "Proxmox: PBS storage is for backups only" ;;
|
224) echo "Proxmox: PBS storage is for backups only" ;;
|
||||||
225) echo "Proxmox: No template available for OS/Version" ;;
|
225) echo "Proxmox: No template available for OS/Version" ;;
|
||||||
231) echo "Proxmox: LXC stack upgrade failed" ;;
|
231) echo "Proxmox: LXC stack upgrade failed" ;;
|
||||||
|
239) echo "npm/Node.js: Unexpected runtime error or dependency failure" ;;
|
||||||
243) echo "Node.js: Out of memory (JavaScript heap out of memory)" ;;
|
243) echo "Node.js: Out of memory (JavaScript heap out of memory)" ;;
|
||||||
245) echo "Node.js: Invalid command-line option" ;;
|
245) echo "Node.js: Invalid command-line option" ;;
|
||||||
246) echo "Node.js: Internal JavaScript Parse Error" ;;
|
246) echo "Node.js: Internal JavaScript Parse Error" ;;
|
||||||
|
|||||||
Reference in New Issue
Block a user