我正在尝试使用 CRC 在我的笔记本电脑 (Ubuntu 20) 上测试 Openshift 4。 CRC 版本 1.17 不支持 Virtualbox 虚拟化,因此请按照设置说明进行操作
我正在使用 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 问题:
关于kubernetes - 使用 libvirt 启动 Codeready 容器会导致 "format of backing image was not specified in the image metadata",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64413928/