Overview
Debug mode (also called “dev mode”) provides powerful debugging and testing capabilities for container creation and installation processes. It allows you to inspect script execution, pause between steps, preserve failed containers, and collect detailed logs.Debug mode is designed for troubleshooting and development. Disable it for production deployments.
Quick Start
Available Debug Modes
motd - Early SSH/MOTD Setup
Sets up SSH access and MOTD before the main application installation.motd Mode Details
motd Mode Details
Use Cases:Example:Combine with:
- Quick access to container for manual debugging
- Continue installation manually if something goes wrong
- Verify container networking before main install
keep, breakpoint, logskeep - Preserve Container on Failure
Never delete the container when installation fails. Skips cleanup prompt.keep Mode Details
keep Mode Details
Use Cases:Access preserved container:Combine with:
- Repeated tests of the same installation
- Debugging failed installations
- Manual fix attempts
motd, trace, logstrace - Bash Command Tracing
Enablesset -x for complete command-line tracing. Shows every command before execution.
trace Mode Details
trace Mode Details
Use Cases:Log Output: All trace output is saved to logs (see
- Deep debugging of installation logic
- Understanding script flow
- Identifying where errors occur exactly
logs mode)Combine with: keep, pause, logspause - Step-by-Step Execution
Pauses after each major step. Requires manual Enter press to continue.pause Mode Details
pause Mode Details
Use Cases:Between pauses, inspect the container:Combine with:
- Inspect container state between steps
- Understand what each step does
- Identify which step causes problems
motd, keep, logsbreakpoint - Interactive Shell on Error
Opens interactive shell inside the container when an error occurs.breakpoint Mode Details
breakpoint Mode Details
Use Cases:Debug in the container:Combine with:
- Live debugging in the actual container
- Manual command testing
- Inspect container state at point of failure
keep, logs, tracelogs - Persistent Logging
Saves all logs to/var/log/community-scripts/ with timestamps. Logs persist even on successful installation.
logs Mode Details
logs Mode Details
Use Cases:Access logs:With trace mode:Combine with: All other modes (recommended for CI/CD)
- Post-mortem analysis
- Performance analysis
- Automated testing with log collection
- CI/CD integration
dryrun - Simulation Mode
Shows all commands that would be executed without actually running them.dryrun Mode Details
dryrun Mode Details
Use Cases:Combine with:
- Test script logic without making changes
- Verify command syntax
- Understand what will happen
- Pre-flight checks
No actual changes are made. Container/system remains unchanged.
trace (shows dryrun trace), logs (shows what would run)Common Workflows
Development Workflow
CI/CD Integration
Production-like Testing
Live Debugging
Environment Variables
Dev Mode Variables
dev_mode(string): Comma-separated list of modes- Format:
"motd,keep,trace" - Default: Empty (no dev modes)
- Format:
Output Control
var_verbose="yes": Show all command output (disables silent mode)- Pairs well with:
trace,pause,logs
- Pairs well with:
Examples
Troubleshooting with Debug Mode
Installation Failed at Step X
Password/Credentials Not Working
Permission Denied Errors
Networking Issues
Manual Installation Completion
Log File Locations
Default (without logs mode)
- Host creation:
/tmp/create-lxc-<SESSION_ID>.log - Container install:
/tmp/install-lxc-<CTID>-<SESSION_ID>.log(on failure)
With logs mode
- Host creation:
/var/log/community-scripts/create-lxc-<SESSION_ID>-<TIMESTAMP>.log - Container install:
/var/log/community-scripts/install-<SESSION_ID>-<TIMESTAMP>.log
Viewing Logs
Best Practices
DO
- ✅ Use
logsmode for CI/CD and automated testing - ✅ Use
motdfor early SSH access during long installations - ✅ Use
pausewhen learning the installation flow - ✅ Use
tracewhen debugging logic issues (watch for secrets!) - ✅ Combine modes for comprehensive debugging
- ✅ Archive logs after successful tests
DON’T
- ❌ Use
tracein production or with untrusted networks (exposes secrets) - ❌ Leave
keepmode enabled for unattended scripts (containers accumulate) - ❌ Use
dryrunand expect actual changes - ❌ Commit
dev_modeexports to production deployment scripts - ❌ Use
breakpointin non-interactive environments (will hang)
Advanced Usage
Custom Log Analysis
Integration with External Tools
Reporting Issues
When reporting installation issues, always include debug logs:debug-logs.tar.gz when reporting issues on GitHub.
See Also
- Logs - Detailed information about log files
- Exit Codes - Understanding error codes
- Common Issues - Frequently encountered problems