使用 libvirt 启动 Codeready 容器导致 "format of backing image was not specified in the image metadata"

Starting Codeready Container with libvirt cause "format of backing image was not specified in the image metadata"

我正在尝试使用 CRC 在我的笔记本电脑上测试 Openshift 4 (Ubuntu 20)。 CRC 1.17 版不支持 Virtualbox 虚拟化,因此请按照设置说明进行操作

https://access.redhat.com/documentation/en-us/red_hat_codeready_containers/1.17/html/getting_started_guide/installation_gsg

我正在使用 libvirt,但是当我使用 crc start 启动集群时,它会启动以下错误

INFO Checking if oc binary is cached              
INFO Checking if podman remote binary is cached   
INFO Checking if goodhosts binary is cached       
INFO Checking minimum RAM requirements            
INFO Checking if running as non-root              
INFO Checking if Virtualization is enabled        
INFO Checking if KVM is enabled                   
INFO Checking if libvirt is installed             
INFO Checking if user is part of libvirt group    
INFO Checking if libvirt daemon is running        
INFO Checking if a supported libvirt version is installed 
INFO Checking if crc-driver-libvirt is installed  
INFO Checking if libvirt 'crc' network is available 
INFO Checking if libvirt 'crc' network is active  
INFO Checking if NetworkManager is installed      
INFO Checking if NetworkManager service is running 
INFO Checking if /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf exists 
INFO Checking if /etc/NetworkManager/dnsmasq.d/crc.conf exists 
INFO Starting CodeReady Containers VM for OpenShift 4.5.14... 
ERRO Error starting stopped VM: virError(Code=55, Domain=18, Message='Requested operation is not valid: format of backing image '/home/claudiomerli/.crc/cache/crc_libvirt_4.5.14/crc.qcow2' of image '/home/claudiomerli/.crc/machines/crc/crc.qcow2' was not specified in the image metadata (See https://libvirt.org/kbase/backing_chains.html for troubleshooting)') 
Error starting stopped VM: virError(Code=55, Domain=18, Message='Requested operation is not valid: format of backing image '/home/claudiomerli/.crc/cache/crc_libvirt_4.5.14/crc.qcow2' of image '/home/claudiomerli/.crc/machines/crc/crc.qcow2' was not specified in the image metadata (See https://libvirt.org/kbase/backing_chains.html for troubleshooting)')

我没有使用 libvirt 的经验,所以我坚持使用它,在网上我没有找到任何东西...... 谢谢

crc_libvirt_4.5.14 图片有问题。修复它的最简单方法是执行

qemu-img rebase -f qcow2 -F qcow2 -b /home/${USER}/.crc/cache/crc_libvirt_4.5.14/crc.qcow2 /home/${USER}/.crc/machines/crc/crc.qcow2

现在,如果您尝试执行 crc start,您将面临与 Apparmor 相关的“权限被拒绝”错误,除非您将主目录列入白名单。如果你不想修改 Apparmor 设置,/var/lib/libvirt/images 应该被列入白名单。将图像移动到那里:

sudo mv /home/${USER}/.crc/machines/crc/crc.qcow2 /var/lib/libvirt/images

然后编辑指向新映像位置的虚拟机设置:virsh edit crc,然后将 <source file='/home/yourusername/.crc/machines/crc/crc.qcow2'/> 替换为 <source file='/var/lib/libvirt/images/crc.qcow2'/>

然后执行 crc start 然后...就是这样。

相关 Github 问题如下: