我已经了解到,CirrusCI在他们的免费包中提供嵌套虚拟化,用于公共恢复,我正在尝试利用它来测试我的“Ansible”游戏手册。
不幸的是,libvirt坚持认为CI环境不支持完全虚拟化。所有的检查(我都知道)证明了相反的情况,当直接调用qemu时,qemu工作得很好。我几乎可以肯定,问题在于我的主机操作系统配置,而不是CI引擎。我见过其他人为了他们的目的而在CirrusCI上使用完全虚拟化(Android仿真、氧化还原测试)。
我使用Debian 10作为主机系统,使用DockerHub提供的瘦映像,并安装了以下额外的软件包(--不安装-建议):
bridge-utils libguestfs-tools python3-dev
coreutils libosinfo-bin python3-venv
cpu-checker libssl-dev qemu-kvm
curl libvirt-clients qemu-kvm
gcc libvirt-daemon qemu-utils
gpg libvirt-daemon-system systemd
gpg-agent linux-image-amd64 vagrant
iproute2 make vagrant-libvirt
kmod procps virt-goodies
libc-dev python3 virtinst
libffi-dev我可能错过了什么?当qemu完美工作时,为什么libvirt会告诉我们没有KVM呢?
Error while creating domain: Error saving the server: Call to virDomainDefineXML failed: invalid argument: could not find capabilities for domaintype=kvmvirsh capabilities只包含条目。
不一致行为的
任何基于libvirt的工具都无法调用KVM:
$ virt-install --import --virt-type kvm --name debian10-vm --memory 512 --disk path=/debian.qcow2,format=qcow2 --os-variant debian10 --noautoconsole || echo "Exit code: $?"
ERROR Host does not support domain type kvm for virtualization type 'hvm' arch 'x86_64'
Exit code: 1但是,qemu在直接执行时工作:
$ kvm -nographic /debian.qcow2
cSeaBIOS (version 1.12.0-1)
iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+07F900F0+07ED00F0 C980
Press Ctrl-B to configure iPXE (PCI 00:03.0)...
Booting from Hard Disk...
GNU GRUB version 2.02+dfsg1-20
...lsmod显示kvm和kvm_intel被加载。cat /proc/cpuinfo -包含vmx标志lscpu -虚拟化类型:完全kvm-ok -好的ls -l /dev/kvm -存在,由root拥有:rdmals -l /var/run/libvirt -套接字存在,由root拥有:rootwhoami -根groups $(whoami) -根systemctl status - systemd未启动,libvirtd通过CI规则启动。virt-host-validate -所有的检查通行证,除了IOMMU -不应该对我的用例很重要。完整的列表可以在CI测井的"kvm_before“部分找到。
发布于 2020-02-06 15:50:05
大多数发行版libvirt包将被配置为以qemu:qemu用户的身份运行qemu。请参阅由UID+GID报告的virsh --connect qemu:///system capabilities | grep baselabel。如果发行版是这样的,那么qemu没有访问/dev/kvm的权限,因此libvirt没有宣传kvm支持。chmod 666 /dev/kvm应该修复它。这是Fedora FWIW中的缺省值。
发布于 2022-03-01 00:30:28
对于ubuntu,我也有过同样的经历。
我运行这个是为了确保没有任何东西被移除
sudo apt-get install qemu uml-utilities virt-manager git wget libguestfs-tools p7zip-full uml-utilities virt-viewer qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils -y都安装好了这太奇怪了。
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'qemu-system-x86' instead of 'qemu-kvm'
bridge-utils is already the newest version (1.7-1ubuntu2).
git is already the newest version (1:2.32.0-1ubuntu1).
wget is already the newest version (1.21-1ubuntu3).
libguestfs-tools is already the newest version (1:1.44.1-1ubuntu6).
p7zip-full is already the newest version (16.02+dfsg-8).
uml-utilities is already the newest version (20070815.4-1).
virt-manager is already the newest version (1:3.2.0-3).
virt-viewer is already the newest version (7.0-2build1).
qemu-system-x86 is already the newest version (1:6.0+dfsg-2expubuntu1.2).
qemu is already the newest version (1:6.0+dfsg-2expubuntu1.2).
libvirt-clients is already the newest version (7.6.0-0ubuntu1.1).
libvirt-daemon-system is already the newest version (7.6.0-0ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.我比重新运行用户组和bam的命令更开始工作。超级奇怪,但可能对他人有帮助
sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER发布于 2020-09-23 12:02:33
这是对科尔罗宾逊的回答的延伸,这对我在Ubuntu上找出了一个类似的问题很有帮助。
我认为Debian的方式与Ubuntu相同,在Ubuntu中,您需要安装qemu-system-x86,/dev/kvm神奇地变成了kvm组的可写组和所有者(而不是0600根:root)。
Debian/Ubuntu上的libvirtd默认使用libvirt-qemu用户,该用户的主要组是kvm。
https://serverfault.com/questions/1002043
复制相似问题