qm config command issues?

erioshi

Member
Jul 18, 2018
14
0
21
44
I have run into a situation when creating VMs using the qm config command from the command line.

The QM CONFIG command fails when I include any "net" options to create the VM NICs as part of VM creation. However, once the VM has been created, the QM SET command does work successfully with the same "net" option. It does not seem to matter if the value is "net0", "net1" or any other appropriate value.

For example:

root@HOST:~# qm show 208
/usr/bin/kvm -id 208 -name vm208 -no-shutdown -chardev 'socket,id=qmp,path=/var/run/qemu-server/208.qmp,server=on,wait=off' -mon 'chardev=qmp,mode=control' -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' -mon 'chardev=qmp-event,mode=control' -pidfile /var/run/qemu-server/208.pid -daemonize -smbios 'type=1,uuid=xxxx' -smp '1,sockets=1,cores=1,maxcpus=1' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vnc 'unix:/var/run/qemu-server/208.vnc,password=on' -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 512 -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'vmgenid,guid=xxxx' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'VGA,id=vga,bus=pci.0,addr=0x2' -chardev 'socket,path=/var/run/qemu-server/208.qga,server=on,wait=off,id=qga0' -device 'virtio-serial,id=qga0,bus=pci.0,addr=0x8' -device 'virtserialport,chardev=qga0,name=org.qemu.guest_agent.0' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:xxxx' -machine 'type=pc+pve0'

root@HOST:~# qm config 208 --net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1 Unknown option: net0
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
Unknown option: net
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net[0] model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
Unknown option: net[0]
400 unable to parse option
qm config <vmid> [OPTIONS]

root@HOST:~# qm config 208 --net
Unknown option: net
400 unable to parse option
qm config <vmid> [OPTIONS]
root@sm4p1:~# qm config 208 --net0
Unknown option: net0
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net[0]
Unknown option: net[0]
400 unable to parse option
qm config <vmid> [OPTIONS]

root@HOST:~# qm set 208 --net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
update VM 208: -net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1

root@HOST:~# qm show 208
/usr/bin/kvm -id 208 -name vm208 -no-shutdown -chardev 'socket,id=qmp,path=/var/run/qemu-server/208.qmp,server=on,wait=off' -mon 'chardev=qmp,mode=control' -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' -mon 'chardev=qmp-event,mode=control' -pidfile /var/run/qemu-server/208.pid -daemonize -smbios 'type=1,uuid=xxxx' -smp '1,sockets=1,cores=1,maxcpus=1' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vnc 'unix:/var/run/qemu-server/208.vnc,password=on' -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 512 -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'vmgenid,guid=xxxx' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'VGA,id=vga,bus=pci.0,addr=0x2' -chardev 'socket,path=/var/run/qemu-server/208.qga,server=on,wait=off,id=qga0' -device 'virtio-serial,id=qga0,bus=pci.0,addr=0x8' -device 'virtserialport,chardev=qga0,name=org.qemu.guest_agent.0' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:xxxx' -netdev 'type=tap,id=net0,ifname=tap208i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=00:00:00:00:00:01,netdev=net0,bus=pci.0,addr=0x12,id=net0' -machine 'type=pc+pve0'
 
The qm config is a read-only command to show configs of existing VMs, so that's expected. It only supports the --current and --snapshot <string> options.

The qm create should be used for creating VMs and can take the relevant options.

Check the docs, e.g., the qm manual page (man qm) for more info about how the qm CLI tools works.
 
My mistake, sorry. The original failures were using the QM CREATE command, but probably around a month ago now.

Let me retest the QM CREATE with the "net" option and see if it is still an issue.
 
The problem still exists with QM CREATE. The QM CREATE builds the VM, but errors out on any "net" option. Like above, I can still add networking using the QM SET command after the VM is created.

Here is the output:

root@HOST:~# qm create 209 --name sm4pxe-209 --boot order=scsi0;net0 --cpu host --sockets 1 --cores 1 --numa 0 --memory 3072 --balloon 0 --scsihw virtio-scsi-single --scsi0 zfs-pool:vm-209-disk-0,discard=on,iothread=1,size=20G,ssd=1 --scsi1 zfs-pool:vm-209-disk-1,discard=on,iothread=1,size=30G,ssd=1 --net0 virtio=00:00:00:00:00:01,bridge=vmbr0,firewall=1 --net1 virtio=00:00:00:00:00:02,bridge=vmbr0,firewall=1,tag=107 --ostype l26 --onboot 1 --agent 1 --start 0
-bash: net0: command not found

root@HOST:~# qm show 209
/usr/bin/kvm -id 209 -name sm4pxe-209 -no-shutdown -chardev 'socket,id=qmp,path=/var/run/qemu-server/209.qmp,server=on,wait=off' -mon 'chardev=qmp,mode=control' -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' -mon 'chardev=qmp-event,mode=control' -pidfile /var/run/qemu-server/209.pid -daemonize -smbios 'type=1,uuid=xxxx' -smp '1,sockets=1,cores=1,maxcpus=1' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vnc 'unix:/var/run/qemu-server/209.vnc,password=on' -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 512 -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'vmgenid,guid=xxxx' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'VGA,id=vga,bus=pci.0,addr=0x2' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:xxxx' -machine 'type=pc+pve0'

root@HOST:~# qm set 209 --net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
update VM 209: -net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1

root@HOST:~# qm show 209
/usr/bin/kvm -id 209 -name sm4pxe-209 -no-shutdown -chardev 'socket,id=qmp,path=/var/run/qemu-server/209.qmp,server=on,wait=off' -mon 'chardev=qmp,mode=control' -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' -mon 'chardev=qmp-event,mode=control' -pidfile /var/run/qemu-server/209.pid -daemonize -smbios 'type=1,uuid=xxxx' -smp '1,sockets=1,cores=1,maxcpus=1' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vnc 'unix:/var/run/qemu-server/209.vnc,password=on' -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 512 -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'vmgenid,guid=xxxx' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'VGA,id=vga,bus=pci.0,addr=0x2' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:xxxx' -netdev 'type=tap,id=net0,ifname=tap209i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=00:00:00:00:00:01,netdev=net0,bus=pci.0,addr=0x12,id=net0' -machine 'type=pc+pve0'
 
Last edited:
One other factor that may come into play:

My Proxmox hosts are set up to use Open vSwitch networking, set up per the Proxmox guide. I am not using the default Linux bridging.
 
bash: net0: command not found
This is just an error from your shell as you forgot to quote the --boot order=scsi0;net0 part, so due to the semi-colon bash thinks a new command with "net0" as executable is about to start.. Use quotes to avoid confusing the shell, e.g., this part would be: --boot 'order=scsi0;net0'
 
Thank you! That fixed my QM CREATE issues.

The commands were part of an Ansible playbook and role(s) I have been putting together for automating Proxmox VM creation. I had them burred inside an Ansible shell command.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!