Mount a file system in a file
#1
Thu, 2017-08-10 16:41
misterunknown
-
- Offline
- 7 months 3 weeks ago
- 2017-08-10
Hi all,
I'm quite new to alpine linux, but used linux since a while now. At the moment I run alpine as an LXC container on a Debian Jessie host system. I try to mount a file system in a file, but get the error "permission denied" – and I don't know why. I performed the following steps:
$ uname -a Linux alpine 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26) x86_64 Linux $ dd if=/dev/zero of=htdocs.fs bs=1M count=100 [...] $ mkfs.ext4 htdocs.fs [...] $ mkdir mnt $ mount -t ext4 htdocs.fs mnt/ mount: permission denied (are you root?)
To find out, what goes wrong I traced the command:
$ strace mount -t ext4 htdocs.fs mnt/ execve("/bin/mount", ["mount", "-t", "ext4", "htdocs.fs", "mnt/"], 0x7ffd00b9d640 /* 30 vars */) = 0 arch_prctl(ARCH_SET_FS, 0x7fc0fbf4bb48) = 0 set_tid_address(0x7fc0fbf4bb80) = 8235 mprotect(0x7fc0fbf48000, 4096, PROT_READ) = 0 mprotect(0x55e2eadb8000, 4096, PROT_READ) = 0 execve("/bin/busybox", ["/bin/busybox", "mount", "-t", "ext4", "htdocs.fs", "mnt/"], 0x7fffdf964a78 /* 30 vars */) = 0 arch_prctl(ARCH_SET_FS, 0x7fb9a0b3fb48) = 0 set_tid_address(0x7fb9a0b3fb80) = 8235 mprotect(0x7fb9a0b3c000, 4096, PROT_READ) = 0 mprotect(0x556a479bb000, 16384, PROT_READ) = 0 getuid() = 0 getuid() = 0 geteuid() = 0 stat("htdocs.fs", {st_mode=S_IFREG|0644, st_size=104857600, ...}) = 0 getcwd("/root", 192) = 6 open("/root/htdocs.fs", O_RDWR) = 3 stat("/dev/loop0", 0x7ffdeeeff8f8) = -1 ENOENT (No such file or directory) mknod("/dev/loop0", S_IFBLK|0644, makedev(7, 0)) = -1 EPERM (Operation not permitted) close(3) = 0 write(2, "mount: permission denied (are yo"..., 41mount: permission denied (are you root?) ) = 41 exit_group(1) = ? +++ exited with 1 +++
Unfortunately I don't know why the mknod syscall fails. All commands were executed as root. Thank you for some hints.
Cheers,
Marco