[SOLVED] Siimultaneous Spice Client Connections

blackpaw

Renowned Member
Nov 1, 2013
302
22
83
Apparently experimental support has been in the spice server for this since spice 0.10

http://www.spice-space.org/page/Features/MultipleClients

One just needs to set
export SPICE_DEBUG_ALLOW_MC=1

before launching the qemu vm.

Not sure where to set this on proxmox - I tried globally via /etc/profile but that didn't work.

Any suggestions?
 
Last edited:
Well it took me a while, but I figured out where to set it and it does work.

WARNING:Involves editing ProxMox perl code and hence totally unsupported.

Edit /usr/share/perl5/PVE/Tools.pm

Add the following before line 325:

Code:
local $ENV{SPICE_DEBUG_ALLOW_MC} = "1";

So it should look like this:

Code:
    319         eval {
    320             local $ENV{LC_ALL} = $lang;
    321
    322             # suppress LVM warnings like: "File descriptor 3 left open";
    323             local $ENV{LVM_SUPPRESS_FD_WARNINGS} = "1";
    324             [B]local $ENV{SPICE_DEBUG_ALLOW_MC} = "1";[/B]
    325
    326             $pid = open3($writer, $reader, $error, @$cmd) || die $!;
    327
    328             # if we pipe fron STDIN, open3 closes STDIN, so we we
    329             # a perl warning "Filehandle STDIN reopened as GENXYZ .. "
    330             # as soon as we open a new file.
    331             # to avoid that we open /dev/null
    332             if (!ref($writer) && !defined(fileno(STDIN))) {
    333                 POSIX::close(0);
    334                 open(STDIN, "</dev/null");
    335             }
    336         };

The you should reboot the node, though probably restarting the pve manager service should be sufficient - didn't test that.

Then you can open as many spice connections as you like to the same VM, from the same PC or multiple ones. So far I haven't had any issues or crashes. Mouse and keyboard are shared between connections.
 
  • Like
Reactions: notdan.swim
I know its old but i works like a charm.

Is there any possibility to add this permanently? Every time i update Proxmox it gets overwritten. Then i edit the Tools.pm but i don't know wich service i have to restart for getting it to work online. The only way is a restart of the pve-manager. But this reboots all my VMs, too.
 
  • Like
Reactions: jebbam
Hi... Old post but not working here... I try both PVE 4.4 and PVE 5... I am able to start the VM after alter the Tools.pm.
When the VM start, I get this message:
qm start 100
(/usr/sbin/qm:8961): Spice-Warning **: reds.c:3378:do_spice_init: spice: allowing multiple client connections (crashy)

But when connect from different clients, they share the connecttion and there is the same one....

How can do it to work??? Thanks for any help.
 
But when connect from different clients, they share the connecttion and there is the same one....

Thats what its meant
But when connect from different clients, they share the connecttion and there is the same one....


Thats what its meant to do - share the same screen across multiple spice displays. We used it in support so a person could easily observe what the other was doing.
 
  • Like
Reactions: Tmanok
But when connect from different clients, they share the connecttion and there is the same one....

Thats what its meant



Thats what its meant to do - share the same screen across multiple spice displays. We used it in support so a person could easily observe what the other was doing.
I see your point, but that's not the behavior I expected... I need that two or more people connected to VM without interfere with other, like RDP ir WTS does, you gotta?
 
I see your point, but that's not the behavior I expected... I need that two or more people connected to VM without interfere with other, like RDP ir WTS does, you gotta?
You are better off with x2go or xrdp or at worst case scenario VNC for what you want. It sounds like you're looking for a terminal server, Gilberto.

On another note, I am interested in supporting Spice users on Proxmox by sharing the same display and came across this thread as well. I believe the relevant documentation online still suggests that the feature is experimental, even 10 years later... Proxmox Devs, is there already a feature in place to enable Spice multiple client connections in PVE that I might have missed? I understand that secondary clients lack certain features such as SmartCard but if there is or will be a feature to easily enable multiple client support, I would love to hear about it.

Thanks, and sorry for reviving an old thread, it became relevant again.

Tmanok
 
  • Like
Reactions: jebbam
This is relevant for me too. I just tried this with multiple hosts, and by default it doesn't work. I haven't seen anywhere in the web gui that allows this to be configured. Would be a nice checkbox. :) I haven't tried the patch above yet.
 
I tested the above SPICE line with Proxmox 7.1. It works for me, mostly. This could have unintended security implications.

It works except for audio. Whichever workstation connects first, gets the audio stream. The second machine to connect doesn't get audio.

Here's an updated patchlet:

Perl:
--- /usr/share/perl5/PVE/Tools.pm.orig  2022-02-09 10:36:44.000000000 -0700
+++ /usr/share/perl5/PVE/Tools.pm       2022-02-20 18:36:12.823989096 -0700
@@ -451,6 +451,7 @@
 
            # suppress LVM warnings like: "File descriptor 3 left open";
            local $ENV{LVM_SUPPRESS_FD_WARNINGS} = "1";
+           local $ENV{SPICE_DEBUG_ALLOW_MC} = "1";
 
            $pid = open3($writer, $reader, $error, @$cmd) || die $!;

It looks like fixing multiple audio streams is on the upstream to do list:

https://www.spice-space.org/multiple-clients.html

Howto enable without reboot:

https://forum.proxmox.com/threads/multi-spice-console-how-to-enable-without-reboot.54890/

systemctl restart pvedaemon
 
Last edited:
  • Like
Reactions: blackpaw and Tmanok

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!