Problem substituting /proc/mounts for recovery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everybody!

During recovery I'm running off a chroot (booted via knoppix); 
I'm trying to fake a mount table, so that the output of mount 
and df can be correctly parsed by the boot loader installation 
(in the chroot the "df -k /boot" returns no device).

But that is nowadays (2.6.14-1-686-smp (Debian 2.6.14-2)) a problem, 
since /proc/mounts is a symlink.


Observe:
        # cat /proc/mounts > /tmp/mymounts
        # vi /tmp/mymounts
        # mount --bind /tmp/mymounts /proc/mounts
        # ls -la /proc/mounts
        lrwxrwxrwx 1 root root 11 2006-04-07 12:13 /proc/mounts -> self/mounts
        # mount
        ...
        /tmp/mymounts on /proc/17496/mounts type none (rw,bind)
        # ls -la /proc/17496
        ls: /proc/17496: Datei oder Verzeichnis nicht gefunden
        # umount /proc/17496/mounts
        umount: /tmp/mymounts: not mounted
        umount: /proc/17496/mounts: not found
        umount: /tmp/mymounts: not mounted
        umount: /proc/17496/mounts: not found
        # umount /tmp/mymounts
        umount: /tmp/mymounts: not mounted

It seems not to be a simple userspace problem:
	# strace -e umount umount -f /proc/17496/mounts
	umount("/proc/17496/mounts", MNT_FORCE) = -1 ENOENT (No such file or directory)
	umount2: Datei oder Verzeichnis nicht gefunden
	umount: /proc/17496/mounts: not found


So the following questions come to my mind:
- Is that a kernel bug, ie. the dentry of /proc/17496/mounts is not 
  kept in memory for releasing? (along with /proc/17496)
- Should the mount be automatically release if there's no 
  possible user left?
- Should "mount --bind" not follow symlinks, but replace them? That's 
  what I'd need here, to fake the mount table.
- Is there a better way to achieve that?

Also I remember that /proc/mounts was filtered in older kernel versions, 
ie. mounts not visible in the chroot would not be shown. Maybe that would 
be enough to solve my problem of device detection.


Kernel version:
	# cat /proc/version
	Linux version 2.6.14-1-686-smp (Debian 2.6.14-2) ([email protected]) (gcc version 4.0.3 20051023 (prerelease) (Debian 4.0.2-3)) #1 SMP Tue Nov 1 16:06:13 JST 2005



Please keep me CC'd, as I'm not subscribed.

Thank you for all answers!


Regards,

Phil
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux