大多数克隆后的虚拟机文件,更改之后重新运行会报一些小错误,总结了自己遇到的个别几个
PCI绑定报错
error: unsupported configuration: host doesn't support passthrough of host PCI devices
开启Bios中CPU的虚拟化,并修改grub参数
[root@t8 ~]# vim /boot/efi/EFI/centos/grub.cfg
# 找到kernel的两个位置,在末尾添加intel_iommu=on
重启服务器
[root@t8 ~]# lsmod | grep iommu
vfio_iommu_type1 22300 0
vfio 32656 2 vfio_iommu_type1,vfio_pci
使用spice报错
error: Cannot check QEMU binary /usr/bin/kvm-spice: No such file or directory
解决
安装qemu-system等rpm包
# yum -y install qemu-system*
链接文件
# ln -s /usr/bin/qemu-system-x86_64 /usr/bin/kvm-spice
vmport报错
error: unsupported configuration: vmport is not available with this QEMU binary
解决
qemu版本问题,默认安装的是1.5.3的,而vmport是2.0.0之后才开始支持的
先安装依赖库
# yum -y install gcc gcc-c++ automake libtool zlib-devel glib2-devel \
bzip2-devel libuuid-devel spice-protocol spice-server-devel \
usbredir-devel libaio-devel glib-devel glibc-devel glib2-devel
下载源码包
# wget https://download.qemu.org/qemu-2.11.1.tar.xz
解压安装
xz -d qemu-2.11.1.tar.xz
tar xvf qemu-2.11.1.tar -C /usr/src
cd /usr/src/qemu-2.11.1
./configure --prefix=/usr/local/qemu --target-list=x86_64-softmmu --enable-kvm --enable-user --enable-linux-user
make -j 10
make install
命令软链
rm -rf /usr/bin/qemu-imm /usr/bin/qemu-io /usr/bin/qemu-nbd /usr/bin/qemu-system-x86_64
cd /usr/local/qemu/bin
ln -s * /usr/bin/
ln -s /usr/local/qemu/bin/qemu-system-x86_64 /usr/bin/kvm-spice
查看版本
[root@t8 bin]# qemu-img -V
qemu-img version 2.11.1
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
Permission denied
error: internal error: process exited while connecting to monitor: libvirt: error : cannot execute binary /usr/bin/kvm-spice: Permission denied
解决:关闭沙河
setenforce 0
vim /etc/selinux/config