[lxc-users] Failure to mount an ISO file inside container

Saint Michael venefax at gmail.com
Sat Nov 28 03:33:00 UTC 2015


I found this question
http://askubuntu.com/questions/376345/allow-loop-mounting-files-inside-lxc-containers

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.


[root at 208 ~]# strace mount -o loop my.img /mnt
execve("/usr/bin/mount", ["mount", "-o", "loop", "my.img", "/mnt"], [/* 22
vars */]) = 0
brk(0)                                  = 0x7f4faebba000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad94e000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=52286, ...}) = 0
mmap(NULL, 52286, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4fad941000
close(3)                                = 0
open("/lib64/libmount.so.1", O_RDONLY|O_CLOEXEC) = 3
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
fstat(3, {st_mode=S_IFREG|0755, st_size=276440, ...}) = 0
mmap(NULL, 2371040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7f4fad2e1000
mprotect(0x7f4fad321000, 2097152, PROT_NONE) = 0
mmap(0x7f4fad521000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x40000) = 0x7f4fad521000
mmap(0x7f4fad523000, 3552, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4fad523000
close(3)                                = 0
open("/lib64/libblkid.so.1", O_RDONLY|O_CLOEXEC) = 3
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
fstat(3, {st_mode=S_IFREG|0755, st_size=256712, ...}) = 0
mmap(NULL, 2349960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7f4fad0a3000
mprotect(0x7f4fad0dd000, 2093056, PROT_NONE) = 0
mmap(0x7f4fad2dc000, 16384, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x39000) = 0x7f4fad2dc000
mmap(0x7f4fad2e0000, 2952, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4fad2e0000
close(3)                                = 0
open("/lib64/libuuid.so.1", O_RDONLY|O_CLOEXEC) = 3
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
fstat(3, {st_mode=S_IFREG|0755, st_size=19936, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad940000
mmap(NULL, 2113920, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7f4face9e000
mprotect(0x7f4facea2000, 2093056, PROT_NONE) = 0
mmap(0x7f4fad0a1000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f4fad0a1000
close(3)                                = 0
open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
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
fstat(3, {st_mode=S_IFREG|0755, st_size=142136, ...}) = 0
mmap(NULL, 2242712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7f4facc7a000
mprotect(0x7f4facc9b000, 2093056, PROT_NONE) = 0
mmap(0x7f4face9a000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x20000) = 0x7f4face9a000
mmap(0x7f4face9c000, 6296, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4face9c000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
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
fstat(3, {st_mode=S_IFREG|0755, st_size=2093096, ...}) = 0
mmap(NULL, 3920480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7f4fac8bc000
mprotect(0x7f4faca70000, 2093056, PROT_NONE) = 0
mmap(0x7f4facc6f000, 24576, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b3000) = 0x7f4facc6f000
mmap(0x7f4facc75000, 16992, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4facc75000
close(3)                                = 0
open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3
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
fstat(3, {st_mode=S_IFREG|0755, st_size=418608, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad93f000
mmap(NULL, 2511368, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7f4fac656000
mprotect(0x7f4fac6bb000, 2093056, PROT_NONE) = 0
mmap(0x7f4fac8ba000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x64000) = 0x7f4fac8ba000
close(3)                                = 0
open("/lib64/liblzma.so.5", O_RDONLY|O_CLOEXEC) = 3
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
fstat(3, {st_mode=S_IFREG|0755, st_size=152872, ...}) = 0
mmap(NULL, 2245240, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7f4fac431000
mprotect(0x7f4fac455000, 2093056, PROT_NONE) = 0
mmap(0x7f4fac654000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x7f4fac654000
close(3)                                = 0
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
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
fstat(3, {st_mode=S_IFREG|0755, st_size=19512, ...}) = 0
mmap(NULL, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7f4fac22d000
mprotect(0x7f4fac230000, 2093056, PROT_NONE) = 0
mmap(0x7f4fac42f000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f4fac42f000
close(3)                                = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
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
fstat(3, {st_mode=S_IFREG|0755, st_size=147496, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad93e000
mmap(NULL, 2213104, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x7f4fac010000
mprotect(0x7f4fac028000, 2093056, PROT_NONE) = 0
mmap(0x7f4fac227000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f4fac227000
mmap(0x7f4fac229000, 13552, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4fac229000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad93d000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad93b000
arch_prctl(ARCH_SET_FS, 0x7f4fad93b880) = 0
mprotect(0x7f4facc6f000, 16384, PROT_READ) = 0
mprotect(0x7f4fac227000, 4096, PROT_READ) = 0
mprotect(0x7f4fac42f000, 4096, PROT_READ) = 0
mprotect(0x7f4fac654000, 4096, PROT_READ) = 0
mprotect(0x7f4fac8ba000, 4096, PROT_READ) = 0
mprotect(0x7f4face9a000, 4096, PROT_READ) = 0
mprotect(0x7f4fad0a1000, 4096, PROT_READ) = 0
mprotect(0x7f4fad2dc000, 12288, PROT_READ) = 0
mprotect(0x7f4fad521000, 4096, PROT_READ) = 0
mprotect(0x7f4fad94f000, 4096, PROT_READ) = 0
mprotect(0x7f4fad743000, 4096, PROT_READ) = 0
munmap(0x7f4fad941000, 52286)           = 0
set_tid_address(0x7f4fad93bb50)         = 1116
set_robust_list(0x7f4fad93bb60, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7f4fac016880, [], SA_RESTORER|SA_SIGINFO,
0x7f4fac01f6d0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f4fac016910, [],
SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f4fac01f6d0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
statfs("/sys/fs/selinux", 0x7ffc7ee4d7e0) = -1 ENOENT (No such file or
directory)
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
brk(0)                                  = 0x7f4faebba000
brk(0x7f4faebdb000)                     = 0x7f4faebdb000
open("/proc/filesystems", O_RDONLY)     = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad94d000
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tr"..., 1024) = 347
read(3, "", 1024)                       = 0
close(3)                                = 0
munmap(0x7f4fad94d000, 4096)            = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=106070960, ...}) = 0
mmap(NULL, 106070960, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4fa5ae7000
close(3)                                = 0
getuid()                                = 0
geteuid()                               = 0
getuid()                                = 0
geteuid()                               = 0
getgid()                                = 0
getegid()                               = 0
prctl(PR_GET_DUMPABLE)                  = 1
lstat("/etc/mtab", {st_mode=S_IFLNK|0777, st_size=12, ...}) = 0
getuid()                                = 0
geteuid()                               = 0
getgid()                                = 0
getegid()                               = 0
prctl(PR_GET_DUMPABLE)                  = 1
stat("/run", {st_mode=S_IFDIR|0755, st_size=660, ...}) = 0
lstat("/run/mount/utab", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("/run/mount/utab", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = 3
close(3)                                = 0
getcwd("/root", 4096)                   = 6
lstat("/root/my.img", {st_mode=S_IFREG|0644, st_size=104857600, ...}) = 0
stat("/sys/block", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
uname({sysname="Linux", nodename="208.78.162.193", ...}) = 0
stat("/dev/loop-control", 0x7ffc7ee4d060) = -1 ENOENT (No such file or
directory)
lstat("/etc/mtab", {st_mode=S_IFLNK|0777, st_size=12, ...}) = 0
open("/proc/self/mountinfo", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad94d000
read(3, "63 64 8:1 /var/lib/lxc/asterisk/"..., 1024) = 1024
lstat("/proc", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
lstat("/proc/self", {st_mode=S_IFLNK|0777, st_size=0, ...}) = 0
readlink("/proc/self", "1116", 4095)    = 4
lstat("/proc/1116", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
lstat("/proc/1116/mountinfo", {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "atime - devpts devpts rw,gid=5,m"..., 1024) = 1024
read(3, "nts/cgm-release-agent.blkio\n77 1"..., 1024) = 774
read(3, "", 1024)                       = 0
close(3)                                = 0
munmap(0x7f4fad94d000, 4096)            = 0
getuid()                                = 0
geteuid()                               = 0
getgid()                                = 0
getegid()                               = 0
prctl(PR_GET_DUMPABLE)                  = 1
stat("/run", {st_mode=S_IFDIR|0755, st_size=660, ...}) = 0
stat("/run/mount/utab", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lstat("/root", {st_mode=S_IFDIR|0550, st_size=4096, ...}) = 0
lstat("/root/my.img", {st_mode=S_IFREG|0644, st_size=104857600, ...}) = 0
lstat("/mnt", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/dev/loop", 0x7ffc7ee4d200)       = -1 ENOENT (No such file or
directory)
stat("/dev/loop0", 0x7ffc7ee4c160)      = -1 ENOENT (No such file or
directory)
open("/sys/block/loop0/dev", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad94d000
read(3, "7:0\n", 4096)                  = 4
close(3)                                = 0
munmap(0x7f4fad94d000, 4096)            = 0
open("/sys/dev/block/7:0", O_RDONLY|O_CLOEXEC) = 3
openat(3, "loop/offset", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or
directory)
lstat("/root", {st_mode=S_IFDIR|0550, st_size=4096, ...}) = 0
lstat("/root/my.img", {st_mode=S_IFREG|0644, st_size=104857600, ...}) = 0
open("/root/my.img", O_RDWR|O_CLOEXEC)  = 4
open("/dev/loop0", O_RDWR|O_CLOEXEC)    = -1 ENOENT (No such file or
directory)
close(4)                                = 0
close(3)                                = 0
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2492, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f4fad94d000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2492
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x7f4fad94d000, 4096)            = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) =
-1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
write(2, "mount: ", 7mount: )                  = 7
write(2, "/root/my.img: failed to setup lo"..., 41/root/my.img: failed to
setup loop device) = 41
write(2, ": ", 2: )                       = 2
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1
ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT
(No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No
such file or directory)
write(2, "No such file or directory\n", 26No such file or directory
) = 26
close(1)                                = 0
close(2)                                = 0
exit_group(32)                          = ?
+++ exited with 32 +++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20151127/3e42f224/attachment.html>


More information about the lxc-users mailing list