LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   [SOLVED] How do I use virtio drivers in Debian in a KVM virtual machine? (https://www.linuxquestions.org/questions/debian-26/%5Bsolved%5D-how-do-i-use-virtio-drivers-in-debian-in-a-kvm-virtual-machine-4175442186/)

KenJackson 12-19-2012 01:08 PM

[SOLVED] How do I use virtio drivers in Debian in a KVM virtual machine?
 
It amazes me how often I find the answer to a problem when I'm in the process of thinking through how I can most clearly state a question about it. Such was the case today. I'm posting it anyway since it might help someone else. Here is the question I had prepared to post:

----------------------------------------------------
I installed Debian Linux in a virtual machine under KVM on my Fedora host computer. Now I would like to install the virtio drivers.

But the virtio-modules package says,
Quote:

Warning: This package is intended for the use in building debian-installer images only. Do not install it on a normal Debian system.
Oh? So how do I get virtio drivers in my normal Debian system running in a VM?
----------------------------------------------------

The answer came as I searched for a link that referenced virtio drivers. The link I found says the drivers are (optionally) compiled into the Linux kernel and to just add if=virtio at the appropriate place on the command line.

It works! And since Debian uses UUIDs instead of device names, I didn't even have to modify the any grub files.

hanshenrik 07-05-2022 07:50 AM

I did this in a Ubuntu 22.04 guest, but pretty sure the same instructions are valid for Debian:

i got virtio working by adding the following lines to /etc/initramfs-tools/modules
```
virtio_pci
virtio_blk
virtio_net
```
then running `sudo update-initramfs -u`
then rebooting :)
and pretty sure it's running because my disk IO performance almost doubled, the speed of
dd if=/dev/zero of=testfile bs=10M iflag=fullblock status=progress
went from like 100MB/s to 270MB/s

pretty sure the same would work in Debian. I got my info from https://wiki.debian.org/DebianKVMGuests
and other places (that link mentions virtio_pci and virtio_blk but not virtio_net for some reason, i got that from somewhere else)
also when i run sudo dmesg | grep -i virtio
i get:
root@test:~# dmesg | grep -i virtio
[ 8.079545] scsi host2: Virtio SCSI HBA
[ 8.129612] virtio_net virtio2 ens18: renamed from eth0


All times are GMT -5. The time now is 05:05 PM.