Disable virtio-rng for virtual machines?

I figured out what was causing FreeBSD guests to hog the CPU like the world was about to end and it came down to the virtio-rng device. I basically replicated the virtual machine in virt-manager and without that device, it consumed CPU as one would expect and with the device, it’d hog the CPU.

So, is it possible to prevent LXD from adding that device to the virtual machines somehow? Having the virtio-rng device enabled means the virtual machine performance is far lower than it should and it also unnecessarily wastes power to have it hogging the CPU as well.

Do note that I couldn’t find anything I could do on FreeBSD-side about this, but that could be simply due to me not using the right search terms.

Adding the following to /etc/rc.conf seems to prevent FreeBSD from using the virtio-rng, sidestepping the issue:
devmatch_blacklist="virtio_random.ko"

2 Likes

You might also be able to remove the virtio-rng device by tweaking the QEMU config:

That’s a good tip, I’ll update the tutorial later on to mention that as well.

1 Like