linux - KVM guest 操作系统启动错误

标签 linux permissions qemu kvm libvirt

我正在尝试启动 guest 操作系统以继续我的工作,但我的 virsh 安装出现问题。 这是安装脚本的一部分:

qemu-img create -f qcow2 -o preallocation=metadata ~/images/${vm_name}.qcow2 ${pool_size}G

# create dir for images
mkdir ~/images/

virt-install \
--connect qemu:///system \
--name $vm_name \
--ram 10240 \
--vcpus 4 \
--disk ~/images/${vm_name}.qcow2,size=$pool_size,bus=virtio,sparse=false,format=qcow2 \
--network network=default,model=virtio \
--location http://ua.archive.ubuntu.com/dists/trusty-updates/main/installer-amd64/ \
--initrd-inject=$current_dir/preseed.cfg \
--extra-args="file=file:/preseed.cfg vga=788 quiet console=tty0 utf8 console=ttyS0,115200" \
--os-type=linux \
--virt-type kvm \
--video=vga \
--noreboot \
--cpu host \
--hvm

virsh start $vm_name
echo "----------Login to console----------"
virsh console $vm_name

当我尝试将此脚本作为 ./script.sh 之类的文件运行时,它会产生错误:

Formatting '/home/{username}/images/test.qcow2', fmt=qcow2 size=53687091200 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off refcount_bits=16
mkdir: cannot create directory '/home/flash/images/': File exists
ERROR    'DebianDistro' object has no attribute '_prefix'
error: failed to get domain 'test'
error: Domain not found: no domain with matching name 'test'

----------Login to console----------
error: failed to get domain 'test'
error: Domain not found: no domain with matching name 'test'

我已经尝试使用本指南重新安装 kvm qemu 软件包 - https://help.ubuntu.com/community/KVM/Installation 一切顺利完成。 我确信该脚本将像我之前在另一台计算机上使用它一样工作,没有任何问题。

再次尝试: 使用下面的脚本

virt-install --connect qemu:///system -n test -r 10240 \
--vcpus=4 \
--disk path=/data0/images/test.img,size=50,format=qcow2,bus=virtio,cache=none \
--cdrom /home/{username}/Downloads/kvm/ubuntu-14.iso \
--vnc \
--os-type=linux \
--accelerate \
--network network=default \
--hvm

产生错误:

ERROR    internal error: process exited while connecting to monitor: Could not access KVM kernel module: Permission denied
failed to initialize KVM: Permission denied

此外,当我尝试通过 virt-install --os-variant list 列出所有操作系统变体时,它无法识别此命令并尝试启动 guest 操作系统而不是列出变体。

您能帮我找出问题所在吗?

最佳答案

要修复此错误:

ERROR    'DebianDistro' object has no attribute '_prefix'

编辑文件 /usr/share/virt-manager/virtinst/urlfetcher.py 并在第 1034 行更改此内容:

if self._prefix:

对此:

if self._url_prefix:

Ubuntu 14.04。

关于linux - KVM guest 操作系统启动错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37238138/

相关文章:

python - 使用 mysqldump 执行 mySQL 备份时权限被拒绝

azure - Get-AzADAppPermission Id 转换器

docker - docker下ubuntu18.04中binfmt_misc问题

linux - 64 位 Linux 机器上的 32 位 Weblogic 服务器

java - 通过ppk文件和用户名连接cassandra

linux - 使用 MPI 应用程序运行 perf

gdb - 调试在 QEMU 上运行的 GRUB2 EFI 镜像

linux - 解析/proc/pid/smaps输出

google-chrome - 如何私下测试因未在 Chrome 网上应用店中列出而被禁用的 Chrome 扩展程序

linux - QEMU 在哪里映射客户操作系统的内核页面?