A production-ready shell script for automating CachyOS virtual machine creation on Proxmox VE. Handles disk provisioning, network configuration, EFI boot setup, and ISO verification with comprehensive error handling.
Tested and supported on:
- Proxmox VE 8.0 and later
- Proxmox VE 9.0 and later (recommended)
- Proxmox VE 9.0.11 (fully validated)
- Proxmox VE installation with root or sudo access
- 2 CPU cores minimum
- 4 GB RAM minimum for host
- 40 GB available storage for VM disk
- Network bridge configured (vmbr0 default)
- Internet connectivity for ISO download
The following packages must be installed on the Proxmox host:
bash(4.0+)qemu-serverproxmox-veceph-common(if using Ceph storage)curlorwget
These come standard with Proxmox VE installations.
Clone or download the script to your Proxmox host:
wget https://example.com/fixed.sh
chmod +x fixed.shOr create the file directly:
nano fixed.sh
# paste the script contents
# Ctrl+X to saveRun as root or with sudo:
sudo ./fixed.shOr directly as root:
./fixed.shThe script will prompt for configuration options interactively.
- Range: 100-999
- Default: 111
- Must be unique on the host
- Script validates availability
- Alphanumeric characters, dots, hyphens, underscores only
- Default: cachy
- Used for WebUI display and identification
- Range: 1-128 cores
- Default: 4
- Host CPU type used for best performance
- Minimum: 512 MB
- Default: 9000 MB
- Supports memory ballooning with configurable minimum
- Pool selection (local-lvm, local, custom)
- Default: local-lvm
- Validates pool existence before creation
- Format: Number + Unit (G, M, or T)
- Default: 32G
- Valid examples: 32G, 10240M, 1T
- Converted internally to GiB for Proxmox compatibility
- Bridge selection: vmbr0 default
- VLAN tagging: Optional (range: 1-4094)
- Validates bridge interface existence
- Separate storage location for installation media
- Default: local
- Used for CachyOS ISO and cloud-init provisioning
- Desktop (KDE Plasma) - Recommended for GUI usage
- Minimal - For headless/server setup
- Optional post-install configuration
- Requires cloud-init support in ISO storage
- Default: disabled
Enable verbose logging for troubleshooting:
DEBUG=1 ./fixed.shOutputs detailed information about each step to both console and log file.
All operations logged to:
/var/log/cachyos-vm-creator-3.5.log
Review logs for troubleshooting:
tail -f /var/log/cachyos-vm-creator-3.5.log- VM ID availability checked before creation
- Storage pools validated for existence
- Network bridges validated for presence
- VLAN IDs validated (1-4094 range)
- Memory balloon settings validated
- CPU core count validated (1-128)
- Disk size format validated
- Automatic cleanup on script failure
- Partial VM destruction if creation fails
- Detailed error messages with context
- Failed downloads trigger retry information
- Checksum verification for ISO integrity
- Automatic EFI disk creation
- Storage type detection (LVM, ZFS, directory, etc.)
- Proper format selection based on storage backend
- Disk size conversion from M/G/T to GiB
- SCSI controller with discard and I/O threading enabled
- Bridge interface validation
- VLAN tagging support with validation
- VirtIO network adapter for performance
- Proper MTU handling for VLANs
The script performs these steps in order:
- Environment validation (root check, Proxmox API connectivity)
- Interactive configuration prompts
- CachyOS ISO download and verification
- VM creation with specified configuration
- Disk attachment with performance optimizations
- Boot configuration
- Installation instructions
After the script completes:
-
Start the VM:
qm start 111
-
Connect via console or VNC in WebUI
-
Boot from ISO and complete CachyOS installation
-
After installation, detach ISO:
qm set 111 --delete ide1 qm set 111 --boot 'order=scsi0'
-
Install Proxmox guest agent:
sudo pacman -S qemu-guest-agent sudo systemctl enable --now qemu-guest-agent
Ensure you are running on a Proxmox host with:
pvesh get /api2/json/nodesIf this fails, you are not on a Proxmox VE system.
Check available storage space:
pvesm statusVerify storage pool exists and has sufficient capacity. The script validates this but confirm manually.
Check internet connectivity:
curl https://iso.cachyos.org/desktop/251129/cachyos-desktop-linux-251129.isoIf download works manually, retry the script. ISO download failures do not affect existing VMs.
List available bridges:
ip link showSpecify an existing bridge during configuration. vmbr0 is standard for most Proxmox installations.
Check free space:
df -h /var/lib/vzThe script requires approximately 3 GB for ISO plus disk size for VM.
ISO file is corrupted. Script automatically removes it and prompts for retry.
Manual cleanup:
rm /var/lib/vz/template/iso/cachyos-desktop-linux-251129.isoThe script applies these optimizations automatically:
- VirtIO network adapter for network performance
- VirtIO graphics adapter for display performance
- I/O threading enabled on SCSI controller
- Discard support for thin provisioning
- Host CPU passthrough for native instruction set
- OVMF firmware for modern UEFI boot
- Default and recommended for Proxmox
- Raw format used automatically
- Best performance for local storage
- Raw format used automatically
- Supports snapshots and replication
- QCOW2 format used for compatibility
- Slower than LVM but works on NFS
- Supports image replication
- Script must run as root or with sudo
- Only run on trusted systems
- Review script contents before execution
- ISO downloaded over HTTPS
- Checksum verification prevents tampering
- VLAN support for network isolation
- Each VM gets unique ID
- Separate disk allocation
- Bridge network configuration allows segmentation
To remove a created VM:
qm stop VMID
qm destroy VMIDExample:
qm stop 111
qm destroy 111The script does not perform automatic cleanup except on failure. Remove VMs manually as needed.
For issues or feature requests:
- Check the troubleshooting section above
- Review log file at
/var/log/cachyos-vm-creator-3.5.log - Run with
DEBUG=1mode for detailed output - Verify Proxmox version compatibility
- Added comprehensive error handling
- Improved environment validation
- Enhanced logging to file
- Added debug mode
- Stricter input validation
- Automatic cleanup on failure
- Fixed disk creation syntax for Proxmox 9.0+
- Corrected qm set scsi0 parameters
- Fixed size conversion to GiB
- Initial production release
- ISO verification and caching
- Cloud-init support
- VM type selection
Production-ready script for CachyOS Proxmox VM automation.