Debian 12 Promox Instalation - CMD only
Hola! This is my first doc, series about promox and VM home lab in this blog! I don't think is perfect but it have been good work arounds and the commands that were cool to learn new things, like Cloud init. Feel free to discuss this post on my Bluesky(ᴗᵔᴥᵔ) For me what began as a frustrating troubleshooting exercise, ended with a much deeper understanding of how Proxmox manages storage and VMs. Sometimes the command line path, though initially more challenging, leads to greater knowledge and control in the end.
Setting Up a Debian 12 VM in Proxmox via Command Line: My Journey
The Challenge
Today I want to share my experience creating a Debian 12 virtual machine in Proxmox using purely command line tools. What started as a simple task turned into quite the learning adventure about how Proxmox handles storage, ISO images, and virtual machine configuration.
It all began when I tried to create a VM through the Proxmox web interface. I encountered an issue specifically on the "Disks" tab, where there seemed to be an "SCSI issue" when trying to install Debian. Based on what I could see, I had a SATA disk configured, but this wasn't optimal for Debian 12.
Rather than continuing to struggle with the GUI, I decided to take the command line approach, which would give me more control and understanding of what was happening behind the scenes.
Initial Research
Before diving in, I did some research on the proper commands needed. I discovered that creating a VM in Proxmox via command line involves several key components:
First, the basic VM creation:
qm create <vmid> --name <vm_name> --memory <memory_mb> --net0 virtio,bridge=<bridge_name>
Then, setting the proper SCSI hardware controller:
qm set <vmid> --scsihw virtio-scsi-pci
This second command was particularly important based on my initial issue - modern Linux distributions like Debian 12 work better with virtio-scsi-pci controllers than with SATA controllers.
Storage Preparation
I quickly realized I needed a proper storage pool for my Debian VM. The default storage wasn't available on my system, so I needed to create my own storage solution. I created a directory-based storage at /mnt/storage-dir
and downloaded the Debian 12 ISO.
At this point, I was ready to start creating my VM.
The First Attempt
I ran the following command to create my VM:
qm create 123 --name test-vm --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 --ide2 default-storage:cloudinit --bootdisk scsi0 --scsi0 default-storage:32
But immediately hit an error:
storage 'default-storage' does not exist
This made sense - I hadn't created that storage pool but was using my custom storage. So I adjusted my command:
qm create 123 --name test-vm --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 --ide2 storage-dir:cloudinit --bootdisk scsi0 --scsi0 storage-dir:32
This time it worked! (✦ ‿ ✦) I could see the command created both a CloudInit image and a 32GB disk for my VM:
Formatting '/mnt/storage-dir/images/123/vm-123-cloudinit.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=metadata compression_type=zlib size=4194304 lazy_refcounts=off refcount_bits=16
ide2: successfully created disk 'storage-dir:123/vm-123-cloudinit.qcow2,media=cdrom'
Formatting '/mnt/storage-dir/images/123/vm-123-disk-0.raw', fmt=raw size=34359738368 preallocation=off
scsi0: successfully created disk 'storage-dir:123/vm-123-disk-0.raw,size=32G'
The ISO Challenge
Now I needed to attach the Debian installation ISO to my VM. I checked my storage status:
pvesm status
This showed me two storage pools: storage-dir
and local
, both directory types.
I tried to attach the ISO with:
qm set 123 --ide0 storage-dir:iso/debian-12.10.0-amd64-netinst.iso
But got an error ... ʘ‿ʘ ...
400 Parameter verification failed.
ide0: explicit 'media=cdrom' is required for iso images
I adjusted my command to include the media type:
qm set 123 --ide0 storage-dir:iso/debian-12.10.0-amd64-netinst.iso,media=cdrom
But then faced another error ( ◐ o ◑ )
unable to parse directory volume name 'debian-12.10.0-amd64-netinst.iso'
I tried again, double-checking the ISO was in the expected location:
ls /mnt/storage-dir
debian-12.10.0-amd64-netinst.iso images template
The ISO was there, but trying the command again resulted in the same error. I even tried changing directories and using the absolute path, but nothing worked.
The Breakthrough ┬┴┬┴┤•ᴥ•ʔ├┬┴┬┴
After some investigation, I realized my mistake. In Proxmox's storage system, ISOs need to be in a specific directory structure. For directory-based storage, ISO images must be in the template/iso
subdirectory of the storage location.
I needed to:
- Create the proper directory structure:
mkdir -p /mnt/storage-dir/template/iso
- Move the ISO to the correct location:
mv /mnt/storage-dir/debian-12.10.0-amd64-netinst.iso /mnt/storage-dir/template/iso/
- Try again with the correct path:
qm set 123 --ide0 storage-dir:iso/debian-12.10.0-amd64-netinst.iso,media=cdrom
And it worked! 乁( ͡° ʖ ͡ °)ㄏThe ISO was successfully attached to my VM.
Success and Lessons Learned
With the ISO attached, I could now start my VM and begin the Debian installation:
qm start 123
qm terminal 123
Looking back, this experience taught me several important lessons about Proxmox:
Storage structure matters: Proxmox expects files to be in specific locations. ISO images must be in
template/iso/
, VM disks go inimages/<vmid>/
, etc.Path references are relative: When referencing files in storage, use paths relative to the storage root, not absolute filesystem paths.
Controller types are important: Modern Linux distributions like Debian 12 work best with virtio-scsi-pci controllers, not SATA controllers.
Explicit parameters are required: Always specify media types (like
media=cdrom
) when attaching ISO images.
Final Working Command Sequence
For future reference (and anyone else attempting this), here's the complete working sequence of commands:
- Set up the proper directory structure:
mkdir -p /mnt/storage-dir/template/iso
- Place Debian ISO in the correct location:
mv /mnt/storage-dir/debian-12.10.0-amd64-netinst.iso /mnt/storage-dir/template/iso/
- Create the VM:
qm create 123 --name test-vm --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 --ide2 storage-dir:cloudinit --bootdisk scsi0 --scsi0 storage-dir:32
- Set the optimal SCSI controller:
qm set 123 --scsihw virtio-scsi-pci
- Attach the installation ISO:
qm set 123 --ide0 storage-dir:iso/debian-12.10.0-amd64-netinst.iso,media=cdrom
- Start and access the VM:
qm start 123
qm terminal 123