strange behaviour from 'mount -an'...
Andre
armcc2000 at yahoo.com
Tue Jun 20 04:24:00 UTC 2006
# cat /etc/fstab
proc /proc proc defaults 0 0
tmpfs /rw tmpfs defaults,size=8M 0 0
(/proc and /rw directories both exist).
/sbin/init runs /etc/init.d/rcS and the first thing rcS does is run
'/bin/mount -an'. Although both /proc and /rw are mounted, mount
outputs the following error message:
mount: Mounting tmpfs on /rw failed: No such file or directory
Adding strace to the mount command gives:
execve("/bin/mount", ["/bin/mount", "-an"], [/* 7 vars */]) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon
echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon
echo ...}) = 0
getuid() = 0
getgid() = 0
setgid(0) = 0
setuid(0) = 0
brk(0) = 0x64b78
brk(0x65b78) = 0x65b78
brk(0x66000) = 0x66000
open("/etc/fstab", O_RDONLY) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7ffffd1c) = -1 ENOTTY
(Inappropriate ioctl for device)
read(3, "proc\t/proc\tproc\tdefa"..., 4096) = 68
lstat64("proc", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
mount("proc", "/proc", "proc", MS_VERBOSE, 0) = 0
lstat64("tmpfs", 0x7ffffca4) = -1 ENOENT (No such file or
directory)
mount("tmpfs", "/rw", "tmpfs", MS_VERBOSE, 0x65c00) = 0
read(3, "", 4096) = 0
write(2, "mount", 5mount) = 5
write(2, ": ", 2: ) = 2
write(2, "Mounting ", 9Mounting ) = 9
write(2, "tmpfs", 5tmpfs) = 5
write(2, " on ", 4 on ) = 4
write(2, "/rw", 3/rw) = 3
write(2, " failed", 7 failed) = 7
write(2, ": ", 2: ) = 2
write(2, "No such file or directory", 25No such file or directory) =
25
write(2, "\n", 1
) = 1
_exit(1) = ?
ie Instead of inherently 'knowing' that proc and tmpfs are special,
mount uses lstat64() to find out... a trick which partly succeeds for
"proc" as rcS is run with cwd='/' and /proc exists, but which fails
for "tmpfs"...
If I add an empty directory '/tmpfs' then lstat("tmpfs") succeeds and
mount gives the even more confusing message:
mount: Mounting tmpfs on /rw failed: Success
Maybe also related: If I run 'mount -an' again repeatedly from the
command line after the system has booted, I don't get any errors, but
I do get multiple instances of tmpfs mounted on /rw... e.g.
# mount -an
# mount -an
# mount -an
# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / cramfs ro 0 0
proc /proc proc rw 0 0
tmpfs /rw tmpfs rw 0 0
tmpfs /rw tmpfs rw 0 0
tmpfs /rw tmpfs rw 0 0
tmpfs /rw tmpfs rw 0 0
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the busybox
mailing list