Understanding Exit Codes
Exit codes provide detailed information about why a script failed. Each code maps to a specific error condition, making troubleshooting faster and more precise.Quick Reference Chart
| Exit Code Range | Category | Typical Issue |
|---|---|---|
| 1-2, 126-143 | Shell/System | Permissions, signals, missing commands |
| 100-102 | Package Manager | APT/DPKG errors, broken packages |
| 103-125 | Script Validation | Environment checks, prerequisites |
| 160-162 | Python/pip | Virtual environments, dependencies |
| 170-193 | Databases | Connection, authentication, query errors |
| 200-209 | Container Creation | CTID, password, configuration |
| 210-217 | Storage/Cluster | Disk space, quorum, storage type |
| 218-225 | Templates | Download, corruption, availability |
| 231-238 | Tools/Addons | Tool-specific errors |
| 243-249 | Node.js/npm | Runtime errors, memory issues |
| 250-254 | Application | Download, extraction, migration |
Generic Shell Errors (1-2, 126-143)
Standard Unix/Linux exit codes used across all scripts.Complete Shell Error Reference
Complete Shell Error Reference
| Code | Description | Common Causes | Solutions |
|---|---|---|---|
| 1 | General error / Operation not permitted | Permission denied, general failure | Check user permissions, run as root if needed |
| 2 | Misuse of shell builtins | Syntax error in script | Review script syntax, check bash version |
| 126 | Command cannot execute | Permission problem, not executable | chmod +x script.sh or check file permissions |
| 127 | Command not found | Missing binary, wrong PATH | Install required package, check PATH variable |
| 128 | Invalid argument to exit | Invalid exit code passed | Use exit codes 0-255 only |
| 130 | Terminated by Ctrl+C (SIGINT) | User interrupted script | Expected behavior, no action needed |
| 137 | Killed (SIGKILL) | Out of memory, forced termination | Check memory usage, increase RAM allocation |
| 139 | Segmentation fault | Memory access violation, corrupted binary | Reinstall package, check system stability |
| 143 | Terminated (SIGTERM) | Graceful shutdown signal | Expected during container stops |
Package Manager Errors (100-102, 255)
APT, DPKG, and package installation errors.Exit Code 100 - APT Package Manager Error
Exit Code 100 - APT Package Manager Error
- Broken packages
- Dependency conflicts
- Failed installations
Exit Code 101 - APT Configuration Error
Exit Code 101 - APT Configuration Error
- Malformed sources.list
- Bad repository configuration
- Invalid GPG keys
Exit Code 102 - APT Lock Held
Exit Code 102 - APT Lock Held
- Another apt/dpkg process running
- Stale lock files
Exit Code 255 - DPKG Fatal Internal Error
Exit Code 255 - DPKG Fatal Internal Error
- Corrupted package database
- System inconsistency
Script Validation Errors (103-125)
Environment checks and prerequisite validation.Validation Error Codes
Validation Error Codes
| Code | Description | Solution |
|---|---|---|
| 103 | Shell is not Bash | Use bash to run the script |
| 104 | Not running as root | Run with sudo or as root user |
| 105 | Proxmox VE version not supported | Upgrade Proxmox VE |
| 106 | Architecture not supported (ARM/PiMox) | Use x86_64 architecture |
| 109 | No available container ID after max attempts | Manually specify CTID |
| 116 | Default bridge vmbr0 not found | Configure network bridge |
| 117 | Container did not reach running state | Check container logs |
| 118 | No IP assigned to container | Check DHCP/network config |
| 119 | No valid storage for rootdir | Configure compatible storage |
| 122 | No internet connectivity | Check network and routing |
Container Creation Errors (200-209)
Errors during LXC container creation.Exit Code 205 - Invalid CTID (<100)
Exit Code 205 - Invalid CTID (<100)
Exit Code 206 - CTID Already in Use
Exit Code 206 - CTID Already in Use
/etc/pve/lxc/ but not in pct list, manually remove the config file.Exit Code 207 - Password Contains Special Characters
Exit Code 207 - Password Contains Special Characters
-, /, \, *, !, @Solution:
Use alphanumeric passwords or avoid leading/trailing special characters.Exit Code 208 - Invalid Configuration
Exit Code 208 - Invalid Configuration
- DNS format:
.homeinstead ofhome(remove leading dot) - MAC format:
AA-BB-CCinstead ofAA:BB:CC(use colons) - Invalid IP address format
Exit Code 209 - Container Creation Failed
Exit Code 209 - Container Creation Failed
Storage & Cluster Errors (210-217)
Exit Code 210 - Cluster Not Quorate
Exit Code 210 - Cluster Not Quorate
Exit Code 214 - Not Enough Storage Space
Exit Code 214 - Not Enough Storage Space
Exit Code 217 - Storage Does Not Support Rootdir
Exit Code 217 - Storage Does Not Support Rootdir
iscsidirect(VMs only)cephfs(use RBD instead)pbs(backups only)
dir,zfspool,lvm-thin,rbd
Template Errors (218-225)
Exit Code 218 - Template Corrupted or Incomplete
Exit Code 218 - Template Corrupted or Incomplete
- Download interrupted
- File size < 1MB
- Invalid archive format
Exit Code 222 - Template Download Failed
Exit Code 222 - Template Download Failed
Exit Code 225 - No Template Available
Exit Code 225 - No Template Available
Database Errors
Node.js/npm Errors (243-249)
Exit Code 243 - Out of Memory
Exit Code 243 - Out of Memory
Exit Code 247 - Fatal Internal Error
Exit Code 247 - Fatal Internal Error
Exit Code 249 - npm/pnpm/yarn Fatal Error
Exit Code 249 - npm/pnpm/yarn Fatal Error
Python/pip Errors (160-162)
Exit Code 160 - Virtualenv Missing or Broken
Exit Code 160 - Virtualenv Missing or Broken
Exit Code 162 - Installation Aborted
Exit Code 162 - Installation Aborted
Application Errors (250-254)
| Code | Description | Common Solution |
|---|---|---|
| 250 | Download failed or version not determined | Check network, verify URL |
| 251 | File extraction failed | Verify archive integrity |
| 252 | Required file or resource not found | Check installation path |
| 253 | Data migration required | Follow migration guide |
| 254 | User declined prompt or timeout | Review and accept prompts |
Troubleshooting Tips
Finding Error Details
Common Patterns
/etc/pve/lxc/ manuallyExit 209 generic error: Check /tmp/pct_create_*.log for specific pct create failure reasonExit 218 or 222: Template issues - delete and re-download templateSee Also
- Common Issues - Detailed solutions for frequent problems
- Debug Mode - Enable verbose logging and tracing
- Logs - Log file locations and analysis