Linux, 工作, 生活, 家人

Ubuntu, ARM

Unable to complete install: internal error: cannot load AppArmor profile libvirt

ARM64 系統 + Ubuntu 20.04 裝 virt-manager 碰到一些問題,第一關是碰到 libvirtd 被 mask 掉了,這個簡單

systemctl umask libvertd 

就可以 unmask 了,這指令我實在是太少用,都記不起來以前有沒有碰過,第二關忘了是什麼錯誤訊息,大致上好像是沒辦法 link 到 libvirtd-ro 之類的,索性手動啟動所有的 libvirtd-* service

$ sudo systemctl start virtlogd
$ sudo systemctl enable virtlogd
$ sudo systemctl enable virtlockd
$ sudo systemctl start virtlockd
$ sudo systemctl start libvirtd-admin.socket
$ sudo systemctl enable libvirtd-admin.socket
$ sudo systemctl start libvirtd-ro.socket
$ sudo systemctl enable libvirtd-ro.socket
$ sudo systemctl enable libvirtd.socket
$ sudo systemctl start libvirtd.socket

最後應該是出現了一個 AppArmor 的錯誤訊息,像是這個

Unable to complete install: 'internal error: cannot load AppArmor profile 'libvirt-df1a8e70-7a27-41e4-a7cc-ea065d3b3699''

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 75, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/createvm.py", line 2089, in _do_async_install
    guest.installer_instance.start_install(guest, meter=meter)
  File "/usr/share/virt-manager/virtinst/install/installer.py", line 542, in start_install
    domain = self._create_guest(
  File "/usr/share/virt-manager/virtinst/install/installer.py", line 491, in _create_guest
    domain = self.conn.createXML(install_xml or final_xml, 0)
  File "/usr/lib/python3/dist-packages/libvirt.py", line 4034, in createXML
    if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self)
libvirt.libvirtError: internal error: cannot load AppArmor profile 'libvirt-df1a8e70-7a27-41e4-a7cc-ea065d3b3699'

試過了很多方式,都沒有辦法繞過 AppArmor ,最後只好放大絕,不要讓 qemu 使用 AppArmor ,不安全就算了對吧,

$ sudo vim /etc/libvirt/qemu.conf

# Set
security_driver = "none"

然後找到 security_driver 這個參數,設定成 “none” ,再重新啟動 libvirtd 就可以了
真是莫名其妙的 BUG ,因為其他台機器沒有碰到類似的問題

ref.
libvirt: error : unable to set AppArmor profile

發佈留言