json - qemu :commandline in libvirt? "Permission denied"错误如何解决

标签 json libvirt virsh

请在下面找到我的 dom xml 示例。我正在运行命令 virsh create 并收到此错误:

Unable to open file <json file located inside install_dir>

这个文件的权限都很好。
qemu:commandline下的参数是否需要特殊权限?标签?无论我在本节中提到的参数和文件如何,我都会收到错误消息。
 <domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>my_instance</name>
  <uuid>35615c44-b004-4b3f-9f42-da182b9662ee</uuid>
  <memory unit='KiB'>786432</memory>
  <currentMemory unit='KiB'>786432</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='armv7l' machine='my_machine'>hvm</type>
    <kernel>/home/user/KernelPath/zImage</kernel>
    <dtb>/home/user/DTPPath/emmc.dtb</dtb>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-arm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/home/user/Install_Dir/emmc.dat'/>
      <target dev='sd' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'/>
    <controller type='scsi' index='0'/>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <serial type='pty'>
      <target port='1'/>
    </serial>
    <serial type='pty'>
      <target port='2'/>
    </serial>
    <serial type='pty'>
      <target port='3'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='60316' autoport='no' websocket='60381' listen=''>
      <listen type='address' address=''/>
    </graphics>
    <graphics type='sdl'/>
    <video>
      <model type='qxl'/>
    </video>
    <memballoon model='none'/>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-spdir'/>
    <qemu:arg value='/home/user/Install_Dir'/>
    <qemu:arg value='-show-cursor'/>
  </qemu:commandline>
</domain>

最佳答案

Libvirt 将尝试使用专用用户帐户(通常是 qemu:qemu 用户/组对)运行 guest ,并应用 SELinux 或 AppArmor 规则来限制它。通常,libvirt 会自动设置文件所有权并将 SELinux/AppArmor 策略设置为“正常工作”。 qemu 命令行传递虽然是 libvirt 的一个黑匣子,所以它不知道它需要与您的 /home/user/Install_Dir 相关联。小路。如果您的用户/组所有权是正确的,那么它可能是拒绝访问的 SELinux/AppArmor 策略。唯一可行的解​​决方法是禁用它们(通过 /etc/libvirt/qemu.conf ),并接受较低的安全保护

关于json - qemu :commandline in libvirt? "Permission denied"错误如何解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48657281/

相关文章:

ruby - 使用 ruby​​-libvirt 扩展编译 Mountain Lion 时出现问题

ubuntu - Libvirt Ubuntu 安装 HVM 问题

google-cloud-platform - 为什么一旦实例停止并在一段时间后启动,嵌套虚拟化似乎被禁用?

java - 是否有使用消息参数作为属性创建 JSON 对象的 Logback 布局?

java - 如何在 Java 中将 JSON 数组对象转换为 XML 时添加包装器

java - Json 解析错误 - 类型为 java.lang.String 的值 <br 无法转换为 JSONObject

virtualization - 如何在 libvirt 中创建临时域?

python - 使用 libvirt 和 qemu 监控 VM 迁移时出错

javascript - 如果我希望用户和管理员登录后显示不同的布局,我该怎么办?