<div dir="ltr"><div class="gmail_default" style="font-size:small">I found this question<br><a href="http://askubuntu.com/questions/376345/allow-loop-mounting-files-inside-lxc-containers">http://askubuntu.com/questions/376345/allow-loop-mounting-files-inside-lxc-containers</a><br><br></div><div class="gmail_default" style="font-size:small">The explanation and the solution provided are incorrect. I am not using apparmor, and it fails anyway. I have the necessary groups required. Yet it fails withe same error. Here is an strace of the command. The server is Ubuntu 14.04 and the container is Federa 20. I can mount ISO files in the host, no problem.<br><br> <br>[root@208 ~]# strace mount -o loop my.img /mnt<br>execve("/usr/bin/mount", ["mount", "-o", "loop", "my.img", "/mnt"], [/* 22 vars */]) = 0<br>brk(0)                                  = 0x7f4faebba000<br>mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad94e000<br>access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)<br>open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3<br>fstat(3, {st_mode=S_IFREG|0644, st_size=52286, ...}) = 0<br>mmap(NULL, 52286, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4fad941000<br>close(3)                                = 0<br>open("/lib64/libmount.so.1", O_RDONLY|O_CLOEXEC) = 3<br>read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\250\0\0\0\0\0\0"..., 832) = 832<br>fstat(3, {st_mode=S_IFREG|0755, st_size=276440, ...}) = 0<br>mmap(NULL, 2371040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4fad2e1000<br>mprotect(0x7f4fad321000, 2097152, PROT_NONE) = 0<br>mmap(0x7f4fad521000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x40000) = 0x7f4fad521000<br>mmap(0x7f4fad523000, 3552, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4fad523000<br>close(3)                                = 0<br>open("/lib64/libblkid.so.1", O_RDONLY|O_CLOEXEC) = 3<br>read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\205\0\0\0\0\0\0"..., 832) = 832<br>fstat(3, {st_mode=S_IFREG|0755, st_size=256712, ...}) = 0<br>mmap(NULL, 2349960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4fad0a3000<br>mprotect(0x7f4fad0dd000, 2093056, PROT_NONE) = 0<br>mmap(0x7f4fad2dc000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x39000) = 0x7f4fad2dc000<br>mmap(0x7f4fad2e0000, 2952, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4fad2e0000<br>close(3)                                = 0<br>open("/lib64/libuuid.so.1", O_RDONLY|O_CLOEXEC) = 3<br>read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\25\0\0\0\0\0\0"..., 832) = 832<br>fstat(3, {st_mode=S_IFREG|0755, st_size=19936, ...}) = 0<br>mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad940000<br>mmap(NULL, 2113920, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4face9e000<br>mprotect(0x7f4facea2000, 2093056, PROT_NONE) = 0<br>mmap(0x7f4fad0a1000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f4fad0a1000<br>close(3)                                = 0<br>open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3<br>read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240d\0\0\0\0\0\0"..., 832) = 832<br>fstat(3, {st_mode=S_IFREG|0755, st_size=142136, ...}) = 0<br>mmap(NULL, 2242712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4facc7a000<br>mprotect(0x7f4facc9b000, 2093056, PROT_NONE) = 0<br>mmap(0x7f4face9a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20000) = 0x7f4face9a000<br>mmap(0x7f4face9c000, 6296, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4face9c000<br>close(3)                                = 0<br>open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3<br>read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\36\2\0\0\0\0\0"..., 832) = 832<br>fstat(3, {st_mode=S_IFREG|0755, st_size=2093096, ...}) = 0<br>mmap(NULL, 3920480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4fac8bc000<br>mprotect(0x7f4faca70000, 2093056, PROT_NONE) = 0<br>mmap(0x7f4facc6f000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b3000) = 0x7f4facc6f000<br>mmap(0x7f4facc75000, 16992, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4facc75000<br>close(3)                                = 0<br>open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3<br>read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\27\0\0\0\0\0\0"..., 832) = 832<br>fstat(3, {st_mode=S_IFREG|0755, st_size=418608, ...}) = 0<br>mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad93f000<br>mmap(NULL, 2511368, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4fac656000<br>mprotect(0x7f4fac6bb000, 2093056, PROT_NONE) = 0<br>mmap(0x7f4fac8ba000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x64000) = 0x7f4fac8ba000<br>close(3)                                = 0<br>open("/lib64/liblzma.so.5", O_RDONLY|O_CLOEXEC) = 3<br>read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3400\0\0\0\0\0\0"..., 832) = 832<br>fstat(3, {st_mode=S_IFREG|0755, st_size=152872, ...}) = 0<br>mmap(NULL, 2245240, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4fac431000<br>mprotect(0x7f4fac455000, 2093056, PROT_NONE) = 0<br>mmap(0x7f4fac654000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x7f4fac654000<br>close(3)                                = 0<br>open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3<br>read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\16\0\0\0\0\0\0"..., 832) = 832<br>fstat(3, {st_mode=S_IFREG|0755, st_size=19512, ...}) = 0<br>mmap(NULL, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4fac22d000<br>mprotect(0x7f4fac230000, 2093056, PROT_NONE) = 0<br>mmap(0x7f4fac42f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f4fac42f000<br>close(3)                                = 0<br>open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3<br>read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220m\0\0\0\0\0\0"..., 832) = 832<br>fstat(3, {st_mode=S_IFREG|0755, st_size=147496, ...}) = 0<br>mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad93e000<br>mmap(NULL, 2213104, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4fac010000<br>mprotect(0x7f4fac028000, 2093056, PROT_NONE) = 0<br>mmap(0x7f4fac227000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f4fac227000<br>mmap(0x7f4fac229000, 13552, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4fac229000<br>close(3)                                = 0<br>mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad93d000<br>mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad93b000<br>arch_prctl(ARCH_SET_FS, 0x7f4fad93b880) = 0<br>mprotect(0x7f4facc6f000, 16384, PROT_READ) = 0<br>mprotect(0x7f4fac227000, 4096, PROT_READ) = 0<br>mprotect(0x7f4fac42f000, 4096, PROT_READ) = 0<br>mprotect(0x7f4fac654000, 4096, PROT_READ) = 0<br>mprotect(0x7f4fac8ba000, 4096, PROT_READ) = 0<br>mprotect(0x7f4face9a000, 4096, PROT_READ) = 0<br>mprotect(0x7f4fad0a1000, 4096, PROT_READ) = 0<br>mprotect(0x7f4fad2dc000, 12288, PROT_READ) = 0<br>mprotect(0x7f4fad521000, 4096, PROT_READ) = 0<br>mprotect(0x7f4fad94f000, 4096, PROT_READ) = 0<br>mprotect(0x7f4fad743000, 4096, PROT_READ) = 0<br>munmap(0x7f4fad941000, 52286)           = 0<br>set_tid_address(0x7f4fad93bb50)         = 1116<br>set_robust_list(0x7f4fad93bb60, 24)     = 0<br>rt_sigaction(SIGRTMIN, {0x7f4fac016880, [], SA_RESTORER|SA_SIGINFO, 0x7f4fac01f6d0}, NULL, 8) = 0<br>rt_sigaction(SIGRT_1, {0x7f4fac016910, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f4fac01f6d0}, NULL, 8) = 0<br>rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0<br>getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0<br>statfs("/sys/fs/selinux", 0x7ffc7ee4d7e0) = -1 ENOENT (No such file or directory)<br>statfs("/selinux", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=93890982, f_bfree=91885835, f_bavail=87110667, f_files=23863296, f_ffree=23681122, f_fsid={1483963921, -2103980134}, f_namelen=255, f_frsize=4096}) = 0<br>brk(0)                                  = 0x7f4faebba000<br>brk(0x7f4faebdb000)                     = 0x7f4faebdb000<br>open("/proc/filesystems", O_RDONLY)     = 3<br>fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0<br>mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad94d000<br>read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tr"..., 1024) = 347<br>read(3, "", 1024)                       = 0<br>close(3)                                = 0<br>munmap(0x7f4fad94d000, 4096)            = 0<br>open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3<br>fstat(3, {st_mode=S_IFREG|0644, st_size=106070960, ...}) = 0<br>mmap(NULL, 106070960, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4fa5ae7000<br>close(3)                                = 0<br>getuid()                                = 0<br>geteuid()                               = 0<br>getuid()                                = 0<br>geteuid()                               = 0<br>getgid()                                = 0<br>getegid()                               = 0<br>prctl(PR_GET_DUMPABLE)                  = 1<br>lstat("/etc/mtab", {st_mode=S_IFLNK|0777, st_size=12, ...}) = 0<br>getuid()                                = 0<br>geteuid()                               = 0<br>getgid()                                = 0<br>getegid()                               = 0<br>prctl(PR_GET_DUMPABLE)                  = 1<br>stat("/run", {st_mode=S_IFDIR|0755, st_size=660, ...}) = 0<br>lstat("/run/mount/utab", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0<br>open("/run/mount/utab", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = 3<br>close(3)                                = 0<br>getcwd("/root", 4096)                   = 6<br>lstat("/root/my.img", {st_mode=S_IFREG|0644, st_size=104857600, ...}) = 0<br>stat("/sys/block", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0<br>uname({sysname="Linux", nodename="208.78.162.193", ...}) = 0<br>stat("/dev/loop-control", 0x7ffc7ee4d060) = -1 ENOENT (No such file or directory)<br>lstat("/etc/mtab", {st_mode=S_IFLNK|0777, st_size=12, ...}) = 0<br>open("/proc/self/mountinfo", O_RDONLY|O_CLOEXEC) = 3<br>fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0<br>mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad94d000<br>read(3, "63 64 8:1 /var/lib/lxc/asterisk/"..., 1024) = 1024<br>lstat("/proc", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0<br>lstat("/proc/self", {st_mode=S_IFLNK|0777, st_size=0, ...}) = 0<br>readlink("/proc/self", "1116", 4095)    = 4<br>lstat("/proc/1116", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0<br>lstat("/proc/1116/mountinfo", {st_mode=S_IFREG|0444, st_size=0, ...}) = 0<br>read(3, "atime - devpts devpts rw,gid=5,m"..., 1024) = 1024<br>read(3, "nts/cgm-release-agent.blkio\n77 1"..., 1024) = 774<br>read(3, "", 1024)                       = 0<br>close(3)                                = 0<br>munmap(0x7f4fad94d000, 4096)            = 0<br>getuid()                                = 0<br>geteuid()                               = 0<br>getgid()                                = 0<br>getegid()                               = 0<br>prctl(PR_GET_DUMPABLE)                  = 1<br>stat("/run", {st_mode=S_IFDIR|0755, st_size=660, ...}) = 0<br>stat("/run/mount/utab", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0<br>lstat("/root", {st_mode=S_IFDIR|0550, st_size=4096, ...}) = 0<br>lstat("/root/my.img", {st_mode=S_IFREG|0644, st_size=104857600, ...}) = 0<br>lstat("/mnt", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0<br>stat("/dev/loop", 0x7ffc7ee4d200)       = -1 ENOENT (No such file or directory)<br>stat("/dev/loop0", 0x7ffc7ee4c160)      = -1 ENOENT (No such file or directory)<br>open("/sys/block/loop0/dev", O_RDONLY|O_CLOEXEC) = 3<br>fstat(3, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0<br>mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad94d000<br>read(3, "7:0\n", 4096)                  = 4<br>close(3)                                = 0<br>munmap(0x7f4fad94d000, 4096)            = 0<br>open("/sys/dev/block/7:0", O_RDONLY|O_CLOEXEC) = 3<br>openat(3, "loop/offset", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)<br>lstat("/root", {st_mode=S_IFDIR|0550, st_size=4096, ...}) = 0<br>lstat("/root/my.img", {st_mode=S_IFREG|0644, st_size=104857600, ...}) = 0<br>open("/root/my.img", O_RDWR|O_CLOEXEC)  = 4<br>open("/dev/loop0", O_RDWR|O_CLOEXEC)    = -1 ENOENT (No such file or directory)<br>close(4)                                = 0<br>close(3)                                = 0<br>open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3<br>fstat(3, {st_mode=S_IFREG|0644, st_size=2492, ...}) = 0<br>mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4fad94d000<br>read(3, "# Locale name alias data base.\n#"..., 4096) = 2492<br>read(3, "", 4096)                       = 0<br>close(3)                                = 0<br>munmap(0x7f4fad94d000, 4096)            = 0<br>open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en_US.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en_US/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>write(2, "mount: ", 7mount: )                  = 7<br>write(2, "/root/my.img: failed to setup lo"..., 41/root/my.img: failed to setup loop device) = 41<br>write(2, ": ", 2: )                       = 2<br>open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)<br>write(2, "No such file or directory\n", 26No such file or directory<br>) = 26<br>close(1)                                = 0<br>close(2)                                = 0<br>exit_group(32)                          = ?<br>+++ exited with 32 +++<br><br></div></div>