Some times libvirt fails to start a vm with the following error :
libvirt: error : unable to set AppArmor profile 'libvirt-b05b297f-952f-42d6-b04e-f9a13767db54' for '/usr/bin/kvm-spice': No such file or directory
This happens because for some reason file /etc/apparmor.d/libvirt/libvirt-<vm-uuid> has 0 size.
Although, we do not now why the above file gets truncated and therefore we do not know the root cause, I open this bug to come up with a way to mitigate the issue.
E.g. when libvirt sees that this file is 0-size to delete it and create it again.
[Test case]
To reproduce this behaviour, create a vm and stop it, note the uuid.
Then :
## touch /etc/apparmor.d/libvirt/libvirt-<vm-uuid>
# touch /etc/apparmor.d/libvirt/libvirt-b05b297f-952f-42d6-b04e-f9a13767db54
# ls -la libvirt-b05b297f-952f-42d6-b04e-f9a13767db54
-rw-r--r-- 1 root root 0 May 6 18:46 libvirt-b05b297f-952f-42d6-b04e-f9a13767db54
Try to start the vm, it will fail with :
libvirt: error : unable to set AppArmor profile 'libvirt-b05b297f-952f-42d6-b04e-f9a13767db54' for '/usr/bin/kvm-spice': No such file or directory
To be able to start the vm again just delete the libvirt-<vm-uuid> file.
[Impact]
Some times libvirt fails to start a vm with the following error : b05b297f- 952f-42d6- b04e-f9a13767db 54' for '/usr/bin/ kvm-spice' : No such file or directory
libvirt: error : unable to set AppArmor profile 'libvirt-
This happens because for some reason file /etc/apparmor. d/libvirt/ libvirt- <vm-uuid> has 0 size.
Although, we do not now why the above file gets truncated and therefore we do not know the root cause, I open this bug to come up with a way to mitigate the issue.
E.g. when libvirt sees that this file is 0-size to delete it and create it again.
[Test case]
To reproduce this behaviour, create a vm and stop it, note the uuid.
Then :
## touch /etc/apparmor. d/libvirt/ libvirt- <vm-uuid> d/libvirt/ libvirt- b05b297f- 952f-42d6- b04e-f9a13767db 54 b05b297f- 952f-42d6- b04e-f9a13767db 54 b05b297f- 952f-42d6- b04e-f9a13767db 54
# touch /etc/apparmor.
# ls -la libvirt-
-rw-r--r-- 1 root root 0 May 6 18:46 libvirt-
Try to start the vm, it will fail with : b05b297f- 952f-42d6- b04e-f9a13767db 54' for '/usr/bin/ kvm-spice' : No such file or directory
libvirt: error : unable to set AppArmor profile 'libvirt-
To be able to start the vm again just delete the libvirt-<vm-uuid> file.
[Regression Potential]
TBD
[Other]
Similar reported bug : https:/ /bugs.debian. org/cgi- bin/bugreport. cgi?bug= 890084