1

I build docker container which contain qemu2.5 based on ubuntu 16. When I try to run libvirt I got this error:

root@1116a7e45f20:/# /etc/init.d/libvirt-bin start
 * Starting libvirt management daemon libvirtd
/usr/sbin/libvirtd: error while loading shared libraries: libvirt-admin.so.0: cannot open shared object file: Permission denied
Waiting for /var/run/libvirt/libvirt-sock - recheck in 2 sec
Waiting for /var/run/libvirt/libvirt-sock - recheck in 2 sec
Waiting for /var/run/libvirt/libvirt-sock - recheck in 2 sec
Waiting for /var/run/libvirt/libvirt-sock - recheck in 2 sec
Waiting for /var/run/libvirt/libvirt-sock - recheck in 2 sec
Giving up waiting for /var/run/libvirt/libvirt-sock.

I run docker container with flag --privileged Inside docker container I'm not able to add new rules for libvirt in apparmor like:

root@1116a7e45f20:/# aa-complain /etc/apparmor.d/usr.sbin.libvirtd
Setting /etc/apparmor.d/usr.sbin.libvirtd to complain mode.

ERROR: Cache read/write disabled: interface file missing. (Kernel needs AppArmor 2.4 compatibility patch.)
Warning: unable to find a suitable fs in /proc/mounts, is it mounted?
Use --subdomainfs to override.

there is strace output:

lose(4)                                = 0
read(3, "1\n", 128)                     = 2
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=514, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]})                 = 2
read(3, "", 128)                        = 0
close(3)                                = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 514
stat("/var/run/libvirt/libvirt-sock", 0x7ffed1f87c90) = -1 ENOENT (No such file or directory)
write(1, "Waiting for /var/run/libvirt/lib"..., 61Waiting for /var/run/libvirt/libvirt-sock - recheck in 2 sec
) = 61
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe834b3e9d0) = 515
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 515
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=515, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]})                 = 515
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fe834b3e9d0) = 516
close(4)                                = 0
read(3, "0\n", 128)                     = 2
read(3, "", 128)                        = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=516, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
rt_sigreturn({mask=[]})                 = 0
close(3)                                = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 516
write(1, "Giving up waiting for /var/run/l"..., 53Giving up waiting for /var/run/libvirt/libvirt-sock.
) = 53
exit_group(1)                           = ?
+++ exited with 1 +++

and only one library doens't show its path

root@1116a7e45f20:/# ldd /usr/sbin/libvirtd
        linux-vdso.so.1 =>  (0x00007ffd58fa2000)

What is wrong with this container? Please, what can be root cause of this error?

0

The root cause of this error is apparmor from HOST. So you should disable or permit docker on host system. And this erorr will gone.

Also, all kernel parameters go from host system to guest. So, you should permit /dev/kvm in advance to use third users ( 666 ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.