Gentoo Archives: gentoo-user

From: victor romanchuk <rom@××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Two issues with OpenRC/baselayout2 migration on a hosted VM
Date: Wed, 14 Dec 2011 14:30:28
Message-Id: 4EE8B2B3.2020106@persimplex.net
In Reply to: Re: [gentoo-user] Two issues with OpenRC/baselayout2 migration on a hosted VM by Pandu Poluan
1 Pandu Poluan wrote, at 12/13/2011 10:26 PM:
2 >
3 >
4 > On Dec 14, 2011 1:06 AM, "Tanstaafl" <tanstaafl@×××××××××××.org
5 > <mailto:tanstaafl@×××××××××××.org>> wrote:
6 > >
7 > > What should I set this to? Assuming that Linode is indeed using Xen, would
8 > it be:
9 > >
10 > > rc_sys="xenU"
11 > >
12 > > ?
13 >
14 > AFAIK Linode uses Xen so "xenU" is correct.
15 >
16 > What I really want to know is what happens if we specify a 'wrong' rc_sys value...
17 >
18 > (I also want to know why 'rc -S' is so unhelpful, but not as much as the above.)
19 >
20
21 i have looked through openrc sources and experimented a bit; the idea of rc_sys
22 is simple: the contents of that variable affects 'keyword' dependencies in
23 /etc/init.d/ scripts. the feature is documented, see runscript(8) for details,
24 but apparently does not work as expected. i also did not find valuable 'keyword'
25 dependencies in software packages i use thus considered that rc_sys might be set
26 to any value with no side effects
27
28 another thing i found is an $RC_SYS environment variable available to all
29 scripts initiated by rc; that one is set to value defined in /etc/rc.conf or
30 automatically detected if rc_sys is not explicitly set. the automatic detection
31 is trivial, eg. if the directory "/proc/xen" does exist, then $SYS_RC is set to
32 XENU. setting of $SYS_RC to XEN0 would be in case of "/proc/xen" existence and
33 if contents of the file /proc/xen/capabilities is equal to "control-d". all that
34 stuff could be found in src/librc/librc.c
35
36 i'm using $RC_SYS as a flag controlling start of xen dom0 daemons: rc_sys is
37 commented out in /etc/rc.conf to let runscript autodetect the environment. all
38 xen related stuff is started from /etc/local.d, like that:
39
40 $ cat /etc/local.d/xen.start
41 if [ "x$RC_SYS" = "xXEN0" ]; then
42 # start xenstored, xenconsole, configure xen networking etc
43 else
44 # do something else related to baremetal os boot
45 fi
46
47 this slightly speeds up boot process and produces more clear logs