Found 0 result in total
Content is empty
If you don't find the content you expect, please try another search term
Last updated:2021-07-16 11:18:19
Run the grep -i virtio /boot/config-$(uname -r) command.
No VIRTIO_BLK and VIRTIO_NET information is found in the output message, which means that no virtio driver is installed in this operating system, and the driver needs to be installed. If the values of the parameters CONFIG_VIRTIO_BLK and CONFIG_VIRTIO_NET are y, the virtio driver is included and can be uploaded directly.
If the values of the parameters CONFIG_VIRTIO_BLK and CONFIG_VIRTIO_NET are m, proceed with Step 2.
Run the lsinitrd /boot/initramfs-$(uname -r).img | grep virtio command (in CentOS or Fedora) or lsinitrd /boot/initrd.img-$(uname -r) | grep virtio command (in Ubuntu or Debian) to check whether virtio is included in the temporary file system.
As shown in the figure below, virtio_blk.ko, virtio_pci.ko and virtio.ko are included, indicating that the virtio_blk driver is included in the system and can be uploaded directly. If the temporary file system does not contain the virtio driver, the temporary file system needs to be fixed.
Check whether the kernel supports the virtio driver by executing the preceding steps. If you find that the kernel supports the virtio driver, but the temporary file system initramfs or initrd does not contain the virtio driver, fix the temporary file system as follows:
CentOS/RedHat 5
mkinitrd -f --allow-missing \
--with=virtio_blk --preload=virtio_blk \
--with=virtio_pci --preload=virtio_pci \
--with=virtio_console --preload=virtio_console \
/boot/initrd-$(uname -r).img $(uname -r)
CentOS/Redhat 6/7
mkinitrd -f --allow-missing \
--with=virtio_blk --preload=virtio_blk \
--with=virtio_pci --preload=virtio_pci \
--with=virtio_console --preload=virtio_console \
/boot/initramfs-$(uname -r).img $(uname -r)
Debian/Ubuntu
echo -e
'nvirtio_blk\nvirtio_pci\nvirtio_console' >> \
/etc/initramfs-tools/modules
mkinitramfs -o /boot/initrd.img-$(uname -r)
If you find that the kernel of the current device does not support the virtio driver, you can refer to the following example to install the virtio driver. The following example uses a CentOS server as an example to describe how to compile and install the virtio driver.
Run uname -r to check the kernel version used in the current system, such as 2.6.32-696.18.7.el6.x86_64 in the example.
Go to the Linux kernel list page to download the source code package of the corresponding kernel version. For example, the URL of the kernel source code package linux-2.6.32.27.tar.gz is https://mirrors.edge.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.27.tar.gz.
make mrproper
symvers_path=$(find /usr/src/ -name **Module.symvers**)
test -f $symvers_path && cp $symvers_path .
cp /boot/config-$(uname -r) ./.config
make menuconfig
When the following window appears, open the virtio configuration:
a. Press Spacebar to select Virtualization, and then press Enter to enter the details window.
b. Confirm whether the Kernel-based Virtual Machine (KVM) support option is selected in the details window.
Note: * indicates that the driver is compiled to the kernel, while m indicates that the driver is compiled as a module.
c. Return to the homepage, select Processor type and features with the up arrow or down arrow key, and then press Enter to enter the details window. Select Paravirtualized guest support with the up arrow or down arrow key, and then press Enter to enter the details window.
Check whether KVM paravirtualized clock and KVM Guest support are selected.
d. Return to the homepage, select Device Drivers with the up arrow or down arrow key, and then press Enter to enter the details window. Select Block devices with the up arrow or down arrow key, and then press Enter to enter the details window. Make sure Virtio block driver (EXPERIMENTAL) is selected.
e. Return to the Device Drivers details window, select Network device support with the up arrow or down arrow key, and then press Enter to enter the details window. Make sure Virtio network driver (EXPERIMENTAL) is selected.
f. Press Esc to exit the kernel configuration window and save the .config file as prompted.
make oldconfig
make prepare
make scripts
make
make install
find /lib/modules/"$(uname -r)"/ -name "virtio.*" | grep -E "virtio.*"
grep -E "virtio.*" < /lib/modules/"$(uname -r)"/modules.builtin
Note: If the file list such as virtio_blk or virtio_pci.virtio_console is output with any command, it indicates that the virtio driver has been installed correctly.
Pure Mode