本文主要介绍如何排查和解决三代实例因Virtio驱动未安装或版本不符合要求导致的实例无法启动问题。
安装驱动前请先安装好kernel-headers和kernel-devel,并确保与kernel版本一致,否则可能会出现安装驱动失败的情况(如有升级kernel,请重启后再安装驱动)。您也可以根据驱动源代码进行编译适配,或提交工单获取支持。
通过脚本检测虚拟机中的Virtio驱动版本是否符合要求。
执行如下命令,使用公网下载检测脚本文件。
wget https://virtio11-drivers.tos-cn-beijing.volces.com/virtio_check
执行如下命令,为脚本文件添加执行权限。
chmod +x ./virtio_check
在脚本文件所在目录中,执行如下命令,检查Virtio驱动版本是否符合要求。
./virtio_check
安装Virtio1.1驱动。
说明
暂仅支持如下操作系统及内核版本,安装Virtio1.1驱动。
镜像版本 | 内核版本 |
---|---|
CentOS 7.9 | 3.10.0-1160.71.1 |
CentOS 7.8 | 3.10.0-1127.19.1 |
CentOS 7.7 | 3.10.0-1062.18 |
CentOS 7.6 | 3.10.0-957.27.2 |
CentOS 7.5 | 3.10.0-862.14.4 |
CentOS 7.4 | 3.10.0-693.21.1 |
CentOS 7.3 | 3.10.0-514.26.2 |
CentOS 7.2 | 3.10.0-327.36.3 |
yum -y install rpm-build redhat-lsb-core yum -y install epel-release sed -e 's!^metalink=!#metalink=!g' \ -e 's!^#baseurl=!baseurl=!g' \ -e 's!//download\.fedoraproject\.org/pub!//mirrors.volces.com!g' \ -i /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing.repo yum -y install --enablerepo=epel dkms wget https://virtio11-drivers.tos-cn-beijing.volces.com/virtio-1.1.0-2.noarch.centos.rpm rpm -i virtio-1.1.0-2.noarch.centos.rpm rm -rf virtio-1.1.0-2.noarch.centos.rpm
yum -y install rpm-build redhat-lsb-core yum -y install epel-release sed -e 's!^metalink=!#metalink=!g' \ -e 's!^#baseurl=!baseurl=!g' \ -e 's!//download\.fedoraproject\.org/pub!//mirrors.ivolces.com!g' \ -i /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing.repo yum -y install --enablerepo=epel dkms wget https://mirrors.ivolces.com/extra-tools/centos/7/rpms/virtio-1.1.0-2.noarch.centos.rpm rpm -i virtio-1.1.0-2.noarch.centos.rpm rm -rf virtio-1.1.0-2.noarch.centos.rpm
apt install -y dkms fakeroot dh-make wget https://virtio11-drivers.tos-cn-beijing.volces.com/virtio_ubuntu-18.04-v11.tar tar xf virtio_ubuntu-18.04-v11.tar cd virtio_ubuntu-18.04-v11/ ./install.sh cd .. rm -rf virtio_ubuntu-18.04-v11*
apt-get install -y dkms fakeroot dh-make wget https://virtio11-drivers.tos-cn-beijing.volces.com/virtio_ubuntu-16.04-kernel-4.4-v11.tar tar xf virtio_ubuntu-16.04-kernel-4.4-v11.tar cd virtio_ubuntu-16.04-kernel-4.4-v11 ./install.sh cd .. rm -rf virtio_ubuntu-16.04-kernel-4.4-v11*
公网安装
apt install -y dkms fakeroot dh-make apt install -y linux-image-$(uname -r) apt install -y linux-headers-$(uname -r) apt install -y linux-tools wget https://virtio11-drivers.tos-cn-beijing.volces.com/virtio-dkms_1.1.0_amd64.deb dpkg -i virtio-dkms_1.1.0_amd64.deb rm -rf virtio-dkms_1.1.0_amd64.deb
内网安装
apt install -y dkms fakeroot dh-make apt install -y linux-image-$(uname -r) apt install -y linux-headers-$(uname -r) apt install -y linux-tools wget https://mirrors.ivolces.com/extra-tools/debian/pool/main/v/virtio-dkms/virtio-dkms_1.1.0_all.deb dpkg -i virtio-dkms_1.1.0_all.deb rm -rf virtio-dkms_1.1.0_all.deb
apt install -y dkms fakeroot dh-make apt install -y linux-image-$(uname -r) apt install -y linux-headers-$(uname -r) apt install -y linux-tools wget https://virtio11-drivers.tos-cn-beijing.volces.com/virtio_1.1.0_all.debian.deb apt-get install -y ./virtio_1.1.0_all.debian.deb rm -rf virtio_1.1.0_all.debian.deb
apt install -y dkms fakeroot dh-make apt install -y linux-image-$(uname -r) apt install -y linux-headers-$(uname -r) apt install -y linux-tools wget https://mirrors.ivolces.com/extra-tools/debian/pool/main/v/virtio/virtio_1.1.0_all.debian.deb apt-get install -y ./virtio_1.1.0_all.debian.deb rm -rf virtio_1.1.0_all.debian.deb