Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] To mount or not to Mount proc, that is the question
Date: Fri, 16 Mar 2012 21:41:26
Message-Id: CADPrc80jAGM5_6-+gYuOna8Oj-PGzUFOeBVUEPW5uvp-JOvhXg@mail.gmail.com
In Reply to: Re: [gentoo-user] To mount or not to Mount proc, that is the question by Mark Knecht
1 On Fri, Mar 16, 2012 at 3:18 PM, Mark Knecht <markknecht@×××××.com> wrote:
2 > On Fri, Mar 16, 2012 at 12:47 PM, Canek Peláez Valdés <caneko@×××××.com> wrote:
3 >> On Fri, Mar 16, 2012 at 1:40 PM, Mark Knecht <markknecht@×××××.com> wrote:
4 > <SNIP>
5 >>> Looking at the Gentoo amd64 install guide here:
6 >>>
7 >>> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8
8 >>>
9 >>> it appears that the recommendation is to mount proc.
10 >>>
11 >>> [QUOTE]
12 >>>
13 >>> /dev/sda1   /boot        ext2    defaults,noatime     1 2
14 >>> /dev/sda2   none         swap    sw                   0 0
15 >>> /dev/sda3   /            ext3    noatime              0 1
16 >>>
17 >>> /dev/cdrom  /mnt/cdrom   auto    noauto,user          0 0
18 >>>
19 >>> proc        /proc        proc    defaults             0 0
20 >>> shm         /dev/shm     tmpfs   nodev,nosuid,noexec  0 0
21 >>>
22 >>> [QUOTE]
23 > <SNIP>
24 >>
25 >> I haven't put /proc explicitly on my /etc/fstab since a long time ago,
26 >> and everything seems to be working. However, I use systemd, which
27 >> always mounts /proc with the default options, and only uses the entry
28 >> in /etc/fstab (if present) to override the default options. In other
29 >> words, systemd always mounts /proc, no matter if it's listed in
30 >> /etc/fstab or not.
31 >>
32 >> I don't know what OpenRC does, but it would not surprise me that it's
33 >> something similar.
34 >>
35 >> Regards.
36 >> --
37 >> Canek Peláez Valdés
38 >> Posgrado en Ciencia e Ingeniería de la Computación
39 >> Universidad Nacional Autónoma de México
40 >>
41 >
42 > Thanks Canek. I appreciate your response.
43 >
44 > It seems when rereading the link above the authors do put the work
45 > 'example' in italics, implying that possibly I should know what I'm
46 > doing and not depend on the text on that page. I'm fine with the not
47 > depending part. I'm not so sure about the 'know what I'm doing' part.
48 > ;-)
49 >
50 > I'm going to take a wild guess that it's somehow mounted in an init
51 > script these days but I have no reason to know that's actually how it
52 > gets done. I did read the kernel docs and it doesn't seem to be done
53 > automatically by the kernel AFAICT.
54
55 No, it's the init system; look at /lib/rc/sh/init.sh:66:
56
57 # By default VServer already has /proc mounted, but OpenVZ does not!
58 # However, some of our users have an old proc image in /proc
59 # NFC how they managed that, but the end result means we have to test if
60 # /proc actually works or not. We do this by comparing two reads of
61 # /proc/self/environ for which we have set the variable VAR to two
62 # different values. If the comparison comes back equal, we know that
63 # /proc is not working.
64 mountproc=true
65 f=/proc/self/environ
66 if [ -e $f ]; then
67 if [ "$(VAR=a cat $f)" = "$(VAR=b cat $f)" ]; then
68 eerror "You have cruft in /proc that should be deleted"
69 else
70 einfo "/proc is already mounted, skipping"
71 mountproc=false
72 fi
73 fi
74 unset f
75
76 if $mountproc; then
77 procfs="proc"
78 [ "$RC_UNAME" = "GNU/kFreeBSD" ] && proc="linprocfs"
79 ebegin "Mounting /proc"
80 if ! fstabinfo --mount /proc; then
81 mount -n -t "$procfs" -o noexec,nosuid,nodev proc /proc
82 fi
83 eend $?
84 fi
85
86 Mistery solved :D
87
88 Regards.
89 --
90 Canek Peláez Valdés
91 Posgrado en Ciencia e Ingeniería de la Computación
92 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: [gentoo-user] To mount or not to Mount proc, that is the question Mark Knecht <markknecht@×××××.com>