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

Re: Broken /proc? [SOLVED}



on Wed, Feb 27, 2002, Richard A. Smith (rsmith@bitworks.com) wrote:
> On Wed, 27 Feb 2002 09:51:16 -0500, Noah Meyerhans wrote:
> 
> >On Mon, Feb 25, 2002 at 01:57:38PM -0600, Richard A. Smith wrote:
> >> Last week I did an 'apt-get update' of a debain unstable and now I've
> >> noticed that my /proc fs  is broke.  
> >> 
> >> It appears to be mounted correctly and all the entries show up if you
> >> do a 'ls' but if you actually try to look at an entry its just blank.
> >
> >Well, you're not the only one to see this problem...  I always though I
> >was!  I never figured out what caused it, and I haven't seen it in
> 
> I actually solved it that night but I didn't post because I didn't
> see any response.  But since a few others had the issue I'll outline
> what fixed it for me.
> 
> For me turns out the the /proc *was not* mounted.  Even though mount
> said it was.  Somehow I managed to copy a snapshot of the procfs onto
> the actuall /proc directory.  In otherwords /proc was not an empty
> directory.  It had a snapshot of a previously running system.  
> 
> Somehow this caused /proc to not get mounted from fstab.  But oddly
> enough only /proc, all the other filesystems in fstab mounted
> correctly.  And typing a 'mount' indicated that /proc was mounted.
> 
> I discovered it by looking at /etc/mtab which said that /proc was
> _not_ mounted.  

Careful there.

/etc/mtab gets its information from mount commands and/or /proc, which,
if it's not mounted (or your / partition is mounted ro) means that
/etc/mtab doesn't have definitative data.

Neat little secret:  /proc can be mounted multiple times, or rather, you
can mount a proc filesystem at multiple places on your FS tree.  I do
this routinely when, say, booting a rescue floppy to examine an
installed GNU/Linux system (or one that I'm building), after chrooting
into the install tree, so that utilities in the chrooted partition work
properly.  At this point, /proc/mounts (from either a booted or
chrooted shell) shows multiple proc mounts.  

Other useful information: if you're in the habit of mounting partitions
from a chrooted shell, _umount_ the partitions before exiting the shell,
you can't properly umount them from the non-chroot shell.  If you forget
to do this, chroot back in and clean up after yourself.

So:  mount an additional proc filesystem and compare contents,
particularly your secondary proc's 'mounts' file:

    $ mkdir /proc2
    $ mount -t proc proc /proc2
    $ cat /proc2/mounts
    <etc>
    $ umount /proc2; rmdir /proc2

> Once I did a rm -r on the fake /proc all was well.  So I guess the
> moral is don't trust the output of 'mount' if things are flaky or at
> least cross check it with /etc/mtab.

In general, if you're not sure of /proc's status or your root
partition's writeability, neither the 'mount' command, /etc/mtab, nor
/proc/mounts are going to be trustworthy.

Peace.

-- 
Karsten M. Self <kmself@ix.netcom.com>    http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?       There is no K5 cabal
  http://gestalt-system.sourceforge.net/         http://www.kuro5hin.org

Attachment: pgpMo5HJZvHQc.pgp
Description: PGP signature


Reply to: