LXC error in Ubuntu Precise 12.04, can't find apparmor, this worked fine in 11.10

1

I'm getting this error using 12.04. When I run sudo lxc-execute -n foo -f lxc.example.conf ls, I get

/usr/lib/lxc/lxc-init: error while loading shared libraries: libapparmor.so.1: cannot open shared object file: No such file or directory

Any idea how to resolve this? I've installed libapparmor-dev and still no luck.

Travis Reeder

Posted 2012-06-12T01:27:52.797

Reputation: 1 209

Does the file in fact exist? If not, download, and place it there... – soandos – 2012-06-12T01:46:07.220

Answers

0

The library is in the libapparmor1 package:

% dpkg -S /usr/lib/libapparmor.so.1
libapparmor1: /usr/lib/libapparmor.so.1

And this is actually a dependency of lxc-init, which lives in the lxc package:

% dpkg -S /usr/lib/lxc/lxc-init
lxc: /usr/lib/lxc/lxc-init

% dpkg -s lxc | grep Depends
Depends: upstart-job, libapparmor1 (>= 2.6~devel), libc6 (>= 2.14), libcap2 (>= 2.10), apparmor, bridge-utils, dnsmasq-base, iptables, rsync

Do you have a broken installation? This might help:

apt-get update
apt-get install -f

Gustavo Niemeyer

Posted 2012-06-12T01:27:52.797

Reputation: 101

0

So after some playing around, what I ended up trying was copying the libapparmor.so.1 on my host machine into the guest container and it seems to have worked. So the problem wasn't actually on the host machine that I was trying to run lxc-execute on. In the end, for our build script, I now install libapparmor-dev into the container's file system:

chroot $JAIL /bin/sh -c "apt-get -yf install libapparmor-dev"

After that, I am able to run lxc-execute on that container. $JAIL being the directory where it's located.

And for further reading, here's a post I found about why apparmor is now a dependency: http://s3hh.wordpress.com/2012/05/03/lxc-in-precise-and-beyond/

Travis Reeder

Posted 2012-06-12T01:27:52.797

Reputation: 1 209