Virt-Manager

添加設備時出錯:不支持配置:僅支持直通訪問模式

  • August 30, 2020

使用 virt-manager 2.2.1,我試圖在 Arch Linux 主機和 Kali 來賓之間創建一個共享目錄。

我去了“添加新的虛擬硬體”→“文件系統”:

virt-manager 截圖

點擊“完成”,我收到以下錯誤消息:

Error adding device: unsupported configuration: only supports passthrough accessmode

Traceback (most recent call last):
 File "/usr/share/virt-manager/virtManager/addhardware.py", line 1351, in _add_device
   self.vm.add_device(dev)
 File "/usr/share/virt-manager/virtManager/object/domain.py", line 408, in add_device
   self._redefine_xmlobj(xmlobj)
 File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 417, in _redefine_xmlobj
   self._redefine_xml_internal(origxml, newxml)
 File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 395, in _redefine_xml_internal
   self._define(newxml)
 File "/usr/share/virt-manager/virtManager/object/domain.py", line 999, in _define
   self.conn.define_domain(xml)
 File "/usr/share/virt-manager/virtManager/connection.py", line 612, in define_domain
   return self._backend.defineXML(xml)
 File "/usr/lib/python3.8/site-packages/libvirt.py", line 4048, in defineXML
   if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
libvirt.libvirtError: unsupported configuration: only supports passthrough accessmode

有沒有辦法解決這個問題並擁有一個共享目錄?

我不得不將驅動程序從“Handle”更改為“Path”:

virt-manager 共享目錄配置

這些是使共享目錄工作的設置和命令:

在虛擬管理器中:

  • 司機:路徑
  • 模式:映射
  • 寫策略:立即

在主機上為共享目錄設置的權限:

  • sudo chgrp kvm shared/
  • chmod 770 shared/

在來賓中掛載共享目錄:

sudo mount -t 9p -o trans=virtio /hostshare /home/guest/shared

/hostshare部分是使用 virt-manager 定義的“目標路徑”。

在來賓中,共享目錄位於/home/guest/shared.

引用自:https://unix.stackexchange.com/questions/606816