Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Installing Native KVM Drivers

Updated on 2024-12-12 GMT+08:00

Scenarios

When optimizing a Linux private image, you need to install native KVM drivers on the ECS. If the drivers have been installed, skip this section.

CAUTION:

If you do not install KVM drivers, NICs of the ECS may not be detected and the ECS cannot communicate with other resources.

Prerequisites

Procedure

Modify the configuration file based on the OS version.

Table 1 Modifying configuration files for different OSs

OS

Configuration

Reference

CentOS/EulerOS

Take CentOS 7.0 as an example.

  1. In the /etc/dracut.conf file, add VirtIO drivers to add_drivers, including virtio_blk, virtio_scsi, virtio_net, virtio_pci, virtio_ring, and virtio. Separate driver names with spaces.
  2. Save and exit the /etc/dracut.conf file and run the dracut -f command to generate initrd again.

CentOS and EulerOS

Ubuntu/Debian

  1. In the /etc/initramfs-tools/modules file, add VirtIO drivers, including virtio_blk, virtio_scsi, virtio_net, virtio_pci, virtio_ring, and virtio. Separate driver names with spaces.
  2. Save and exit the /etc/initramfs-tools/modules file and run the update-initramfs -u command to generate initrd again.

Ubuntu and Debian

SUSE and openSUSE

If the OS version is earlier than SUSE 12 SP1 or openSUSE 13:

  1. In the /etc/sysconfig/kernel file, add VirtIO drivers to INITRD_MODULES="". VirtIO drivers include virtio_blk, virtio_scsi, virtio_net, virtio_pci, virtio_ring, and virtio. Separate driver names with spaces.
  2. Run the mkinitrd command to generate initrd again.

SUSE and openSUSE (Earlier than SUSE 12 SP1 or openSUSE 13)

If the OS version is SUSE 12 SP1:

  1. In the /etc/dracut.conf file, add VirtIO drivers to add_drivers. VirtIO drivers include virtio_blk, virtio_scsi, virtio_net, virtio_pci, virtio_ring, and virtio. Separate driver names with spaces.
  2. Run the dracut -f command to generate initrd again.

SUSE and openSUSE (SUSE 12 SP1)

If the OS version is later than SUSE 12 SP1 or openSUSE 13:

  1. In the /etc/dracut.conf file, add VirtIO drivers to add_drivers, including virtio_blk, virtio_scsi, virtio_net, virtio_pci, virtio_ring, and virtio. Separate driver names with spaces.
  2. Save and exit the /etc/dracut.conf file and run the dracut -f command to generate initrd again.

SUSE and openSUSE (Later than SUSE 12 SP1 or openSUSE 13)

CentOS and EulerOS

  1. Run the following command to open the /etc/dracut.conf file:

    vi /etc/dracut.conf

  2. Press i to enter the editing mode and add VirtIO drivers to add_drivers (the format varies depending on the OS).
    [root@CTU10000xxxxx ~]# vi /etc/dracut.conf 
    # additional kernel modules to the default 
    add_drivers+="virtio_blk virtio_scsi virtio_net virtio_pci virtio_ring virtio" 
    ....
  3. Press Esc, enter :wq, and press Enter. The system saves the change and exits the /etc/dracut.conf file.
  4. Run the following command to regenerate initrd:

    dracut -f /boot/initramfs-2.6.32-573.8.1.el6.x86_64.img

    If the virtual file system is not the default initramfs, run the dracut -f Name of the initramfs or initrd file actually used command. The actual initramfs or initrd file name can be obtained from the grub.cfg file, which can be /boot/grub/grub.cfg, /boot/grub2/grub.cfg, or /boot/grub/grub.conf depending on the OS.

  5. If the virtual file system is initramfs, run the following command to check whether native KVM drivers have been installed:

    lsinitrd /boot/initramfs-`uname -r`.img | grep virtio

    If the virtual file system is initrd, run the following command to check whether native KVM drivers have been installed:

    lsinitrd /boot/initrd-`uname -r` | grep virtio

    Assume that the virtual file system is initramfs. The following command output will be displayed:

    [root@CTU10000xxxxx home]# lsinitrd /boot/initramfs-`uname -r`.img | grep virtio 
    -rwxr--r--   1 root     root        23448 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/block/virtio_blk.ko 
    -rwxr--r--   1 root     root        50704 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/net/virtio_net.ko 
    -rwxr--r--   1 root     root        28424 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/scsi/virtio_scsi.ko 
    drwxr-xr-x   2 root     root            0 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/virtio 
    -rwxr--r--   1 root     root        14544 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/virtio/virtio.ko 
    -rwxr--r--   1 root     root        21040 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/virtio/virtio_pci.ko 
    -rwxr--r--   1 root     root        18016 Jul 16 17:53 lib/modules/2.6.32-573.8.1.el6.x86_64/kernel/drivers/virtio/virtio_ring.ko
    NOTE:

    If you add built-in drivers to the initrd or initramfs file, the ECS will not be affected. This makes it easy to modify the drivers. However, you cannot check the drivers by running the lsinitrd command. You can run the following command to check whether the drivers are built-in ones in the kernel:

    cat /boot/config-`uname -r` | grep CONFIG_VIRTIO | grep y

Ubuntu and Debian

  1. Run the following command to open the modules file:

    vi /etc/initramfs-tools/modules

  2. Press i to enter the editing mode and add VirtIO drivers to the /etc/initramfs-tools/modules file (the format varies depending on the OS).
    [root@CTU10000xxxxx ~]#vi /etc/initramfs-tools/modules 
    ...
    # Examples: 
    # 
    # raid1 
    # sd_mOd 
    virtio_blk
    virtio_scsi
    virtio_net
    virtio_pci
    virtio_ring
    virtio
  3. Press Esc, enter :wq, and press Enter. The system saves the change and exits the /etc/initramfs-tools/modules file.
  4. Run the following command to regenerate initrd:

    update-initramfs -u

  5. Run the following command to check whether native KVM drivers have been installed:

    lsinitramfs /boot/initrd.img-`uname -r` |grep virtio

    [root@ CTU10000xxxxx home]# lsinitramfs /boot/initrd.img-`uname -r` |grep virtio 
    lib/modules/3.5.0-23-generic/kernel/drivers/scsi/virtio_scsi.ko
    NOTE:

    If you add built-in drivers to the initrd or initramfs file, the ECS will not be affected. This makes it easy to modify the drivers. However, you cannot check the drivers by running the lsinitrd command. You can run the following command to check whether the drivers are built-in ones in the kernel:

    [root@ CTU10000xxxxx home]# cat /boot/config-`uname -r` | grep CONFIG_VIRTIO | grep y
    CONFIG_VIRTIO_BLK=y
    CONFIG_VIRTIO_NET=y
    CONFIG_VIRTIO=y
    CONFIG_VIRTIO_RING=y
    CONFIG_VIRTIO_PCI=y
    CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y

SUSE and openSUSE (Earlier than SUSE 12 SP1 or openSUSE 13)

Modify the /etc/sysconfig/kernel file.
  1. Run the following command to modify the /etc/sysconfig/kernel file:

    vi /etc/sysconfig/kernel

  2. Add VirtIO drivers to INITRD_MODULES="" (the format of drivers depends on the OS).
    SIA10000xxxxx:~ # vi /etc/sysconfig/kernel 
    # (like drivers for scsi-controllers, for lvm or reiserfs)
    #
    INITRD_MODULES="ata_piix ata_generic virtio_blk virtio_scsi virtio_net virtio_pci virtio_ring virtio"
  3. Run the mkinitrd command to generate initrd again.
    NOTE:

    If the virtual file system is not the default initramfs or initrd, run the dracut -f Name of the initramfs or initrd file actually used command. The actual initramfs or initrd file name can be obtained from the menu.lst or grub.cfg file (/boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg).

    The following is an example initrd file of SUSE 11 SP4:

    default 0 
    timeout 10 
    gfxmenu (hd0,0)/boot/message 
    title sles11sp4_001_[_VMX_] 
    root (hd0,0) 
    kernel /boot/linux.vmx vga=0x314 splash=silent console=ttyS0,115200n8 console=tty0 net.ifnames=0 NON_PERSISTENT_DEVICE_NAMES=1 showopts 
    initrd /boot/initrd.vmx 
    title Failsafe_sles11sp4_001_[_VMX_] 
    root (hd0,0) 
    kernel /boot/linux.vmx vga=0x314 splash=silent ide=nodma apm=off noresume edd=off powersaved=off nohz=off highres=off processsor.max+cstate=1 nomodeset x11failsafe console=ttyS0,115200n8 console=tty0 net.ifnames=0 NON_PERSISTENT_DEVICE_NAMES=1 showopts 
    initrd /boot/initrd.vmx

    /boot/initrd.vmx in the initrd line is the initrd file actually used. Run the dracut -f /boot/initrd.vmx command. If the initrd file does not contain the /boot directory, such as /initramfs-xxx, run the dracut -f /boot/initramfs-xxx command.

  4. Run the following command to check whether KVM VirtIO drivers have been installed:
    lsinitrd /boot/initrd-`uname -r` | grep virtio
    SIA10000xxxxx:~ # lsinitrd /boot/initrd-`uname -r` | grep virtio
    -rwxr--r-- 1 root root 19248 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/scsi/virtio_scsi.ko
    -rwxr--r-- 1 root root 23856 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/block/virtio_blk.ko
    drwxr-xr-x 2 root root 0 Jul 12 14:53 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/virtio
    -rwxr--r-- 1 root root 15848 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/virtio/virtio_ring.ko
    -rwxr--r-- 1 root root 20008 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/virtio/virtio_pci.ko
    -rwxr--r-- 1 root root 12272 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/virtio/virtio.ko
    -rwxr--r-- 1 root root 38208 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/net/virtio_net.ko
  5. Restart the ECS.
  6. Run the following command to check whether KVM drivers exist in initrd:

    lsinitrd /boot/initrd-`uname -r` | grep virtio

    SIA10000xxxxx:~ # lsinitrd /boot/initrd-`uname -r` | grep virtio
    -rwxr--r-- 1 root root 19248 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/scsi/virtio_scsi.ko
    -rwxr--r-- 1 root root 23856 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/block/virtio_blk.ko
    drwxr-xr-x 2 root root 0 Jul 12 14:53 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/virtio
    -rwxr--r-- 1 root root 15848 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/virtio/virtio_ring.ko
    -rwxr--r-- 1 root root 20008 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/virtio/virtio_pci.ko
    -rwxr--r-- 1 root root 12272 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/virtio/virtio.ko
    -rwxr--r-- 1 root root 38208 Jun 22 2012 lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/net/virtio_net.ko
    NOTE:

    If you add built-in drivers to the initrd or initramfs file, the ECS will not be affected. This makes it easy to modify the drivers. However, you cannot check the drivers by running the lsinitrd command. You can run the following command to check whether the drivers are built-in ones in the kernel:

    cat /boot/config-`uname -r` | grep CONFIG_VIRTIO | grep y

SUSE and openSUSE (SUSE 12 SP1)

Modify the /etc/dracut.conf file.
  1. Run the following command to open the /etc/dracut.conf file:

    vi /etc/dracut.conf

  2. Press i to enter the editing mode and add VirtIO drivers to add-drivers (the format varies depending on the OS).
    [root@CTU10000xxxxx ~]# vi /etc/dracut.conf 
    # additional kernel modules to the default
    add_drivers+="ata_piix ata_generic virtio_blk virtio_scsi virtio_net virtio_pci virtio_ring virtio"
  3. Press Esc, enter :wq, and press Enter. The system saves the change and exits the /etc/dracut.conf file.
  4. Run the following command to regenerate initrd:

    dracut -f /boot/initramfs-File name

    If the virtual file system is not the default initramfs, run the dracut -f Name of the initramfs or initrd file actually used command. The actual initramfs or initrd file name can be obtained from the grub.cfg file, which can be /boot/grub/grub.cfg, /boot/grub2/grub.cfg, or /boot/grub/grub.conf depending on the OS.

  5. If the virtual file system is initramfs, run the following command to check whether native KVM drivers have been installed:

    lsinitrd /boot/initramfs-`uname -r`.img | grep virtio

    If the virtual file system is initrd, run the following command to check whether native KVM drivers have been installed:

    lsinitrd /boot/initrd-`uname -r` | grep virtio

SUSE and openSUSE (Later than SUSE 12 SP1 or openSUSE 13)

Modify the /etc/dracut.conf file.

Take SUSE Linux Enterprise Server 12 SP2 (x86_64) as an example.
  1. Run the following command to open the /etc/dracut.conf file:

    vi /etc/dracut.conf

  2. Press i to enter the editing mode and add VirtIO drivers to add_drivers (the format varies depending on the OS).
    [root@CTU10000xxxxx ~]# vi /etc/dracut.conf 
    # additional kernel modules to the default
    add_drivers+="ata_piix ata_generic virtio_blk virtio_scsi virtio_net virtio_pci virtio_ring virtio"
  3. Press Esc, enter :wq, and press Enter. The system saves the change and exits the /etc/dracut.conf file.
  4. Run the following command to regenerate initrd:

    dracut -f /boot/initramfs-File name

    If the virtual file system is not the default initramfs, run the dracut -f Name of the initramfs or initrd file actually used command. The actual initramfs or initrd file name can be obtained from the grub.cfg file, which can be /boot/grub/grub.cfg, /boot/grub2/grub.cfg, or /boot/grub/grub.conf depending on the OS.

  5. If the virtual file system is initramfs, run the following command to check whether native KVM drivers have been installed:

    lsinitrd /boot/initramfs-`uname -r`.img | grep virtio

    If the virtual file system is initrd, run the following command to check whether native KVM drivers have been installed:

    lsinitrd /boot/initrd-`uname -r` | grep virtio

    Assume that the virtual file system is initrd. The following command output will be displayed:

    sluo-ecs-30dc:~ # lsinitrd /boot/initrd-`uname -r` | grep virtio
    -rw-r--r-- 1 root root 29335 Oct 26 2016 lib/modules/4.4.21-69-default/kernel/drivers/block/virtio_blk.ko
    -rw-r--r-- 1 root root 57007 Oct 26 2016 lib/modules/4.4.21-69-default/kernel/drivers/net/virtio_net.ko
    -rw-r--r-- 1 root root 32415 Oct 26 2016 lib/modules/4.4.21-69-default/kernel/drivers/scsi/virtio_scsi.ko
    drwxr-xr-x 2 root root 0 Sep 28 10:21 lib/modules/4.4.21-69-default/kernel/drivers/virtio
    -rw-r--r-- 1 root root 19623 Oct 26 2016 lib/modules/4.4.21-69-default/kernel/drivers/virtio/virtio.ko
    -rw-r--r-- 1 root root 38943 Oct 26 2016 lib/modules/4.4.21-69-default/kernel/drivers/virtio/virtio_pci.ko
    -rw-r--r-- 1 root root 24431 Oct 26 2016 lib/modules/4.4.21-69-default/kernel/drivers/virtio/virtio_ring.ko
    NOTE:

    If you add built-in drivers to the initrd or initramfs file, the ECS will not be affected. This makes it easy to modify the drivers. However, you cannot check the drivers by running the lsinitrd command. You can run the following command to check whether the drivers are built-in ones in the kernel:

    cat /boot/config-`uname -r` | grep CONFIG_VIRTIO | grep y

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback