Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 362635 - sys-apps/openrc 0.8.0 & vserver: init.sh error when testing /proc
Summary: sys-apps/openrc 0.8.0 & vserver: init.sh error when testing /proc
Status: RESOLVED DUPLICATE of bug 348416
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-08 16:54 UTC by Jarry
Modified: 2011-04-08 19:36 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jarry 2011-04-08 16:54:46 UTC
/lib64/rc/sh/init.sh tests if /proc is mounted (VServer) or not (OpenVZ). But check routine changed and now does not work correctly (tries to mount /proc even when it is already mounted).

When booting gentoo vserver-guest with openrc-0.7.0 we get these messages:
---begin---
   OpenRC 0.7.0 is starting up Gentoo Linux (x86_64) [VSERVER]
 * /proc is already mounted, skipping
----end----

With openrc-0.8.0 we get these messages:
---begin---
   OpenRC 0.8.0 is starting up Gentoo Linux (x86_64) [VSERVER]
 * You have cruft in /proc that should be deleted
 * Mounting /proc ...
mount: permission denied                       [ !! ]
----end----

I think reason for this is the detection routine changed:

openrc-0.7.0

---begin---
if [ -e /proc/uptime ]; then
	up="$(cat /proc/uptime)"
	sleep 1
	if [ "$up" = "$(cat /proc/uptime)" ]; then
		eerror "You have cruft in /proc that should be deleted"
	else
		einfo "/proc is already mounted, skipping"
		mountproc=false
	fi
fi
----end----

openrc-0.8.0

---begin---
f=/proc/self/stat
if [ -e $f ]; then
	exec 9<$f ; read a <&9 ; exec 9<&-
	exec 9<$f ; read b <&9 ; exec 9<&-
	if [ "$a" = "$b" ]; then
		eerror "You have cruft in /proc that should be deleted"
	else
		einfo "/proc is already mounted, skipping"
		mountproc=false
	fi
fi
----end----

I think those two /proc/self/stat checks are executed without any delay, so results are the same, therefore init.sh tries to mount /proc even though it is already mounted. Quick & dirty patch is to change corresponding part of the file /lib64/rc/sh/init.sh from:
...
exec 9<$f ; read a <&9 ; exec 9<&-
exec 9<$f ; read b <&9 ; exec 9<&-
...

to:
...
exec 9<$f ; read a <&9 ; exec 9<&-
sleep 1
exec 9<$f ; read b <&9 ; exec 9<&-
...

And it solved my problem. No more error messages, /proc is detected as mounted.

Reproducible: Always

Steps to Reproduce:
1. update gentoo vserver-guest to openrc 0.8.0
2. start gentoo vserver-guest
3. watch boot-up messages

Actual Results:  
init.sh does not detect /proc mounted, tries to mount /proc and reports error

Expected Results:  
init.sh should detect /proc is already mounted and skip mounting it

I get this error in gentoo vserver-guest with baselayout-2.x. Gentoo vserver-host is still running with baselayout-1.x.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-04-08 19:33:24 UTC
Duplicate, but I don't have the other bug# at hand right now.
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-04-08 19:36:54 UTC

*** This bug has been marked as a duplicate of bug 348416 ***