passing extra args to vga virtio

KciNicK

New Member
May 27, 2024
9
0
1
i have this vm:

Code:
# qm showcmd 104 --pretty
/usr/bin/kvm \
  -id 104 \
  -name 'BOOTTEST,debug-threads=on' \
  -no-shutdown \
  -chardev 'socket,id=qmp,path=/var/run/qemu-server/104.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/104.pid \
  -daemonize \
  -smbios 'type=1,uuid=23c220b9-198d-4c0b-bb0f-eb26e70eb3c8' \
  -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/104.vnc,password=on' \
  -cpu host,+kvm_pv_eoi,+kvm_pv_unhalt \
  -m 8192 \
  -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=e406ca29-82b9-4a17-9bda-36127fd00c56' \
  -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \
  -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \
  -device 'virtio-vga,id=vga,bus=pci.0,addr=0x2' \
  -device 'virtio-serial,id=spice,bus=pci.0,addr=0x9' \
  -chardev 'spicevmc,id=vdagent,name=vdagent' \
  -device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0' \
  -spice 'tls-port=61001,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on' \
  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:d8d92655119f' \
  -drive 'if=none,id=drive-ide2,media=cdrom,aio=io_uring' \
  -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=101' \
  -netdev 'type=tap,id=net0,ifname=tap104i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \
  -device 'virtio-net-pci,mac=BC:24:11:77:9F:CC,netdev=net0,bus=pci.0,addr=0x12,id=net0,rx_queue_size=1024,tx_queue_size=256,bootindex=100' \
  -machine 'type=pc+pve0'

i need to add an extra parameter to:
Code:
-device 'virtio-vga,id=vga,bus=pci.0,addr=0x2'
to look like this:
Code:
-device 'virtio-vga,id=vga,bus=pci.0,addr=0x2,xres=1920,yres=1080'

why it is so difficult to do something like this?
 
why it is so difficult to do something like this?
Not the answer you're looking for, yet you can also set the resolution interactively in the BIOS (even in UEFI mode). Just press F2 and move to the OVMF settings:

1718526283027.png

Maybe that is what you're looking for?
 
thanks for your reply, i don't have the option of F2 on legacy bios, i'm not using uefi, those seem to be vesa resolutions. If i start the vm from the command line, i get it working, but i would like to use the GUI, i tried multiple things as args: on the conf file, but none seems to work, adding the device and -vga none work, but then the remote console is not working
 
don't have the option of F2 on legacy bios, i'm not using uefi, those seem to be vesa resolutions.
Ah, okay.

BTW: Why don't you just set the resolution in your guest operating system? This should work out-of-the-box, at least it does for me. I'm trying to understand why it is so important to set the resolution beforehand and via QEMU/kvm.
 
Ah, okay.

BTW: Why don't you just set the resolution in your guest operating system? This should work out-of-the-box, at least it does for me. I'm trying to understand why it is so important to set the resolution beforehand and via QEMU/kvm.
that would be ideal, but cannot do, i'm trying to set the resolution of the framebuffer console:
Code:
# fbset

mode "1280x800"
    geometry 1280 800 1280 800 32
    timings 0 0 0 0 0 0 0
    rgba 8/16,8/8,8/0,0/0
endmode

the only available mode is the one passed in the config, i can set the default resolution at anything, but as soon as the virtio modules is loaded, the resolution set itself at 1280x800, i can avoid loading the driver, but the speed of the default vga console is horrible
 
Show output for qm config 104
Code:
agent: 1
bios: ovmf
boot: order=net0;ide2
cores: 1
cpu: host
description: args%3A -device virtio-vga,id=vga,bus=pci.0,addr=0x2,xres=1920,yres=1080
ide2: none,media=cdrom
memory: 8192
meta: creation-qemu=8.1.5,ctime=1718145649
name: BOOTTEST
net0: virtio=BC:24:11:77:9F:CC,bridge=vmbr0,tag=5
numa: 0
ostype: l26
scsihw: virtio-scsi-pci
smbios1: uuid=23c220b9-198d-4c0b-bb0f-eb26e70eb3c8
sockets: 1
vga: virtio
vmgenid: e406ca29-82b9-4a17-9bda-36127fd00c56
 
description: args%3A -device virtio-vga,id=vga,bus=pci.0,addr=0x2,xres=1920,yres=1080
What is this?
To add args add a NEW line in to the 104.conf file. So

Code:
nano /etc/pve/qemu-server/104.conf

# Then add the following line (alphabetically ordered)

args:  -device 'virtio-vga,id=vga,bus=pci.0,addr=0x2,xres=1920,yres=1080'

Give it a try.
 
What is this?
To add args add a NEW line in to the 104.conf file. So

Code:
nano /etc/pve/qemu-server/104.conf

# Then add the following line (alphabetically ordered)

args:  -device 'virtio-vga,id=vga,bus=pci.0,addr=0x2,xres=1920,yres=1080'

Give it a try.
Already try that, it didn't work, i commented the line with a #, the parser converted the comment as a "description" that can be see on the webgui on the summary tab, adding the device with addr=0x2 says 0x2 is already on the -vga virtio, failed to start, if i remove the -vga virtio or use -vga none, it works, but no console on the webgui, as it thinks the vm has no vga. I know it works coz ssh to the vm, running fbset says the console is running at 1920x1080.
 
Last edited:
the parser converted the comment as a "description"
I suspected as much.

Lets try & be innovative & try something else:

Code:
nano /etc/pve/qemu-server/104.conf

# Edit the VGA line as follows:

vga: virtio,xres=1920,yres=1080

I don't believe you need the bus or the address here as they are default.
 
already try that to, error with "vga don't support any parameters on the schema" or something like that, failed to start vm
 
Assuming you entered that line exactly as I did ("no inverted commas") I am out of ideas presently.

Edit: One further try, how about you add your args device line & choose Spice (qxl) instead for the vga?
 
Assuming you entered that line exactly as I did ("no inverted commas") I am out of ideas presently.

Edit: One further try, how about you add your args device line & choose Spice (qxl) instead for the vga?

sorry, before coming here, i try every possible combination, including qxl, also try many things on the vm side, module options, etc...
the only thing that works, is starting the vm from command line, removing the -vga and adding my own
 

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!