2012-08-22 18 views
3

我試圖使用libvirt的使用下面的命令來創建一個虛擬機的libvirt錯誤創建虛擬機:第"file"使用與AppArmor的

virsh create file 

內容:

<domain type='qemu' id='3'> 
     <name>testvm</name> 
     <memory>100</memory> 
     <vcpu>1</vcpu> 
     <os> 
       <type arch='i686'>hvm</type> 
     </os> 
     <devices> 
       <disk type='file' device='disk'> 
         <source file='/libtmp/VM-linux.0.2.img'/> 
         <target dev='hdc'/> 
       </disk> 
     </devices> 
     <on_reboot>restart</on_reboot> 
     <on_poweroff>preserve</on_poweroff> 
     <on_crash>restart</on_crash> 
</domain> 

下面是發生錯誤。

error: Failed to create domain from file 
error: internal error cannot load AppArmor profile 'libvirt-9cb01efc-ed3b-ff8e-4de5-7227d311dd15' 

我可以在不加載圖像文件的情況下創建vm。

每次配置文件名稱不斷變化。我試圖阻止它並創建虛擬機,但我得到了同樣的錯誤。

任何指針都會非常有幫助。

回答

0

這是一個工作,但不是正確的方法。使用以下命令將AppArmor設置爲抱怨模式:

sudo aa-complain /usr/sbin/libvirtd 
+0

務必將它帶回AA-強制執行時,即可大功告成 – reedstrm

+0

我完全去除AppArmor的解決與其他服務的多個問題,但是這也殺了我的KVM服務器。我不知道我用'apt remove --purge apparmor *'實際卸載了什麼,而且我也沒有這個命令。有任何想法嗎? –

1

我有同樣的問題,究其原因是,我有一個壞主意,把只讀光盤鏡像到/ etc這樣的:

<disk type="file" device="cdrom"> 
    <driver name='qemu' type="raw" /> 
    <source file="/etc/libvirt/qemu/cdrom.iso" /> 
    <target dev='hdb' bus='virtio'/> 
    <readonly/> 
</disk> 

移動到/ var去掉錯誤信息,並允許啓動虛擬機。這條線:

<source file="/var/lib/libvirt/images/cdrom.iso" />