Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Gentoo: User

To mount or not to Mount proc, that is the question

 

 

Gentoo user RSS feed   Index | Next | Previous | View Threaded


markknecht at gmail

Mar 16, 2012, 12:40 PM

Post #1 of 5 (160 views)
Permalink
To mount or not to Mount proc, that is the question

I've been trying to debug a problem where one laptop's networking, as
controlled by wicd, seems to randomly go offline once in awhile. In
the process of reviewing 5 machines I ran across an inconsistency
across a bunch of my machines, new and old. It seems some of them
mount proc in fstab while others do not. Some of these machines have
been around for a few years not mounting proc and except for the
laptop's networking issues there really haven't been any problems.

Looking at the Gentoo amd64 install guide here:

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8

it appears that the recommendation is to mount proc.

[QUOTE]

/dev/sda1 /boot ext2 defaults,noatime 1 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / ext3 noatime 0 1

/dev/cdrom /mnt/cdrom auto noauto,user 0 0

proc /proc proc defaults 0 0
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0

[QUOTE]


What would the issues be with proc not mounted? For instance, this
machine doesn't mount proc in fstab but still has proc:

laptop1 ~ # cat /etc/fstab
<SNIP>
/dev/sdb1 /boot ext2 noauto,noatime 1 2
/dev/sdb4 / ext3 noatime 0 1
/dev/sdb2 none swap sw 0 0
/dev/cdrom /mnt/cdrom auto noauto,ro 0 0

shm /dev/shm tmpfs
nodev,nosuid,noexec 0 0


laptop1 ~ # cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md127 : active (auto-read-only) raid1 sdb3[1] sda3[0]
343758245 blocks super 1.2 [2/2] [UU]

unused devices: <none>
laptop1 ~ #

Thanks,
Mark


caneko at gmail

Mar 16, 2012, 12:47 PM

Post #2 of 5 (164 views)
Permalink
Re: To mount or not to Mount proc, that is the question [In reply to]

On Fri, Mar 16, 2012 at 1:40 PM, Mark Knecht <markknecht [at] gmail> wrote:
> I've been trying to debug a problem where one laptop's networking, as
> controlled by wicd, seems to randomly go offline once in awhile. In
> the process of reviewing 5 machines I ran across an inconsistency
> across a bunch of my machines, new and old. It seems some of them
> mount proc in fstab while others do not. Some of these machines have
> been around for a few years not mounting proc and except for the
> laptop's networking issues there really haven't been any problems.
>
> Looking at the Gentoo amd64 install guide here:
>
> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
>
> it appears that the recommendation is to mount proc.
>
> [QUOTE]
>
> /dev/sda1   /boot        ext2    defaults,noatime     1 2
> /dev/sda2   none         swap    sw                   0 0
> /dev/sda3   /            ext3    noatime              0 1
>
> /dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0
>
> proc        /proc        proc    defaults             0 0
> shm         /dev/shm     tmpfs   nodev,nosuid,noexec  0 0
>
> [QUOTE]
>
>
> What would the issues be with proc not mounted? For instance, this
> machine doesn't mount proc in fstab but still has proc:
>
> laptop1 ~ # cat /etc/fstab
> <SNIP>
> /dev/sdb1               /boot           ext2            noauto,noatime  1 2
> /dev/sdb4               /               ext3            noatime         0 1
> /dev/sdb2               none            swap            sw              0 0
> /dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0
>
> shm                     /dev/shm        tmpfs
> nodev,nosuid,noexec     0 0
>
>
> laptop1 ~ # cat /proc/mdstat
> Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
> md127 : active (auto-read-only) raid1 sdb3[1] sda3[0]
>      343758245 blocks super 1.2 [2/2] [UU]
>
> unused devices: <none>
> laptop1 ~ #

I haven't put /proc explicitly on my /etc/fstab since a long time ago,
and everything seems to be working. However, I use systemd, which
always mounts /proc with the default options, and only uses the entry
in /etc/fstab (if present) to override the default options. In other
words, systemd always mounts /proc, no matter if it's listed in
/etc/fstab or not.

I don't know what OpenRC does, but it would not surprise me that it's
something similar.

Regards.
--
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México


markknecht at gmail

Mar 16, 2012, 2:18 PM

Post #3 of 5 (163 views)
Permalink
Re: To mount or not to Mount proc, that is the question [In reply to]

On Fri, Mar 16, 2012 at 12:47 PM, Canek Peláez Valdés <caneko [at] gmail> wrote:
> On Fri, Mar 16, 2012 at 1:40 PM, Mark Knecht <markknecht [at] gmail> wrote:
<SNIP>
>> Looking at the Gentoo amd64 install guide here:
>>
>> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
>>
>> it appears that the recommendation is to mount proc.
>>
>> [QUOTE]
>>
>> /dev/sda1   /boot        ext2    defaults,noatime     1 2
>> /dev/sda2   none         swap    sw                   0 0
>> /dev/sda3   /            ext3    noatime              0 1
>>
>> /dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0
>>
>> proc        /proc        proc    defaults             0 0
>> shm         /dev/shm     tmpfs   nodev,nosuid,noexec  0 0
>>
>> [QUOTE]
<SNIP>
>
> I haven't put /proc explicitly on my /etc/fstab since a long time ago,
> and everything seems to be working. However, I use systemd, which
> always mounts /proc with the default options, and only uses the entry
> in /etc/fstab (if present) to override the default options. In other
> words, systemd always mounts /proc, no matter if it's listed in
> /etc/fstab or not.
>
> I don't know what OpenRC does, but it would not surprise me that it's
> something similar.
>
> Regards.
> --
> Canek Peláez Valdés
> Posgrado en Ciencia e Ingeniería de la Computación
> Universidad Nacional Autónoma de México
>

Thanks Canek. I appreciate your response.

It seems when rereading the link above the authors do put the work
'example' in italics, implying that possibly I should know what I'm
doing and not depend on the text on that page. I'm fine with the not
depending part. I'm not so sure about the 'know what I'm doing' part.
;-)

I'm going to take a wild guess that it's somehow mounted in an init
script these days but I have no reason to know that's actually how it
gets done. I did read the kernel docs and it doesn't seem to be done
automatically by the kernel AFAICT.

Thanks,
Mark


caneko at gmail

Mar 16, 2012, 2:40 PM

Post #4 of 5 (158 views)
Permalink
Re: To mount or not to Mount proc, that is the question [In reply to]

On Fri, Mar 16, 2012 at 3:18 PM, Mark Knecht <markknecht [at] gmail> wrote:
> On Fri, Mar 16, 2012 at 12:47 PM, Canek Peláez Valdés <caneko [at] gmail> wrote:
>> On Fri, Mar 16, 2012 at 1:40 PM, Mark Knecht <markknecht [at] gmail> wrote:
> <SNIP>
>>> Looking at the Gentoo amd64 install guide here:
>>>
>>> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
>>>
>>> it appears that the recommendation is to mount proc.
>>>
>>> [QUOTE]
>>>
>>> /dev/sda1   /boot        ext2    defaults,noatime     1 2
>>> /dev/sda2   none         swap    sw                   0 0
>>> /dev/sda3   /            ext3    noatime              0 1
>>>
>>> /dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0
>>>
>>> proc        /proc        proc    defaults             0 0
>>> shm         /dev/shm     tmpfs   nodev,nosuid,noexec  0 0
>>>
>>> [QUOTE]
> <SNIP>
>>
>> I haven't put /proc explicitly on my /etc/fstab since a long time ago,
>> and everything seems to be working. However, I use systemd, which
>> always mounts /proc with the default options, and only uses the entry
>> in /etc/fstab (if present) to override the default options. In other
>> words, systemd always mounts /proc, no matter if it's listed in
>> /etc/fstab or not.
>>
>> I don't know what OpenRC does, but it would not surprise me that it's
>> something similar.
>>
>> Regards.
>> --
>> Canek Peláez Valdés
>> Posgrado en Ciencia e Ingeniería de la Computación
>> Universidad Nacional Autónoma de México
>>
>
> Thanks Canek. I appreciate your response.
>
> It seems when rereading the link above the authors do put the work
> 'example' in italics, implying that possibly I should know what I'm
> doing and not depend on the text on that page. I'm fine with the not
> depending part. I'm not so sure about the 'know what I'm doing' part.
> ;-)
>
> I'm going to take a wild guess that it's somehow mounted in an init
> script these days but I have no reason to know that's actually how it
> gets done. I did read the kernel docs and it doesn't seem to be done
> automatically by the kernel AFAICT.

No, it's the init system; look at /lib/rc/sh/init.sh:66:

# By default VServer already has /proc mounted, but OpenVZ does not!
# However, some of our users have an old proc image in /proc
# NFC how they managed that, but the end result means we have to test if
# /proc actually works or not. We do this by comparing two reads of
# /proc/self/environ for which we have set the variable VAR to two
# different values. If the comparison comes back equal, we know that
# /proc is not working.
mountproc=true
f=/proc/self/environ
if [ -e $f ]; then
if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then
eerror "You have cruft in /proc that should be deleted"
else
einfo "/proc is already mounted, skipping"
mountproc=false
fi
fi
unset f

if $mountproc; then
procfs="proc"
[ "$RC_UNAME" = "GNU/kFreeBSD" ] && proc="linprocfs"
ebegin "Mounting /proc"
if ! fstabinfo --mount /proc; then
mount -n -t "$procfs" -o noexec,nosuid,nodev proc /proc
fi
eend $?
fi

Mistery solved :D

Regards.
--
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México


markknecht at gmail

Mar 16, 2012, 2:50 PM

Post #5 of 5 (161 views)
Permalink
Re: To mount or not to Mount proc, that is the question [In reply to]

On Fri, Mar 16, 2012 at 2:40 PM, Canek Peláez Valdés <caneko [at] gmail> wrote:
> On Fri, Mar 16, 2012 at 3:18 PM, Mark Knecht <markknecht [at] gmail> wrote:
>> On Fri, Mar 16, 2012 at 12:47 PM, Canek Peláez Valdés <caneko [at] gmail> wrote:
>>> On Fri, Mar 16, 2012 at 1:40 PM, Mark Knecht <markknecht [at] gmail> wrote:
>> <SNIP>
>>>> Looking at the Gentoo amd64 install guide here:
>>>>
>>>> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
>>>>
>>>> it appears that the recommendation is to mount proc.
>>>>
>>>> [QUOTE]
>>>>
>>>> /dev/sda1   /boot        ext2    defaults,noatime     1 2
>>>> /dev/sda2   none         swap    sw                   0 0
>>>> /dev/sda3   /            ext3    noatime              0 1
>>>>
>>>> /dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0
>>>>
>>>> proc        /proc        proc    defaults             0 0
>>>> shm         /dev/shm     tmpfs   nodev,nosuid,noexec  0 0
>>>>
>>>> [QUOTE]
>> <SNIP>
>>>
>>> I haven't put /proc explicitly on my /etc/fstab since a long time ago,
>>> and everything seems to be working. However, I use systemd, which
>>> always mounts /proc with the default options, and only uses the entry
>>> in /etc/fstab (if present) to override the default options. In other
>>> words, systemd always mounts /proc, no matter if it's listed in
>>> /etc/fstab or not.
>>>
>>> I don't know what OpenRC does, but it would not surprise me that it's
>>> something similar.
>>>
>>> Regards.
>>> --
>>> Canek Peláez Valdés
>>> Posgrado en Ciencia e Ingeniería de la Computación
>>> Universidad Nacional Autónoma de México
>>>
>>
>> Thanks Canek. I appreciate your response.
>>
>> It seems when rereading the link above the authors do put the work
>> 'example' in italics, implying that possibly I should know what I'm
>> doing and not depend on the text on that page. I'm fine with the not
>> depending part. I'm not so sure about the 'know what I'm doing' part.
>> ;-)
>>
>> I'm going to take a wild guess that it's somehow mounted in an init
>> script these days but I have no reason to know that's actually how it
>> gets done. I did read the kernel docs and it doesn't seem to be done
>> automatically by the kernel AFAICT.
>
> No, it's the init system; look at /lib/rc/sh/init.sh:66:
>
> # By default VServer already has /proc mounted, but OpenVZ does not!
> # However, some of our users have an old proc image in /proc
> # NFC how they managed that, but the end result means we have to test if
> # /proc actually works or not. We do this by comparing two reads of
> # /proc/self/environ for which we have set the variable VAR to two
> # different values. If the comparison comes back equal, we know that
> # /proc is not working.
> mountproc=true
> f=/proc/self/environ
> if [ -e $f ]; then
>        if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then
>                eerror "You have cruft in /proc that should be deleted"
>        else
>                einfo "/proc is already mounted, skipping"
>                mountproc=false
>        fi
> fi
> unset f
>
> if $mountproc; then
>        procfs="proc"
>        [ "$RC_UNAME" = "GNU/kFreeBSD" ] && proc="linprocfs"
>        ebegin "Mounting /proc"
>        if ! fstabinfo --mount /proc; then
>                mount -n -t "$procfs" -o noexec,nosuid,nodev proc /proc
>        fi
>        eend $?
> fi
>
> Mistery solved :D
>
> Regards.
> --
> Canek Peláez Valdés
> Posgrado en Ciencia e Ingeniería de la Computación
> Universidad Nacional Autónoma de México
>

Yep, that's it. Somewhat interestingly it was at line 89 in my file
but that may well be differences between OpenRC and systemd, etc.
Anyway, the code looks identical and at least on the one machine I've
tested it doesn't seem to have hurt anythign to remove it from my
fstab file.

!Thanks!

Cheers,
Mark

Gentoo user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.