mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-05 12:53:27 +01:00
Compare commits
4 Commits
tools_func
...
feature/sm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28c19a79d3 | ||
|
|
8e4d5b1d28 | ||
|
|
e731b9fb65 | ||
|
|
93cb6f99fe |
145
misc/api.func
145
misc/api.func
@@ -36,14 +36,16 @@
|
|||||||
#
|
#
|
||||||
# - Maps numeric exit codes to human-readable error descriptions
|
# - Maps numeric exit codes to human-readable error descriptions
|
||||||
# - Supports:
|
# - Supports:
|
||||||
# * Generic/Shell errors (1, 2, 126, 127, 128, 130, 137, 139, 143)
|
# * Generic/Shell errors (1, 2, 124, 126-130, 134, 137, 139, 141, 143)
|
||||||
# * Package manager errors (APT, DPKG: 100, 101, 255)
|
# * curl/wget errors (6, 7, 22, 28, 35)
|
||||||
# * Node.js/npm errors (243-249, 254)
|
# * Package manager errors (APT, DPKG: 100-102, 255)
|
||||||
# * Python/pip/uv errors (210-212)
|
# * Systemd/Service errors (150-154)
|
||||||
# * PostgreSQL errors (231-234)
|
# * Python/pip/uv errors (160-162)
|
||||||
# * MySQL/MariaDB errors (241-244)
|
# * PostgreSQL errors (170-173)
|
||||||
# * MongoDB errors (251-254)
|
# * MySQL/MariaDB errors (180-183)
|
||||||
|
# * MongoDB errors (190-193)
|
||||||
# * Proxmox custom codes (200-231)
|
# * Proxmox custom codes (200-231)
|
||||||
|
# * Node.js/npm errors (243, 245-249)
|
||||||
# - Returns description string for given exit code
|
# - Returns description string for given exit code
|
||||||
# - Shared function with error_handler.func for consistency
|
# - Shared function with error_handler.func for consistency
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
@@ -53,73 +55,98 @@ explain_exit_code() {
|
|||||||
# --- Generic / Shell ---
|
# --- Generic / Shell ---
|
||||||
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)" ;;
|
||||||
|
|
||||||
|
# --- curl / wget errors (commonly seen in downloads) ---
|
||||||
|
6) echo "curl: DNS resolution failed (could not resolve host)" ;;
|
||||||
|
7) echo "curl: Failed to connect (network unreachable / host down)" ;;
|
||||||
|
22) echo "curl: HTTP error returned (404, 429, 500+)" ;;
|
||||||
|
28) echo "curl: Operation timeout (network slow or server not responding)" ;;
|
||||||
|
35) echo "curl: SSL/TLS handshake failed (certificate error)" ;;
|
||||||
|
|
||||||
|
# --- Package manager / APT / DPKG ---
|
||||||
|
100) echo "APT: Package manager error (broken packages / dependency problems)" ;;
|
||||||
|
101) echo "APT: Configuration error (bad sources.list, malformed config)" ;;
|
||||||
|
102) echo "APT: Lock held by another process (dpkg/apt still running)" ;;
|
||||||
|
|
||||||
|
# --- Common shell/system errors ---
|
||||||
|
124) echo "Command timed out (timeout command)" ;;
|
||||||
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)" ;;
|
130) echo "Terminated by Ctrl+C (SIGINT)" ;;
|
||||||
|
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)" ;;
|
||||||
143) echo "Terminated (SIGTERM)" ;;
|
143) echo "Terminated (SIGTERM)" ;;
|
||||||
|
|
||||||
# --- Package manager / APT / DPKG ---
|
# --- Systemd / Service errors (150-154) ---
|
||||||
100) echo "APT: Package manager error (broken packages / dependency problems)" ;;
|
150) echo "Systemd: Service failed to start" ;;
|
||||||
101) echo "APT: Configuration error (bad sources.list, malformed config)" ;;
|
151) echo "Systemd: Service unit not found" ;;
|
||||||
255) echo "DPKG: Fatal internal error" ;;
|
152) echo "Permission denied (EACCES)" ;;
|
||||||
|
153) echo "Build/compile failed (make/gcc/cmake)" ;;
|
||||||
|
154) echo "Node.js: Native addon build failed (node-gyp)" ;;
|
||||||
|
|
||||||
# --- Node.js / npm / pnpm / yarn ---
|
# --- Python / pip / uv (160-162) ---
|
||||||
|
160) echo "Python: Virtualenv / uv environment missing or broken" ;;
|
||||||
|
161) echo "Python: Dependency resolution failed" ;;
|
||||||
|
162) echo "Python: Installation aborted (permissions or EXTERNALLY-MANAGED)" ;;
|
||||||
|
|
||||||
|
# --- PostgreSQL (170-173) ---
|
||||||
|
170) echo "PostgreSQL: Connection failed (server not running / wrong socket)" ;;
|
||||||
|
171) echo "PostgreSQL: Authentication failed (bad user/password)" ;;
|
||||||
|
172) echo "PostgreSQL: Database does not exist" ;;
|
||||||
|
173) echo "PostgreSQL: Fatal error in query / syntax" ;;
|
||||||
|
|
||||||
|
# --- MySQL / MariaDB (180-183) ---
|
||||||
|
180) echo "MySQL/MariaDB: Connection failed (server not running / wrong socket)" ;;
|
||||||
|
181) echo "MySQL/MariaDB: Authentication failed (bad user/password)" ;;
|
||||||
|
182) echo "MySQL/MariaDB: Database does not exist" ;;
|
||||||
|
183) echo "MySQL/MariaDB: Fatal error in query / syntax" ;;
|
||||||
|
|
||||||
|
# --- MongoDB (190-193) ---
|
||||||
|
190) echo "MongoDB: Connection failed (server not running)" ;;
|
||||||
|
191) echo "MongoDB: Authentication failed (bad user/password)" ;;
|
||||||
|
192) echo "MongoDB: Database not found" ;;
|
||||||
|
193) echo "MongoDB: Fatal query error" ;;
|
||||||
|
|
||||||
|
# --- Proxmox Custom Codes (200-231) ---
|
||||||
|
200) echo "Proxmox: Failed to create lock file" ;;
|
||||||
|
203) echo "Proxmox: Missing CTID variable" ;;
|
||||||
|
204) echo "Proxmox: Missing PCT_OSTYPE variable" ;;
|
||||||
|
205) echo "Proxmox: Invalid CTID (<100)" ;;
|
||||||
|
206) echo "Proxmox: CTID already in use" ;;
|
||||||
|
207) echo "Proxmox: Password contains unescaped special characters" ;;
|
||||||
|
208) echo "Proxmox: Invalid configuration (DNS/MAC/Network format)" ;;
|
||||||
|
209) echo "Proxmox: Container creation failed" ;;
|
||||||
|
210) echo "Proxmox: Cluster not quorate" ;;
|
||||||
|
211) echo "Proxmox: Timeout waiting for template lock" ;;
|
||||||
|
212) echo "Proxmox: Storage type 'iscsidirect' does not support containers (VMs only)" ;;
|
||||||
|
213) echo "Proxmox: Storage type does not support 'rootdir' content" ;;
|
||||||
|
214) echo "Proxmox: Not enough storage space" ;;
|
||||||
|
215) echo "Proxmox: Container created but not listed (ghost state)" ;;
|
||||||
|
216) echo "Proxmox: RootFS entry missing in config" ;;
|
||||||
|
217) echo "Proxmox: Storage not accessible" ;;
|
||||||
|
218) echo "Proxmox: Template file corrupted or incomplete" ;;
|
||||||
|
219) echo "Proxmox: CephFS does not support containers - use RBD" ;;
|
||||||
|
220) echo "Proxmox: Unable to resolve template path" ;;
|
||||||
|
221) echo "Proxmox: Template file not readable" ;;
|
||||||
|
222) echo "Proxmox: Template download failed" ;;
|
||||||
|
223) echo "Proxmox: Template not available after download" ;;
|
||||||
|
224) echo "Proxmox: PBS storage is for backups only" ;;
|
||||||
|
225) echo "Proxmox: No template available for OS/Version" ;;
|
||||||
|
231) echo "Proxmox: LXC stack upgrade failed" ;;
|
||||||
|
|
||||||
|
# --- Node.js / npm / pnpm / yarn (243-249) ---
|
||||||
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" ;;
|
||||||
247) echo "Node.js: Fatal internal error" ;;
|
247) echo "Node.js: Fatal internal error" ;;
|
||||||
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
||||||
249) echo "Node.js: Inspector error" ;;
|
249) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
||||||
254) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
|
||||||
|
|
||||||
# --- Python / pip / uv ---
|
# --- DPKG ---
|
||||||
210) echo "Python: Virtualenv / uv environment missing or broken" ;;
|
255) echo "DPKG: Fatal internal error" ;;
|
||||||
211) echo "Python: Dependency resolution failed" ;;
|
|
||||||
212) echo "Python: Installation aborted (permissions or EXTERNALLY-MANAGED)" ;;
|
|
||||||
|
|
||||||
# --- PostgreSQL ---
|
|
||||||
231) echo "PostgreSQL: Connection failed (server not running / wrong socket)" ;;
|
|
||||||
232) echo "PostgreSQL: Authentication failed (bad user/password)" ;;
|
|
||||||
233) echo "PostgreSQL: Database does not exist" ;;
|
|
||||||
234) echo "PostgreSQL: Fatal error in query / syntax" ;;
|
|
||||||
|
|
||||||
# --- MySQL / MariaDB ---
|
|
||||||
241) echo "MySQL/MariaDB: Connection failed (server not running / wrong socket)" ;;
|
|
||||||
242) echo "MySQL/MariaDB: Authentication failed (bad user/password)" ;;
|
|
||||||
243) echo "MySQL/MariaDB: Database does not exist" ;;
|
|
||||||
244) echo "MySQL/MariaDB: Fatal error in query / syntax" ;;
|
|
||||||
|
|
||||||
# --- MongoDB ---
|
|
||||||
251) echo "MongoDB: Connection failed (server not running)" ;;
|
|
||||||
252) echo "MongoDB: Authentication failed (bad user/password)" ;;
|
|
||||||
253) echo "MongoDB: Database not found" ;;
|
|
||||||
254) echo "MongoDB: Fatal query error" ;;
|
|
||||||
|
|
||||||
# --- Proxmox Custom Codes ---
|
|
||||||
200) echo "Custom: Failed to create lock file" ;;
|
|
||||||
203) echo "Custom: Missing CTID variable" ;;
|
|
||||||
204) echo "Custom: Missing PCT_OSTYPE variable" ;;
|
|
||||||
205) echo "Custom: Invalid CTID (<100)" ;;
|
|
||||||
206) echo "Custom: CTID already in use (check 'pct list' and /etc/pve/lxc/)" ;;
|
|
||||||
207) echo "Custom: Password contains unescaped special characters (-, /, \\, *, etc.)" ;;
|
|
||||||
208) echo "Custom: Invalid configuration (DNS/MAC/Network format error)" ;;
|
|
||||||
209) echo "Custom: Container creation failed (check logs for pct create output)" ;;
|
|
||||||
210) echo "Custom: Cluster not quorate" ;;
|
|
||||||
211) echo "Custom: Timeout waiting for template lock (concurrent download in progress)" ;;
|
|
||||||
214) echo "Custom: Not enough storage space" ;;
|
|
||||||
215) echo "Custom: Container created but not listed (ghost state - check /etc/pve/lxc/)" ;;
|
|
||||||
216) echo "Custom: RootFS entry missing in config (incomplete creation)" ;;
|
|
||||||
217) echo "Custom: Storage does not support rootdir (check storage capabilities)" ;;
|
|
||||||
218) echo "Custom: Template file corrupted or incomplete download (size <1MB or invalid archive)" ;;
|
|
||||||
220) echo "Custom: Unable to resolve template path" ;;
|
|
||||||
221) echo "Custom: Template file exists but not readable (check file permissions)" ;;
|
|
||||||
222) echo "Custom: Template download failed after 3 attempts (network/storage issue)" ;;
|
|
||||||
223) echo "Custom: Template not available after download (storage sync issue)" ;;
|
|
||||||
225) echo "Custom: No template available for OS/Version (check 'pveam available')" ;;
|
|
||||||
231) echo "Custom: LXC stack upgrade/retry failed (outdated pve-container - check https://github.com/community-scripts/ProxmoxVE/discussions/8126)" ;;
|
|
||||||
|
|
||||||
# --- Default ---
|
# --- Default ---
|
||||||
*) echo "Unknown error" ;;
|
*) echo "Unknown error" ;;
|
||||||
|
|||||||
139
misc/build.func
139
misc/build.func
@@ -3970,30 +3970,127 @@ EOF'
|
|||||||
|
|
||||||
# Prompt user for cleanup with 60s timeout (plain echo - no msg_info to avoid spinner)
|
# Prompt user for cleanup with 60s timeout (plain echo - no msg_info to avoid spinner)
|
||||||
echo ""
|
echo ""
|
||||||
echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}"
|
|
||||||
|
# Detect error type for smart recovery options
|
||||||
|
local is_oom=false
|
||||||
|
local error_explanation=""
|
||||||
|
if declare -f explain_exit_code >/dev/null 2>&1; then
|
||||||
|
error_explanation="$(explain_exit_code "$install_exit_code")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OOM detection: exit codes 134 (SIGABRT/heap), 137 (SIGKILL/OOM), 243 (Node.js heap)
|
||||||
|
if [[ $install_exit_code -eq 134 || $install_exit_code -eq 137 || $install_exit_code -eq 243 ]]; then
|
||||||
|
is_oom=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Show error explanation if available
|
||||||
|
if [[ -n "$error_explanation" ]]; then
|
||||||
|
echo -e "${TAB}${RD}Error: ${error_explanation}${CL}"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build recovery menu based on error type
|
||||||
|
echo -e "${YW}What would you like to do?${CL}"
|
||||||
|
echo ""
|
||||||
|
echo -e " ${GN}1)${CL} Remove container and exit"
|
||||||
|
echo -e " ${GN}2)${CL} Keep container for debugging"
|
||||||
|
echo -e " ${GN}3)${CL} Retry with verbose mode"
|
||||||
|
if [[ "$is_oom" == true ]]; then
|
||||||
|
local new_ram=$((RAM_SIZE * 3 / 2))
|
||||||
|
local new_cpu=$((CORE_COUNT + 1))
|
||||||
|
echo -e " ${GN}4)${CL} Retry with more resources (RAM: ${RAM_SIZE}→${new_ram} MiB, CPU: ${CORE_COUNT}→${new_cpu} cores)"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo -en "${YW}Select option [1-$([[ "$is_oom" == true ]] && echo "4" || echo "3")] (default: 1, auto-remove in 60s): ${CL}"
|
||||||
|
|
||||||
if read -t 60 -r response; then
|
if read -t 60 -r response; then
|
||||||
if [[ -z "$response" || "$response" =~ ^[Yy]$ ]]; then
|
case "${response:-1}" in
|
||||||
# Remove container
|
1)
|
||||||
echo -e "\n${TAB}${HOLD}${YW}Removing container ${CTID}${CL}"
|
# Remove container
|
||||||
pct stop "$CTID" &>/dev/null || true
|
echo -e "\n${TAB}${HOLD}${YW}Removing container ${CTID}${CL}"
|
||||||
pct destroy "$CTID" &>/dev/null || true
|
pct stop "$CTID" &>/dev/null || true
|
||||||
echo -e "${BFR}${CM}${GN}Container ${CTID} removed${CL}"
|
pct destroy "$CTID" &>/dev/null || true
|
||||||
elif [[ "$response" =~ ^[Nn]$ ]]; then
|
echo -e "${BFR}${CM}${GN}Container ${CTID} removed${CL}"
|
||||||
echo -e "\n${TAB}${YW}Container ${CTID} kept for debugging${CL}"
|
;;
|
||||||
|
2)
|
||||||
# Dev mode: Setup MOTD/SSH for debugging access to broken container
|
echo -e "\n${TAB}${YW}Container ${CTID} kept for debugging${CL}"
|
||||||
if [[ "${DEV_MODE_MOTD:-false}" == "true" ]]; then
|
# Dev mode: Setup MOTD/SSH for debugging access to broken container
|
||||||
echo -e "${TAB}${HOLD}${DGN}Setting up MOTD and SSH for debugging...${CL}"
|
if [[ "${DEV_MODE_MOTD:-false}" == "true" ]]; then
|
||||||
if pct exec "$CTID" -- bash -c "
|
echo -e "${TAB}${HOLD}${DGN}Setting up MOTD and SSH for debugging...${CL}"
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)
|
if pct exec "$CTID" -- bash -c "
|
||||||
declare -f motd_ssh >/dev/null 2>&1 && motd_ssh || true
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)
|
||||||
" >/dev/null 2>&1; then
|
declare -f motd_ssh >/dev/null 2>&1 && motd_ssh || true
|
||||||
local ct_ip=$(pct exec "$CTID" ip a s dev eth0 2>/dev/null | awk '/inet / {print $2}' | cut -d/ -f1)
|
" >/dev/null 2>&1; then
|
||||||
echo -e "${BFR}${CM}${GN}MOTD/SSH ready - SSH into container: ssh root@${ct_ip}${CL}"
|
local ct_ip=$(pct exec "$CTID" ip a s dev eth0 2>/dev/null | awk '/inet / {print $2}' | cut -d/ -f1)
|
||||||
|
echo -e "${BFR}${CM}${GN}MOTD/SSH ready - SSH into container: ssh root@${ct_ip}${CL}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
exit $install_exit_code
|
||||||
fi
|
;;
|
||||||
|
3)
|
||||||
|
# Retry with verbose mode
|
||||||
|
echo -e "\n${TAB}${HOLD}${YW}Removing container ${CTID} for rebuild...${CL}"
|
||||||
|
pct stop "$CTID" &>/dev/null || true
|
||||||
|
pct destroy "$CTID" &>/dev/null || true
|
||||||
|
echo -e "${BFR}${CM}${GN}Container ${CTID} removed${CL}"
|
||||||
|
echo ""
|
||||||
|
# Get new container ID
|
||||||
|
local old_ctid="$CTID"
|
||||||
|
export CTID=$(get_valid_container_id "$CTID")
|
||||||
|
export VERBOSE="yes"
|
||||||
|
export var_verbose="yes"
|
||||||
|
|
||||||
|
# Show rebuild summary
|
||||||
|
echo -e "${YW}Rebuilding with preserved settings:${CL}"
|
||||||
|
echo -e " Container ID: ${old_ctid} → ${CTID}"
|
||||||
|
echo -e " RAM: ${RAM_SIZE} MiB | CPU: ${CORE_COUNT} cores | Disk: ${DISK_SIZE} GB"
|
||||||
|
echo -e " Network: ${NET:-dhcp} | Bridge: ${BRG:-vmbr0}"
|
||||||
|
echo -e " Verbose: ${GN}enabled${CL}"
|
||||||
|
echo ""
|
||||||
|
msg_info "Restarting installation..."
|
||||||
|
# Re-run build_container
|
||||||
|
build_container
|
||||||
|
return $?
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
if [[ "$is_oom" == true ]]; then
|
||||||
|
# Retry with more resources
|
||||||
|
echo -e "\n${TAB}${HOLD}${YW}Removing container ${CTID} for rebuild with more resources...${CL}"
|
||||||
|
pct stop "$CTID" &>/dev/null || true
|
||||||
|
pct destroy "$CTID" &>/dev/null || true
|
||||||
|
echo -e "${BFR}${CM}${GN}Container ${CTID} removed${CL}"
|
||||||
|
echo ""
|
||||||
|
# Get new container ID and increase resources
|
||||||
|
local old_ctid="$CTID"
|
||||||
|
local old_ram="$RAM_SIZE"
|
||||||
|
local old_cpu="$CORE_COUNT"
|
||||||
|
export CTID=$(get_valid_container_id "$CTID")
|
||||||
|
export RAM_SIZE=$((RAM_SIZE * 3 / 2))
|
||||||
|
export CORE_COUNT=$((CORE_COUNT + 1))
|
||||||
|
export var_ram="$RAM_SIZE"
|
||||||
|
export var_cpu="$CORE_COUNT"
|
||||||
|
|
||||||
|
# Show rebuild summary
|
||||||
|
echo -e "${YW}Rebuilding with increased resources:${CL}"
|
||||||
|
echo -e " Container ID: ${old_ctid} → ${CTID}"
|
||||||
|
echo -e " RAM: ${old_ram} → ${GN}${RAM_SIZE}${CL} MiB (+50%)"
|
||||||
|
echo -e " CPU: ${old_cpu} → ${GN}${CORE_COUNT}${CL} cores (+1)"
|
||||||
|
echo -e " Disk: ${DISK_SIZE} GB | Network: ${NET:-dhcp} | Bridge: ${BRG:-vmbr0}"
|
||||||
|
echo ""
|
||||||
|
msg_info "Restarting installation..."
|
||||||
|
# Re-run build_container
|
||||||
|
build_container
|
||||||
|
return $?
|
||||||
|
else
|
||||||
|
echo -e "\n${TAB}${YW}Invalid option. Container ${CTID} kept.${CL}"
|
||||||
|
exit $install_exit_code
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "\n${TAB}${YW}Invalid option. Container ${CTID} kept.${CL}"
|
||||||
|
exit $install_exit_code
|
||||||
|
;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
# Timeout - auto-remove
|
# Timeout - auto-remove
|
||||||
echo -e "\n${YW}No response - auto-removing container${CL}"
|
echo -e "\n${YW}No response - auto-removing container${CL}"
|
||||||
|
|||||||
@@ -29,15 +29,18 @@
|
|||||||
#
|
#
|
||||||
# - Maps numeric exit codes to human-readable error descriptions
|
# - Maps numeric exit codes to human-readable error descriptions
|
||||||
# - Supports:
|
# - Supports:
|
||||||
# * Generic/Shell errors (1, 2, 126, 127, 128, 130, 137, 139, 143)
|
# * Generic/Shell errors (1, 2, 124, 126-130, 134, 137, 139, 141, 143)
|
||||||
# * Package manager errors (APT, DPKG: 100, 101, 255)
|
# * curl/wget errors (6, 7, 22, 28, 35)
|
||||||
# * Node.js/npm errors (243-249, 254)
|
# * Package manager errors (APT, DPKG: 100-102, 255)
|
||||||
# * Python/pip/uv errors (210-212)
|
# * Systemd/Service errors (150-154)
|
||||||
# * PostgreSQL errors (231-234)
|
# * Python/pip/uv errors (160-162)
|
||||||
# * MySQL/MariaDB errors (241-244)
|
# * PostgreSQL errors (170-173)
|
||||||
# * MongoDB errors (251-254)
|
# * MySQL/MariaDB errors (180-183)
|
||||||
|
# * MongoDB errors (190-193)
|
||||||
# * Proxmox custom codes (200-231)
|
# * Proxmox custom codes (200-231)
|
||||||
|
# * Node.js/npm errors (243-249)
|
||||||
# - Returns description string for given exit code
|
# - Returns description string for given exit code
|
||||||
|
# - Shared function with api.func for consistency
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
explain_exit_code() {
|
explain_exit_code() {
|
||||||
local code="$1"
|
local code="$1"
|
||||||
@@ -45,52 +48,64 @@ explain_exit_code() {
|
|||||||
# --- Generic / Shell ---
|
# --- Generic / Shell ---
|
||||||
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)" ;;
|
||||||
|
6) echo "curl: DNS resolution failed (could not resolve host)" ;;
|
||||||
|
7) echo "curl: Failed to connect (network unreachable / host down)" ;;
|
||||||
|
22) echo "curl: HTTP error returned (404, 429, 500+)" ;;
|
||||||
|
28) echo "curl: Operation timeout (network slow or server not responding)" ;;
|
||||||
|
35) echo "curl: SSL/TLS handshake failed (certificate error)" ;;
|
||||||
|
100) echo "APT: Package manager error (broken packages / dependency problems)" ;;
|
||||||
|
101) echo "APT: Configuration error (bad sources.list, malformed config)" ;;
|
||||||
|
102) echo "APT: Lock held by another process (dpkg/apt still running)" ;;
|
||||||
|
124) echo "Command timed out (timeout command)" ;;
|
||||||
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)" ;;
|
130) echo "Terminated by Ctrl+C (SIGINT)" ;;
|
||||||
|
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)" ;;
|
||||||
143) echo "Terminated (SIGTERM)" ;;
|
143) echo "Terminated (SIGTERM)" ;;
|
||||||
|
|
||||||
# --- Package manager / APT / DPKG ---
|
# --- Systemd / Service errors (150-154) ---
|
||||||
100) echo "APT: Package manager error (broken packages / dependency problems)" ;;
|
150) echo "Systemd: Service failed to start" ;;
|
||||||
101) echo "APT: Configuration error (bad sources.list, malformed config)" ;;
|
151) echo "Systemd: Service unit not found" ;;
|
||||||
255) echo "DPKG: Fatal internal error" ;;
|
152) echo "Permission denied (EACCES)" ;;
|
||||||
|
153) echo "Build/compile failed (make/gcc/cmake)" ;;
|
||||||
|
154) echo "Node.js: Native addon build failed (node-gyp)" ;;
|
||||||
|
|
||||||
# --- Node.js / npm / pnpm / yarn ---
|
# --- Node.js / npm / pnpm / yarn (243-249) ---
|
||||||
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" ;;
|
||||||
247) echo "Node.js: Fatal internal error" ;;
|
247) echo "Node.js: Fatal internal error" ;;
|
||||||
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
||||||
249) echo "Node.js: Inspector error" ;;
|
249) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
||||||
254) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
|
||||||
|
|
||||||
# --- Python / pip / uv ---
|
# --- Python / pip / uv (160-162) ---
|
||||||
210) echo "Python: Virtualenv / uv environment missing or broken" ;;
|
160) echo "Python: Virtualenv / uv environment missing or broken" ;;
|
||||||
211) echo "Python: Dependency resolution failed" ;;
|
161) echo "Python: Dependency resolution failed" ;;
|
||||||
212) echo "Python: Installation aborted (permissions or EXTERNALLY-MANAGED)" ;;
|
162) echo "Python: Installation aborted (permissions or EXTERNALLY-MANAGED)" ;;
|
||||||
|
|
||||||
# --- PostgreSQL ---
|
# --- PostgreSQL (170-174) ---
|
||||||
231) echo "PostgreSQL: Connection failed (server not running / wrong socket)" ;;
|
170) echo "PostgreSQL: Connection failed (server not running / wrong socket)" ;;
|
||||||
232) echo "PostgreSQL: Authentication failed (bad user/password)" ;;
|
171) echo "PostgreSQL: Authentication failed (bad user/password)" ;;
|
||||||
233) echo "PostgreSQL: Database does not exist" ;;
|
172) echo "PostgreSQL: Database does not exist" ;;
|
||||||
234) echo "PostgreSQL: Fatal error in query / syntax" ;;
|
173) echo "PostgreSQL: Fatal error in query / syntax" ;;
|
||||||
|
|
||||||
# --- MySQL / MariaDB ---
|
# --- MySQL / MariaDB (180-183) ---
|
||||||
241) echo "MySQL/MariaDB: Connection failed (server not running / wrong socket)" ;;
|
180) echo "MySQL/MariaDB: Connection failed (server not running / wrong socket)" ;;
|
||||||
242) echo "MySQL/MariaDB: Authentication failed (bad user/password)" ;;
|
181) echo "MySQL/MariaDB: Authentication failed (bad user/password)" ;;
|
||||||
243) echo "MySQL/MariaDB: Database does not exist" ;;
|
182) echo "MySQL/MariaDB: Database does not exist" ;;
|
||||||
244) echo "MySQL/MariaDB: Fatal error in query / syntax" ;;
|
183) echo "MySQL/MariaDB: Fatal error in query / syntax" ;;
|
||||||
|
|
||||||
# --- MongoDB ---
|
# --- MongoDB (190-193) ---
|
||||||
251) echo "MongoDB: Connection failed (server not running)" ;;
|
190) echo "MongoDB: Connection failed (server not running)" ;;
|
||||||
252) echo "MongoDB: Authentication failed (bad user/password)" ;;
|
191) echo "MongoDB: Authentication failed (bad user/password)" ;;
|
||||||
253) echo "MongoDB: Database not found" ;;
|
192) echo "MongoDB: Database not found" ;;
|
||||||
254) echo "MongoDB: Fatal query error" ;;
|
193) echo "MongoDB: Fatal query error" ;;
|
||||||
|
|
||||||
# --- Proxmox Custom Codes ---
|
# --- Proxmox Custom Codes (200-231) ---
|
||||||
200) echo "Proxmox: Failed to create lock file" ;;
|
200) echo "Proxmox: Failed to create lock file" ;;
|
||||||
203) echo "Proxmox: Missing CTID variable" ;;
|
203) echo "Proxmox: Missing CTID variable" ;;
|
||||||
204) echo "Proxmox: Missing PCT_OSTYPE variable" ;;
|
204) echo "Proxmox: Missing PCT_OSTYPE variable" ;;
|
||||||
@@ -107,16 +122,19 @@ explain_exit_code() {
|
|||||||
215) echo "Proxmox: Container created but not listed (ghost state)" ;;
|
215) echo "Proxmox: Container created but not listed (ghost state)" ;;
|
||||||
216) echo "Proxmox: RootFS entry missing in config" ;;
|
216) echo "Proxmox: RootFS entry missing in config" ;;
|
||||||
217) echo "Proxmox: Storage not accessible" ;;
|
217) echo "Proxmox: Storage not accessible" ;;
|
||||||
219) echo "Proxmox: CephFS does not support containers - use RBD" ;;
|
|
||||||
224) echo "Proxmox: PBS storage is for backups only" ;;
|
|
||||||
218) echo "Proxmox: Template file corrupted or incomplete" ;;
|
218) echo "Proxmox: Template file corrupted or incomplete" ;;
|
||||||
|
219) echo "Proxmox: CephFS does not support containers - use RBD" ;;
|
||||||
220) echo "Proxmox: Unable to resolve template path" ;;
|
220) echo "Proxmox: Unable to resolve template path" ;;
|
||||||
221) echo "Proxmox: Template file not readable" ;;
|
221) echo "Proxmox: Template file not readable" ;;
|
||||||
222) echo "Proxmox: Template download failed" ;;
|
222) echo "Proxmox: Template download failed" ;;
|
||||||
223) echo "Proxmox: Template not available after download" ;;
|
223) echo "Proxmox: Template not available after download" ;;
|
||||||
|
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" ;;
|
||||||
|
|
||||||
|
# --- DPKG ---
|
||||||
|
255) echo "DPKG: Fatal internal error" ;;
|
||||||
|
|
||||||
# --- Default ---
|
# --- Default ---
|
||||||
*) echo "Unknown error" ;;
|
*) echo "Unknown error" ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user