How do you passthrough mouse/keyboard with gnome-boxes?

I have the full version of gnome-boxes (not flatpak) and want to passthrough my mouse and keyboard to the VM. Other devices show but the mouse and keyboard don’t. Is there a way to force the mouse and keyboard to passthrough?

I don’t know the formatting for spice to edit them directly into the XML. Any help would be greatly appreciated!

image

lsusb

individual usb info


edit: pastebin of current xml. boxes win 10 - Pastebin.com

Is this the only mouse and keyboard combo that you have on the system? Are you intending to run headless or GUI on the host?

1 Like

It would be gui. I did try plugging in multiple mice but that still didn’t make the other devices show up. (though that would’ve been annoying to have to do for the VM, Under normal use I would just use the steam deck touch pads and controls to open the VM window upon starting it).

I have a workaround currently by using a windows-to-go SSD but if I could get the mouse to passthrough to the VM that would still be my preference.

I don’t think you can pass-through the only mouse and keyboard using KVM/qemu because the system owns it. You could setup spice or something to control the guest machine.

If you wanted to pass the kbm through, you would have to setup some udev rules to do so.

Someone correct me if I am wrong but that is the way it was almost a decade ago.

@Mastic_Warrior you are correct; you can’t pass through your primary mouse and keyboard. @Bloodshed_Romance, you might be able to use a spice or something like it to control the guest machine. @Bloodshed_Romance might be able to pass through a USB hub. He would have to have a separate keyboard and mouse to plug into the hub. I don’t have much experience with KVM/Qeum. So I won’t be able to help further. Good Luck. I use Vmware Workstation for my hypervisor needs because that is the best hypervisor for my network simulation software.

1 Like

So, i’ve tried plugging in multiple mice and it wouldn’t show them as available for USB redirect either. Other devices like the Elgato Stream Deck are able to be passed through to a VM back and forth at will, I was just hoping I could do the same with a mouse.

The decks integrated touchpads act as mice (triggers act as mouse buttons), and has a on screen keyboard so even with a hardware mouse passed through you would still be able to independently move the mouse and interact with the deck gui.

On unraid I passthrough entire usb controllers to my VMs so I can unplug and plug in devices at will. I would do the same with the single usb port on the deck if it was doable for my intended use case.

I was hoping to passthrough the mouse to a VM so I could control the RGB and re-assign mouse buttons if needed all through the Deck without needing to swap to another machine or OS to do it. Currently my windows-to-go external SSD is still my solution.

VMware and Virtualbox both have separate issues running VMs on the Deck that I might attempt to look further into.

It will not work; I assume you are trying to pass through a mouse on a device similar to a Value Steam Deck. You will not be able to accomplish your goal for several reasons—the first reason is that the Steam Deck isn’t designed to run Virtual Machines. Instead, the Steam Deck is a device for playing games on the run. Another reason is the way pass-through works when passing a device to a virtual machine. For example, @Bloodshed_Romance would have to pass through a USB controller to the virtual machine; unfortunately, The USB controller will give all the USB devices attached to it to the virtual machine making the USB devices (like a mouse) unavailable to the Steam Deck.

Yeah, I was figuring that, I just didn’t know if you could go through the VM XML and force the mouse through or not. I also know the Steam Deck was never intended to do this but I still want to push it as far as I can.

I tried to install arch on a virtual machine to what the steps for installing Virtualbox, had trouble with the install script, couldn’t get KDE plasma installed on Arch Linux, and tried installing Marjaro in a virtual machine that worked better. However, it is still not entirely set up setup right. Also, I can’t seem to download packages from the terminal. For example, when I tried to install Virtualbox on Marjaro, I got the following output from the terminal.

[sudo] password for aaron: 
resolving dependencies...
:: There are 9 providers available for VIRTUALBOX-HOST-MODULES:
:: Repository extra
   1) linux419-virtualbox-host-modules  2) linux510-virtualbox-host-modules  3) linux515-virtualbox-host-modules  4) linux518-virtualbox-host-modules
   5) linux519-virtualbox-host-modules  6) linux54-virtualbox-host-modules
:: Repository community
   7) linux518-rt-virtualbox-host-modules  8) linux519-rt-virtualbox-host-modules  9) virtualbox-host-dkms

Enter a number (default=1): 3 
looking for conflicting packages...

Packages (4) linux515-virtualbox-host-modules-6.1.36-8  sdl12-compat-1.2.52-2  virtualbox-6.1.36-1
             virtualbox-guest-iso-6.1.36-1

Total Download Size:    79.47 MiB
Total Installed Size:  224.44 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 virtualbox-guest-iso-6.1.36-...    43.6 MiB  21.5 MiB/s 00:02 [##################################] 100%
 virtualbox-6.1.36-1-x86_64         35.5 MiB  35.5 MiB/s 00:01 [##################################] 100%
 linux515-virtualbox-host-mod...   250.7 KiB  2.95 MiB/s 00:00 [##################################] 100%
 sdl12-compat-1.2.52-2-x86_64      125.4 KiB  1568 KiB/s 00:00 [##################################] 100%
 Total (4/4)                        79.5 MiB  22.7 MiB/s 00:03 [##################################] 100%
(4/4) checking keys in keyring                                 [##################################] 100%
(4/4) checking package integrity                               [##################################] 100%
(4/4) loading package files                                    [##################################] 100%
(4/4) checking for file conflicts                              [##################################] 100%
(4/4) checking available disk space                            [##################################] 100%
:: Processing package changes...
(1/4) installing sdl12-compat                                  [##################################] 100%
(2/4) installing linux515-virtualbox-host-modules              [##################################] 100%
===> You must load vboxdrv module before starting VirtualBox:
===> # modprobe vboxdrv
(3/4) installing virtualbox                                    [##################################] 100%
Optional dependencies for virtualbox
    vde2: Virtual Distributed Ethernet support
    virtualbox-guest-iso: Guest Additions CD image [pending]
    virtualbox-ext-vnc: VNC server support
    virtualbox-sdk: Developer kit
(4/4) installing virtualbox-guest-iso                          [##################################] 100%

===> virtualbox-guest-iso post install message:
===>
===> Redistribution of VBoxGuestAdditions.iso from the binary packages
===> on www.virtualbox.org with Arch Linux has been granted by
===> InnoTek Systemberatung GmbH.
===>
===> By using this package you accept
===> the VirtualBox Personal Use and Evaluation License (PUEL)
===> which can be found here: http://virtualbox.org/wiki/VirtualBox_PUEL
===>
===> If you do not accept this license, you must remove the package immediately.
===>

:: Running post-transaction hooks...
(1/9) Creating system user accounts...
Creating group 'vboxusers' with GID 108.
(2/9) Reloading system manager configuration...
(3/9) Reloading device manager configuration...
(4/9) Arming ConditionNeedsUpdate...
(5/9) Updating the MIME type database...
(6/9) Updating module dependencies...
(7/9) Refreshing PackageKit...
(8/9) Updating icon theme caches...
(9/9) Updating the desktop file MIME type cache...
    ~                                                                               ✔  38m 47s  
    ~                                                                                           ✔ 
    ~                                                                                           ✔ 
    ~                          ```


@Bloodshed_Romance did you get the same output as me.

I used yay, the specific command is
yay -S virtualbox.

I will see if running the command yay -S VirtualBox makes a difference. Let you know in 10 minutes what the result is.

I still can’t install any new packages, Since I am off work tomorrow, and I am having another night of not being able to quiet my mind. So I’ll try and install Arch using a script a friend made for me.

Hi @Bloodshed_Romance, I finally installed Virtualbox on Linux. Installing and configuring Arch took all night, but installing Virtualbox was a snap once I finished that task. I will leave a link to the guide I used to install Virtualbox, and FYI I was right. You had the same error I encountered when installing Virtualbox on Ubuntu.
Install Guide for VirtualBox And Maybe Steam Deck @Bloodshed_Romance I would suggest using this guide; the most up-to-date guide to install Virtualbox is the Arch Wiki. Suppose you have questions or can’t figure out a step in the guide.

You can passthrough individual usb devices with kvm. Also you can use synergy or barrier as a network kvm switch. Use keyboard shortcut to switch between devices.

1 Like

Did not know that. I only use KVM for headless stuff. It has come a long way.

1 Like