# mount: no such file or directory

## fidel

I got a very weird problem:

```
# ls -lhd /mnt/inter/inter/

drwxrwxr-x 17 root users 4.0K  4. Apr 22:41 /mnt/inter/inter/

ls -lhd /export/Inter/

drwxr-xr-x 2 root root 4.0K 22. Aug 20:09 /export/Inter/

# mount --bind /mnt/inter/inter/ /export/Inter/

mount: Datei oder Verzeichnis nicht gefunden # That means "no such file or directory"

```

???????

----------

## egberts

Try it again using the following command:

```
strace mount --bind /mnt/inter/inter/ /export/Inter/
```

Obviously, one of the two files is not what it seems to be.  By doing the strace, we hope to find which of the two files is the offending file.

----------

## fidel

Ok:

```
# strace mount --bind /mnt/inter/inter/ /export/Inter/                                                       

execve("/bin/mount", ["mount", "--bind", "/mnt/inter/inter/", "/export/Inter/"], [/* 24 vars */]) = 0

brk(0)                                  = 0x20e1000

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9fefa89000

access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)

open("/etc/ld.so.cache", O_RDONLY)      = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=49571, ...}) = 0

mmap(NULL, 49571, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9fefa7c000

close(3)                                = 0

open("/lib/libblkid.so.1", O_RDONLY)    = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`b\0\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=130760, ...}) = 0

mmap(NULL, 2226024, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9fef64d000

mprotect(0x7f9fef669000, 2097152, PROT_NONE) = 0

mmap(0x7f9fef869000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x7f9fef869000

close(3)                                = 0

open("/lib/libc.so.6", O_RDONLY)        = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\354\1\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=1399984, ...}) = 0

mmap(NULL, 3508264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9fef2f4000

mprotect(0x7f9fef444000, 2093056, PROT_NONE) = 0

mmap(0x7f9fef643000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14f000) = 0x7f9fef643000

mmap(0x7f9fef648000, 18472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f9fef648000

close(3)                                = 0

open("/lib/libuuid.so.1", O_RDONLY)     = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \27\0\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=18848, ...}) = 0

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9fefa7b000

mmap(NULL, 2113944, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f9fef0ef000

mprotect(0x7f9fef0f3000, 2093056, PROT_NONE) = 0

mmap(0x7f9fef2f2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f9fef2f2000

close(3)                                = 0

mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9fefa79000

arch_prctl(ARCH_SET_FS, 0x7f9fefa79740) = 0

mprotect(0x7f9fef2f2000, 4096, PROT_READ) = 0

mprotect(0x7f9fef643000, 16384, PROT_READ) = 0

mprotect(0x7f9fef869000, 12288, PROT_READ) = 0

mprotect(0x60f000, 4096, PROT_READ)     = 0

mprotect(0x7f9fefa8a000, 4096, PROT_READ) = 0

munmap(0x7f9fefa7c000, 49571)           = 0

brk(0)                                  = 0x20e1000

brk(0x2102000)                          = 0x2102000

open("/usr/lib64/locale/locale-archive", O_RDONLY) = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=2041200, ...}) = 0

mmap(NULL, 2041200, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9feeefc000

close(3)                                = 0

umask(022)                              = 022

open("/dev/null", O_RDWR)               = 3

close(3)                                = 0

getuid()                                = 0

geteuid()                               = 0

readlink("/mnt", 0x7fffb884f860, 4096)  = -1 EINVAL (Invalid argument)

readlink("/mnt/inter", 0x7fffb884f860, 4096) = -1 EINVAL (Invalid argument)

readlink("/mnt/inter/inter", 0x7fffb884f860, 4096) = -1 EINVAL (Invalid argument)

rt_sigprocmask(SIG_BLOCK, ~[TRAP SEGV RTMIN RT_1], NULL, 8) = 0

mount("/mnt/inter/inter", "/export/Inter/", 0x40b9d2, MS_MGC_VAL|MS_BIND, NULL) = -1 ENOENT (No such file or directory)

rt_sigprocmask(SIG_UNBLOCK, ~[TRAP SEGV RTMIN RT_1], NULL, 8) = 0

lstat("/export/Inter/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

stat("/export/Inter/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

stat("/mnt/inter/inter", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0

dup(2)                                  = 3

fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)

fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9fefa88000

lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)

open("/usr/share/locale/locale.alias", O_RDONLY) = 4

fstat(4, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9fefa87000

read(4, "# Locale name alias data base.\n#"..., 4096) = 2570

read(4, "", 4096)                       = 0

close(4)                                = 0

munmap(0x7f9fefa87000, 4096)            = 0

open("/usr/share/locale/de_CH.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/share/locale/de_CH.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/share/locale/de_CH/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/share/locale/de.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/share/locale/de.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/share/locale/de/LC_MESSAGES/libc.mo", O_RDONLY) = 4

fstat(4, {st_mode=S_IFREG|0644, st_size=123193, ...}) = 0

mmap(NULL, 123193, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f9fefa5a000

close(4)                                = 0

open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 4

fstat(4, {st_mode=S_IFREG|0644, st_size=26050, ...}) = 0

mmap(NULL, 26050, PROT_READ, MAP_SHARED, 4, 0) = 0x7f9fefa81000

close(4)                                = 0

write(3, "mount: Datei oder Verzeichnis ni"..., 45mount: Datei oder Verzeichnis nicht gefunden

) = 45

close(3)                                = 0

munmap(0x7f9fefa88000, 4096)            = 0

exit_group(32)                          = ?

```

And still:

```
# ls -lhd /mnt/inter/inter/

drwxrwxr-x 17 root users 4.0K  4. Apr 22:41 /mnt/inter/inter/

# ls -lhd /export/Inter/                                                       

drwxr-xr-x 2 root root 4.0K 22. Aug 20:09 /export/Inter/

```

----------

## egberts

Your first hint or clue is given below:

```
mount("/mnt/inter/inter", "/export/Inter/", 0x40b9d2, MS_MGC_VAL|MS_BIND, NULL) = -1 ENOENT (No such file or directory)
```

A couple of blocking issues may be one of the following:

/etc/fstab mountpoint exist for /mnt/inter

and has read-only (ro) option

/etc/fstab mountpoint exist for /export/Inter

hardlink was made (it shouldn't have mattered)

ACL is enforcing (by SELinux or lsattr)

Please perform the following command to understand why the mount()/mount.c is failing:

```
root # sestatus

root # grep mnt /proc/mount

root # grep export /proc/mount

root # grep Inter /proc/mount

root # ls -latd /

root # ls -latd /mnt

root # ls -latd /mnt/inter

root # ls -latd /export

root # stat /mnt

root # stat /mnt/inter

root # stat /mnt/inter/inter

root # stat /export

root # stat /export/Inter

root # lsattr /

root # lsattr /mnt

root # lsattr /mnt/inter

root # lsattr /mnt/inter/inter

root # lsattr /export

root # lsattr /export/Inter
```

And indicate the file system  (ext2, ext3, or NFS) used and their mountpoint boundaries (i.e., / = ext3, /export = ext2)

----------

## fidel

 *egberts wrote:*   

> A couple of blocking issues may be one of the following:
> 
> /etc/fstab mountpoint exist for /mnt/inter 

 

True! Its actually some raid array (/dev/md10) that I got mounted on /mnt/inter. It's not mounted ro though, the entry in fstab looks like

```
UUID=1f41743e-49a7-4a6f-8c28-334d20ab5134       /mnt/inter      ext4    noatime 0 2
```

The partition was mounted when I wanted to bind mount /mnt/inter/inter to /export/inter. Since this didn't work I changed to /mnt/export... this works:

```
$ df -ha |grep -i inter

/dev/md10             459G  141G  295G  33% /mnt/inter

/mnt/inter/inter      459G  141G  295G  33% /mnt/export/Inter

$ grep Inter /etc/fstab

/mnt/inter/inter        /mnt/export/Inter               none    bind    0 0

```

No clue why this works and the other (bind-mounting on /export) doesn't.

----------

