KVM:错误:内部错误:无法加载AppArmor配置文件'libvirt-8e78cfba-5124-4689-84bf-644bece5ac4b'

时间:2018-08-26 05:17:25

标签: kvm ubuntu-18.04 apparmor

我只是使用标准方法从16.04.4迁移到Ubuntu 18.04.1。问题之一是我无法再运行KVM虚拟机。我收到如下的AppArmor错误。

Error starting domain: internal error: cannot load AppArmor profile 'libvirt-32974b29-7f8e-421e-aa39-2a77f14faf98'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in      cb_wrapper
  callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 125, in tmpcb
  callback(*args, **kwargs)
File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 82, in newfn
  ret = fn(self, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/domain.py", line 1508, in startup
self._backend.create()
File "/usr/lib/python2.7/dist-packages/libvirt.py", line 1062, in create
  if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error: cannot load AppArmor profile 'libvirt-8e78cfba-5124-4689-84bf-644bece5ac4b'

我看过文件

我查看了系统上的文件,并获得了我的vms的配置文件:

ls -al /etc/apparmor.d/libvirt

drwxr-xr-x 2 root root 4096 אוג 24 18:18 .
drwxr-xr-x 9 root root 4096 אוג 24 18:21 ..
-rw-r--r-- 1 root root  265 נוב  7  2017 libvirt-8e78cfba-5124-4689-84bf-644bece5ac4b
-rw-r--r-- 1 root root  639 אוג  7 10:58 libvirt-8e78cfba-5124-4689-84bf-644bece5ac4b.files
-rw-r--r-- 1 root root  342 יונ 13 11:48 TEMPLATE.lxc
-rw-r--r-- 1 root root  192 יונ 13 11:48 TEMPLATE.qemu

配置文件如下

cat  /etc/apparmor.d/libvirt/libvirt-8e78cfba-5124-4689-84bf-644bece5ac4b

#
# This profile is for the domain whose UUID matches this file.
#

#include <tunables/global>

profile libvirt-8e78cfba-5124-4689-84bf-644bece5ac4b {
  #include <abstractions/libvirt-qemu>
  #include <libvirt/libvirt-8e78cfba-5124-4689-84bf-644bece5ac4b.files>

}

cat  /etc/apparmor.d/libvirt/libvirt-8e78cfba-5124-4689-84bf-644bece5ac4b.files 

# DO NOT EDIT THIS FILE DIRECTLY. IT IS MANAGED BY LIBVIRT.
  "/var/log/libvirt/**/win-dev-2.log" w,
  "/var/lib/libvirt/qemu/domain-win-dev-2/monitor.sock" rw,
  "/var/run/libvirt/**/win-dev-2.pid" rwk,
  "/run/libvirt/**/win-dev-2.pid" rwk,
  "/var/run/libvirt/**/*.tunnelmigrate.dest.win-dev-2" rw,
  "/run/libvirt/**/*.tunnelmigrate.dest.win-dev-2" rw,
  "/home/yoram/dev/vms/kvm/win-dev-v2.qcow2" rw,
  "/home/yoram/apps/isos/microsoft-office-2016/en_office_professional_plus_2016_x86_x64_dvd_6962141.iso" r,
  # for qemu guest agent channel
  owner "/var/lib/libvirt/qemu/channel/target/domain-win-dev-2/**" rw,
  "/dev/net/tun" rw,

有什么想法吗?

2 个答案:

答案 0 :(得分:0)

我认为删除AppArmor不是一个好主意,我邀请您检查一下:https://en.wikipedia.org/wiki/AppArmor 无论如何,此错误发生在apt-get update && apt-get upgrade之后的我的机器上。 重新启动计算机足以使整个设备恢复正常。

答案 1 :(得分:-1)

只需删除apparmor并重新启动即可。

sudo apt remove apparmor 

它有效...