AppArmor 오류: 업데이트된 libvirt 버전(1.2.12)에서 lxc를 시작한 후 "잘못된 VM 정의"

AppArmor 오류: 업데이트된 libvirt 버전(1.2.12)에서 lxc를 시작한 후 "잘못된 VM 정의"

최신 버전의 libvirtd에서 LXC를 시작하려고 하는데 다음 오류와 함께 시작되지 않습니다.

$ virsh -c lxc: start textlxc
error: Failed to start domain testlxc
error: internal error: cannot load AppArmor profile 'libvirt-dfb2c573-05cb-4ca3-9e46-bea6cebf0f9f'

오류 메시지/var/log/libvirt/libvirtd.log

2015-06-23 12:13:12.306+0000: 14141: error : virCommandWait:2532 : internal error: Child process (/usr/lib/libvirt/virt-aa-helper -p 0 -c -u libvirt-dfb2c573-05cb-4ca3-9e46-bea6cebf0f9f) unexpected exit status 1: virt-aa-helper: error: /proc/meminfo
virt-aa-helper: error: skipped restricted file
virt-aa-helper: error: invalid VM definition

2015-06-23 12:13:12.306+0000: 14141: error : AppArmorGenSecurityLabel:468 : internal error: cannot load AppArmor profile 'libvirt-dfb2c573-05cb-4ca3-9e46-bea6cebf0f9f'

이것은 나의testlxc.xml파일

<domain type='lxc'>
  <name>testlxc</name>
  <uuid>dfb2c573-05cb-4ca3-9e46-bea6cebf0f9f</uuid>
  <memory unit='KiB'>4048292</memory>
  <currentMemory unit='KiB'>4048292</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64'>exe</type>
    <init>/sbin/init</init>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/lib/libvirt/libvirt_lxc</emulator>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/var/lib/libvirt/filesystems/testlxc'/>
      <target dir='/'/>
    </filesystem>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/var/lib/libvirt/filesystems/testlxc-data'/>
      <target dir='/mnt/data'/>
    </filesystem>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/var/run/testlxc/lxc'/>
      <target dir='/mnt/run'/>
    </filesystem>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/proc/meminfo'/>
      <target dir='/proc/meminfo'/>
    </filesystem>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target type='lxc' port='0'/>
      <alias name='console0'/>
    </console>
  </devices>
</domain>

실행 중인 Libvirt 버전은 1.2.12입니다. 이전에는 버전 1.2.2에서 lxc를 성공적으로 실행했습니다.

$ libvirtd --version
libvirtd (libvirt) 1.2.12

답변1

virt-aa-helper유틸리티 에서 도메인 XML 유효성 검사에 대한 문제를 추적했습니다 . 이것은 요청 시 의류 프로필을 생성하는 유틸리티입니다. 실패한 것은 XML의 구조가 아니지만, 보고된 오류는 이것이 사실임을 나타내는 것 같습니다. LXC 컨테이너의 경우 virDomainDefParseXML함수 내부의 논리적 유효성 검사가 domain_conf.c손상되었습니다.

나는 이 공유 영역을 수정하기 위한 libvirt 코드에 익숙하지 않습니다. 다른 것이 깨졌을 수도 있지만 다음 패치가 작동하는 것 같습니다.

if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) {
    /* If the logic here seems fairly arbitrary, that's because it is :)
     * This is duplicating how the code worked before
     * CapabilitiesDomainDataLookup was added. We can simplify this,
     * but it would take a bit of work because the test suite fails
     * in numerous minor ways. */
    bool use_virttype = ((def->os.arch == VIR_ARCH_NONE) ||
        !def->os.machine);
    virCapsDomainDataPtr capsdata = NULL;

읽다

if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) {
    /* If the logic here seems fairly arbitrary, that's because it is :)
     * This is duplicating how the code worked before
     * CapabilitiesDomainDataLookup was added. We can simplify this,
     * but it would take a bit of work because the test suite fails
     * in numerous minor ways. */
    bool use_virttype = (def->os.type != VIR_DOMAIN_OS_TYPE_EXE) &&
        ((def->os.arch == VIR_ARCH_NONE) ||
          !def->os.machine);
    virCapsDomainDataPtr capsdata = NULL;

불행하게도 재컴파일 없이는 이 문제를 해결할 수 있는 방법을 찾지 못했습니다. 64비트 컴퓨터를 사용하는 경우 로컬에서 만든 패키지를 다운로드할 수 있습니다.이 링크(내 Microsoft 계정은 죄송합니다.)

메모: 이 버그의 영향을 받는지 확인하려면 명령 프롬프트에 다음을 입력하십시오(복사본:이 포럼 게시물):

$ export VM=foo ; virsh -c lxc:// dumpxml $VM |\
   sudo /usr/lib/libvirt/virt-aa-helper -c \
   -u libvirt-`virsh -c lxc:// domuuid $VM`

foo실패한 lxc 컨테이너의 이름은 어디에 있습니까? 출력을 보면

virt-aa-helper: error: could not parse XML
virt-aa-helper: error: could not get VM definition

그렇다면 아마도 같은 버그일 것입니다.

관련 정보