Lately I’ve been getting away from VirtualBox and back to using Qemu. If you use the Aqemu gui to control qemu, it really is just as good, or in my opinion, better than VirtualBox. But, as that is not the topic of this post, I’ll leave my preferences to the side for now. I did, however, run into an odd problem with Aqemu and Qemu when it came to a USB pass-through the other day, and I thought I’d share my experience in hopes of helping out the next guy.
To best understand the issue, I’ll mention the goal and setup first. I wanted to utilize my home server, which has 32 GB of ram and lots of computing resources to also run a virtual machine that I can use for working with HAM radio programs. Originally, I had a dedicated computer for this, but the issue I came across was that I had a conflict between dependencies for two different programs, meaning I could only install a dependency to do one or the other. My mind wandered to virtual machines as an easy fix, as then I could load whichever machine set up for either set of programs.
With that setup, I also need to pass through my SignaLink USB sound card and radio controller to the virtual machine. Ordinarily, this would be quite simple, as in Aqemu, you select Media, then USB, then the USB port you want and choose the device on it that you need to pass through. But for some reason, it would error saying it couldn’t find “usb.0”.
So I started working with Qemu manually on the command line to be better situated to find and fix the error. No matter how hard I tried, using the normal method of setting the id, the bus, and the address didn’t work, like this:
-device piix3-usb-uhci,id=usb1,bus=pci.0,addr=0x5 \
Instead, what I found to work really well was to specify the vendor and device ID, like so:
-device usb-host,vendorid=0x08bb,productid=0x29c6 \
Thanks be to God, that worked much better! Keep in mind, if you specify a specific vendor and product ID like this, it must be present to start the VM or it will error out. My finished command looked like this:
$ /usr/bin/qemu-system-x86_64 \
-monitor stdio \
-soundhw ac97 \
-machine accel=kvm \
-m 8192 \
-hda /home/alaskalinuxuser/.aqemu/Ubuntu20_HDA.img \
-boot order=adc,menu=on \
-net nic \
-net user \
-usb \
-device usb-host,vendorid=0x08bb,productid=0x29c6 \
-rtc base=localtime \
-alt-grab \
-name "Ubuntu20"
Depending, you may need root permission or be part of a group to access certain devices, such as directly stealing USB interfaces, KVM, etc. Hopefully that helps the next guy trying to do something like this. And if you are a Linux user running VirtualBox, you might give Qemu/Aqemu a try, I find it works much faster and is very easy to script and configure.
Linux – keep it simple.