This problem is related to this old thread (marked as solved):
As I explained there, the default console button tries to open with virt-viewer/spice when "VirtIO-GPU" or "VirGL GPU" is selected (or SPICE obviously).
When using Standard VGA, or vmware the default console button opens in NoVNC.
The solution proposed was to manually set the default Console viewer in the Datacenter menu, but I dislike this solution because it basically disables the automatic selection of the viewers, forcing ONLY the selected viewer in all VMs, CTs, etc. I would prefer to keep the Default (and automatic) viewer. This way I can have NoVNC for windows VMs and xterm.js for linux CTs when I click in Console (or even spice if I am using that in the VM).
After digging around the proxmox code for a few hours, I think I was able to pinpoint the problem. The API in
Here is the line in question:
https://github.com/proxmox/qemu-ser...6ebda1000e0e9d5fc7f50f/PVE/API2/Qemu.pm#L3092
I then edited the file
So, from this
To this
Then we restart some services to make sure the change sticks
And voilá. It works.
A simple sed command to change the file
(use at your own risk, do NOT use this in production servers)
Check the changes
I am not sure why that check is there.
Is there a reason to use SPICE as the default viewer for VirtIO-GPU hardware? I wonder if someone can clarify that one.
Also, should I open a ticket? Or is this post enough for the changes to reach the development team?
Cheers!
Gus
Sorry to revive this old thread, but this is still a problem.
I have a new Proxmox install (v8.4.1). I created a Windows 11 VM, it has been working fine. I spent some time testing and comparing the different Display hardware options (Standard VGA, VirtIO-GPU, VirGL-GPU, etc). They all worked fine and the console button opened in VNC.
Then I decided to try Spice. It didn't work very well and I didn't like it, so I reverted the config by removing all SPICE hardware (VGA, usb, audio). But now the main console button still tries to open with Spice when I have VirtIO-GPU or VirGL-GPU...
I have a new Proxmox install (v8.4.1). I created a Windows 11 VM, it has been working fine. I spent some time testing and comparing the different Display hardware options (Standard VGA, VirtIO-GPU, VirGL-GPU, etc). They all worked fine and the console button opened in VNC.
Then I decided to try Spice. It didn't work very well and I didn't like it, so I reverted the config by removing all SPICE hardware (VGA, usb, audio). But now the main console button still tries to open with Spice when I have VirtIO-GPU or VirGL-GPU...
As I explained there, the default console button tries to open with virt-viewer/spice when "VirtIO-GPU" or "VirGL GPU" is selected (or SPICE obviously).
When using Standard VGA, or vmware the default console button opens in NoVNC.
The solution proposed was to manually set the default Console viewer in the Datacenter menu, but I dislike this solution because it basically disables the automatic selection of the viewers, forcing ONLY the selected viewer in all VMs, CTs, etc. I would prefer to keep the Default (and automatic) viewer. This way I can have NoVNC for windows VMs and xterm.js for linux CTs when I click in Console (or even spice if I am using that in the VM).
After digging around the proxmox code for a few hours, I think I was able to pinpoint the problem. The API in
/nodes/{node}/qemu/{vm-id}/status/current
has a "special" check for $vga->{type} =~ /^virtio/
, which makes it return spice=1
when using a VirtIO GPU.Here is the line in question:
https://github.com/proxmox/qemu-ser...6ebda1000e0e9d5fc7f50f/PVE/API2/Qemu.pm#L3092
I then edited the file
/usr/share/perl5/PVE/API2/Qemu.pm
in my instance, removing the check for virtio.So, from this
Perl:
if ($conf->{vga}) {
my $vga = PVE::QemuServer::parse_vga($conf->{vga});
my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/;
$spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});
$status->{spice} = 1 if $spice;
$status->{clipboard} = $vga->{clipboard};
}
Perl:
if ($conf->{vga}) {
my $vga = PVE::QemuServer::parse_vga($conf->{vga});
#my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/;
#$spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});
my $spice = PVE::QemuServer::vga_conf_has_spice($conf->{vga});
$status->{spice} = 1 if $spice;
$status->{clipboard} = $vga->{clipboard};
}
Code:
systemctl restart pvedaemon.service pveproxy.service
And voilá. It works.
A simple sed command to change the file
(use at your own risk, do NOT use this in production servers)
Bash:
sed -i.bak -e 's/my $spice = defined($vga->{type}) \&\& $vga->{type} =~ \/^virtio\/;/\#my $spice = defined($vga->{type}) \&\& $vga->{type} =~ \/^virtio\/;/g' -e 's/$spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});/\#$spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});\n my $spice = PVE::QemuServer::vga_conf_has_spice($conf->{vga});/g' /usr/share/perl5/PVE/API2/Qemu.pm
Check the changes
Code:
# diff /usr/share/perl5/PVE/API2/Qemu.pm /usr/share/perl5/PVE/API2/Qemu.pm.bak
3092,3094c3092,3093
< #my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/;
< #$spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});
< my $spice = PVE::QemuServer::vga_conf_has_spice($conf->{vga});
---
> my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/;
> $spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});
I am not sure why that check is there.
Is there a reason to use SPICE as the default viewer for VirtIO-GPU hardware? I wonder if someone can clarify that one.
Also, should I open a ticket? Or is this post enough for the changes to reach the development team?
Cheers!
Gus
Last edited: