VM with dual monitor

Hello all, I have a question on running a VM with dual monitors. My goal is to use a VM and be able to have the VM output to both of my monitors just like my desktop does (extended the desktop to the left of my current/default monitor). I have tried a lot of things over the last couple weeks. I have played quite a bit with xrandr and seem to always end up with the same issue. As soon as I tell the VM to extend the desktop to the 2nd monitor both screens go black and I have to reset the VM. It does not matter if I use xrandr or the GUI display settings (tried XFCE, KDE and GNOME) they all end with the same results.

If i run a distro as a VM that uses Wayland I can simply click on the view menu (in virt-viewer) and add the second (or more) monitors and they work great. My issue is I want to use Kali and or Parrot and neither use wayland…

I am trying to do this using KVM just running virt-viewer on my local desktop machine.
I also have a Proxmox server but it has the exact same issues.
I have tried Kubuntu and Fedora on my desktop and have determined the issue is with the VM itself not the distro I run as a desktop.

I was hoping someone else has tackled this and can help me out. I have read and tried all sorts of things on the internet and will continue to experiment.

I don’t know what you mean by telling the VM to extend the desktop but I used to solve my multi-monitor problem by stretching the viewer window across both monitors and I automated it with xdotool.

It may help adding additional QXL devices to the VM in it’s config. Use virsh edit and append some of these:

<video>
    <model type='qxl'>
</video>

https://people.freedesktop.org/~teuf/spice-doc/html/ch02s07.html

Pretty much the box for the second monitor is either grayed out or if its not when I check it both screens go black. I did try adding additional Video with virsh and the gui/xml. I have not tried stretching it across the screens however. I might see If I can figure out how to do that.

Interesting problem. I don’t have a 2nd monitor at the moment or i’d have a go.

I don’t think it matters if you actually have a 2nd monitor. Since they are just Virtual monitors I am trying to create. For example on an Ubuntu VM as long as I set the heads to 2 or more I can spawn as many screens as the heads is set to, up to four virtual screens, even with just one monitor.
image

I did get Kali to work very briefly (only with KDE, GNOME never worked), after installing wayland on it, then I foolishly rebooted the VM before snapshoting it and I cannot figure out how to replicate my brief success :man_facepalming:

I was able to solve this. In case someone else finds this useful here is what I had to do. Note this was using KVM and in my case on Ubuntu but I don’t think the distro will matter.

The VM is Kali-Linux2022.2

You have to use virt-viewer or remote-viewer for multiple screens as Virtual Machine Manager does not support more than one screen.

  1. In Virtual Machine Manager click on add hardware and add another Video QXL

  2. Connect to the VM with virt-viewer or remote-viewer.

  3. Once the VM boots up install spice-vdagent and plasma-workspace-wayland

  4. sudo start systemctl spice-vdagentd.service

  5. sudo start systemctl spice-vdagentd.socket

  6. Reboot the VM

  7. When the login screen comes up in the bottom left change your session to Plasma Wayland
    image

  8. login and setup you displays as needed.

2 Likes