mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Problem substituting /proc/mounts for recovery
@ 2006-04-07 10:24 Ph. Marek
  2006-04-11 12:17 ` Ph. Marek
  0 siblings, 1 reply; 2+ messages in thread
From: Ph. Marek @ 2006-04-07 10:24 UTC (permalink / raw)
  To: linux-kernel

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) (horms@debian.org) (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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-11 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-07 10:24 Problem substituting /proc/mounts for recovery Ph. Marek
2006-04-11 12:17 ` Ph. Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®