Sample Header Ad - 728x90

QEMU/KVM SPICE - copy & paste functionalities work on the Windows VM, but not on the Debian VM

0 votes
1 answer
3267 views
**Client:** I installed a package spice-client-gtk on my Debian workstation which conects to the remote server i.e. hypervisor running virtual machines on QEMU-KVM. spice-client-gtk is not installed on the hypervisor itself. **Virtual machines:** In virt-manager I double clicked every single virtual machine and in main menu navigated to ViewDetails. Then I selected a property called Display [Spice|VNC] and set section Type to Spice server. I also selected another property on the left called Video [QXL|Virtio|VGA] and set section Model to QXL. Then I clicked Add Hardware, selected a property Channel and set section Name to com.redhat.spice.0 and section Device Type to Spice agent (spicevmc). On Windows virtual machines I installed [Spice guest tools](https://www.spice-space.org/download.html#windows-binaries) and after I restarted the virtual machine I was able to copy & paste between my workstation and Windows virtual machines. On Debian virtual machines I installed a package spice-vdagent and restarted, but copy & paste does not work. I executed systemctl to check the services and found out that only spice-vdagentd.socket is the only service that runs. Then I checked the status of all the services: ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> systemctl status spice-vdagentd.service ● spice-vdagentd.service - Agent daemon for Spice guests Loaded: loaded (/lib/systemd/system/spice-vdagentd.service; indirect; vendor preset: enabled) Active: inactive (dead) ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> systemctl status spice-vdagent.service ● spice-vdagentd.service - Agent daemon for Spice guests Loaded: loaded (/lib/systemd/system/spice-vdagentd.service; indirect; vendor preset: enabled) Active: inactive (dead) ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> systemctl status spice-vdagentd.socket ● spice-vdagentd.socket - Activation socket for spice guest agent daemon Loaded: loaded (/lib/systemd/system/spice-vdagentd.socket; enabled; vendor preset: enabled) Active: active (listening) since Fri 2021-01-08 08:57:50 CET; 4min 59s ago Listen: /var/run/spice-vdagentd/spice-vdagent-sock (Stream) CGroup: /system.slice/spice-vdagentd.socket Jan 08 08:57:50 localhost systemd: Listening on Activation socket for spice guest agent daemon. ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> ls /lib/systemd/system/ | grep spice -rw-r--r-- 1 root root 335 Oct 3 2018 spice-vdagentd.service -rw-r--r-- 1 root root 280 Oct 3 2018 spice-vdagentd.socket lrwxrwxrwx 1 root root 22 Oct 3 2018 spice-vdagent.service -> spice-vdagentd.service Note that service spice-vdagent.service is a symbolic link to the spice-vdagentd.service. Now I checked definition files for systemd services: ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> cat /lib/systemd/system/spice-vdagentd.service [Unit] Description=Agent daemon for Spice guests Requires=spice-vdagentd.socket [Service] Type=forking EnvironmentFile=-/etc/default/spice-vdagentd ExecStart=/usr/sbin/spice-vdagentd $SPICE_VDAGENTD_EXTRA_ARGS PIDFile=/var/run/spice-vdagentd/spice-vdagentd.pid PrivateTmp=true Restart=on-failure [Install] Also=spice-vdagentd.socket ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> cat /lib/systemd/system/spice-vdagentd.socket [Unit] Description=Activation socket for spice guest agent daemon # only start the socket if the virtio port device exists Requisite=dev-virtio\x2dports-com.redhat.spice.0.device [Socket] ListenStream=/var/run/spice-vdagentd/spice-vdagent-sock [Install] WantedBy=sockets.target > **Note:** > > Configuration parameter EnvironmentFile has a minus (-) > in front of the root folder: > > EnvironmentFile=-/etc/default/spice-vdagentd > > This is not a bug as @Zaroth pointed out in his answer. I also decided to create a /etc/default/spice-vdagentd which does not exist by default. Then inside I added one line that explicitly sets the Spice channel like suggested in the [man page](https://manpages.debian.org/buster/spice-vdagent/spice-vdagentd.1.en.html) : ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> touch /etc/default/spice-vdagentd ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> echo "SPICE_VDAGENTD_EXTRA_ARGS = -s "/dev/virtio-ports/com.redhat.spice.0" Note the Spice chanell /dev/virtio-ports/com.redhat.spice.0 already exists on Debian virtual machine because I previously set it in the virt-manager. I tried to restart the Debian virtual machine but still... copy & paste does not work. **** **ADD:** @Zaroth suggested to manually start and enable the service spice-vdagentd.service. I did it and then checked the statuses of both services: ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> systemctl status spice-vdagentd.socket ● spice-vdagentd.socket - Activation socket for spice guest agent daemon Loaded: loaded (/lib/systemd/system/spice-vdagentd.socket; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-01-08 10:08:06 CET; 2min 28s ago Listen: /var/run/spice-vdagentd/spice-vdagent-sock (Stream) Tasks: 0 (limit: 1149) Memory: 0B CGroup: /system.slice/spice-vdagentd.socket Jan 08 10:08:06 localhost systemd: Listening on Activation socket for spice guest agent daemon. ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> sudo systemctl status spice-vdagentd.service ● spice-vdagentd.service - Agent daemon for Spice guests Loaded: loaded (/lib/systemd/system/spice-vdagentd.service; indirect; vendor preset: enabled) Active: active (running) since Fri 2021-01-08 10:09:02 CET; 1min 38s ago Process: 1263 ExecStart=/usr/sbin/spice-vdagentd $SPICE_VDAGENTD_EXTRA_ARGS (code=exited, status=0/SUCCESS) Main PID: 1264 (spice-vdagentd) Tasks: 1 (limit: 1149) Memory: 520.0K CGroup: /system.slice/spice-vdagentd.service └─1264 /usr/sbin/spice-vdagentd -s /dev/virtio-ports/com.redhat.spice.0 Jan 08 10:09:02 localhost systemd: Starting Agent daemon for Spice guests... Jan 08 10:09:02 localhost systemd: spice-vdagentd.service: Can't open PID file /run/spice-vdagentd/spice-vdagentd.pid Jan 08 10:09:02 localhost systemd: Started Agent daemon for Spice guests. Status for service spice-vdagentd.service reports that it can't open a PID file but I double checked and this file is sucessfully created every time I manually start the spice-vdagentd.service. Here it is: ┌───┐ │ # │ ziga > debian--vm > ~ └─┬─┘ └─> ls -l /run/spice-vdagentd/spice-vdagentd.pid -rw-r--r-- 1 root root 5 Jan 8 10:19 /run/spice-vdagentd/spice-vdagentd.pid It is weird as everything looks as it should but spice-vdagentd.service isn't started even if enabled. How to fix this?
Asked by 71GA (1296 rep)
Jan 8, 2021, 08:36 AM
Last activity: Jan 11, 2021, 09:23 AM