Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
openrc + libcgroup = trashed dependency tree. (SOLVED)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
hpeters
n00b
n00b


Joined: 26 Sep 2003
Posts: 68

PostPosted: Sat Dec 18, 2010 5:49 pm    Post subject: openrc + libcgroup = trashed dependency tree. (SOLVED) Reply with quote

I have an odd problem occuring with openrc ( part of baselayout 2 ) and libcgroup (unoffical package). When I open up a bash shell and it's pid get's moved to a cgroup other than the kernel default and the dependency cache is updated it trashes the dependency tree ( /lib/rc/init.d/deptree ) missing localmount etc.
This only occurs with bash shell's and nothing else if I move the the bash pid's back to the kernel default cgroup the dependency tree get's update fine.
This happens on both the Gentoo machines that I am running cgroups on.
The same general configuration and compile options are working fine under Arch Linux. ( of course it doesn't use openrc )

The only bug I saw under bugzilla that sounds similar is talking about root on lvm.
https://bugs.gentoo.org/show_bug.cgi?id=347583

Queston #1: Why would moving the bash pid's to another cgroup other than the kernel default ever have any impact on how the dependency tree is updated ?
Question #2: Any idea where to even begin to look ?

Turns out the bug https://bugs.gentoo.org/show_bug.cgi?id=347583 and this one are one in the same.
The temp fix suggested in the bug report works for me as well.

Comment #31 From Robin Johnson 2010-12-24 18:46:46 0000 [reply]

I think I found it

openrc/src/librc/librc.c:
236 else if (file_regex("/proc/self/cgroup", ":/.+$"))
237 return RC_SYS_LXC;

and you please test by changing line 236 there to:
236 else if (0 && file_regex("/proc/self/cgroup", ":/.+$"))



/etc/cgconfig.conf

mount {
blkio = /sys/fs/cgroup;
cpu = /sys/fs/cgroup;
cpuacct = /sys/fs/cgroup;
cpuset = /sys/fs/cgroup;
memory = /sys/fs/cgroup;
}

group default {
perm {
task {
uid = mythtv;
gid = mythtv;
}
admin {
uid = mythtv;
gid = mythtv;
}
}
blkio {
blkio.weight = 200;
}
cpu {
cpu.shares = 1024;
}
cpuset {
cpuset.cpus = 0-1;
cpuset.mems = 0;
}
memory {
memory.swappiness = 60;
}
}

group frontend {
perm {
task {
uid = mythtv;
gid = mythtv;
}
admin {
uid = mythtv;
gid = mythtv;
}
}
blkio {
blkio.weight = 1000;
}
cpu {
cpu.shares = 8192;
}
cpuset {
cpuset.cpus = 0-1;
cpuset.mems = 0;
}
memory {
memory.limit_in_bytes = 1G;
memory.memsw.limit_in_bytes = 1152M;
memory.swappiness = 1;
}
}

group high {
perm {
task {
uid = mythtv;
gid = mythtv;
}
admin {
uid = mythtv;
gid = mythtv;
}
}
blkio {
blkio.weight = 500;
}
cpu {
cpu.shares = 8192;
}
cpuset {
cpuset.cpus = 0-1;
cpuset.mems = 0;
}
memory {
memory.limit_in_bytes = 512M;
memory.memsw.limit_in_bytes = 640M;
memory.swappiness = 1;
}
}

group idle {
perm {
task {
uid = mythtv;
gid = mythtv;
}
admin {
uid = mythtv;
gid = mythtv;
}
}
blkio {
blkio.weight = 100;
}
cpu {
cpu.shares = 256;
}
cpuset {
cpuset.cpus = 0-1;
cpuset.mems = 0;
}
memory {
memory.limit_in_bytes = 768M;
memory.memsw.limit_in_bytes = 896M;
memory.swappiness = 60;
}
}

group mythtv {
perm {
task {
uid = mythtv;
gid = mythtv;
}
admin {
uid = mythtv;
gid = mythtv;
}
}
blkio {
blkio.weight = 333;
}
cpu {
cpu.shares = 2048;
}
cpuset {
cpuset.cpus = 0-1;
cpuset.mems = 0;
}
memory {
memory.swappiness = 20;
}
}

/etc/cgrules.conf

*:emerge * idle/
*:igdaemon * mythtv/
*:mplayer * high/
*:mythbackend * high/
*:mythcommflag * idle/
*:mythfrontend * frontend/
*:rsync * idle/
*:/usr/bin/X * mythtv/
*:xine * high/
harley * idle/
mythtv * mythtv/
portage * idle/
* * default/
# End of file

/etc/init.d/cgconfig

#!/sbin/runscript
#
# Control Groups Configuration Startup
#
# This script runs the cgconfigparser utility to parse and setup
# the control group filesystem. It uses ${CONFIG_FILE}
# and parses the configuration specified in there.
#
CGCONFIGPARSER="/usr/sbin/cgconfigparser"
CONFIG_FILE=${CONFIG_FILE:-"/etc/cgconfig.conf"}
RULES_FILE="/etc/cgrules.conf"

depend() {
need localmount
after cron dhcp lircd lm_sensors mdadm monit mysql mythbackend nagios net netmount nfs nfsmount npcd ntp-client ntpd rsyncd smartd sshd udev-postmount vsftpd
}

create_default_groups() {
declare defaultcgroup

if [ -f /etc/cgrules.conf ]
then
read user ctrl defaultcgroup <<< \
$(grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf)
if [[ -n $defaultcgroup && $defaultcgroup = "*" ]]
then
defaultcgroup=
fi
fi

if [ -z $defaultcgroup ]
then
defaultcgroup=sysdefault/
fi

#
# Find all mounted subsystems and create comma-separated list
# of controllers.
#
controllers=$(lssubsys 2>/dev/null | tr '\n' ',' | sed s/.$//)
echo "stop0"
#
# Create the default group, ignore errors when the default group
# already exists.
#
cgcreate -g $controllers:$defaultcgroup 2>/dev/null

#
# special rule for cpusets
#

if echo $controllers | grep -q -w cpuset; then
cpus=$(cgget -nv -r cpuset.cpus /)
cgset -r cpuset.cpus=$cpus $defaultcgroup
mems=$(cgget -nv -r cpuset.mems /)
cgset -r cpuset.mems=$mems $defaultcgroup
fi

#
# Classify everything to default cgroup. Ignore errors, some processes
# may exit after ps is run and before cgclassify moves them.
#
cgclassify -g $controllers:$defaultcgroup `ps --no-headers -eL o tid` \
2>/dev/null || :
}

classify_all() {
cgclassify "$@" $(ps --no-headers -eL o tid) 2>/dev/null
}

start() {
ebegin "Starting cgconfig service"

# Mount filesystem and create cgroups
if ! ${CGCONFIGPARSER} -l ${CONFIG_FILE} >/dev/null; then
eend 1 "Failed to parse ${CONFIG_FILE}"
return 1
fi

if [ $CREATE_DEFAULT == "yes" ]; then
create_default_groups >/dev/null
fi
if [ $CLASSIFY == "yes" ]; then
classify_all >/dev/null
fi

eend 0
}

stop() {
ebegin "Stopping cgconfig service"

# Gentoo deptree bug work around.
/usr/local/bin/classify_default.sh

# Cgclear hang bug work around.
kill_cgclear.sh >/dev/null 2>&1 &

cgclear >/dev/null
eend $?
}


libcgroup-0.37.ebuild

# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit autotools linux-info pam

DESCRIPTION="Tools and libraries to control and monitor control groups"
HOMEPAGE="http://libcg.sourceforge.net/"
SRC_URI="mirror://sourceforge/libcg/${P}.tar.bz2"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="+daemon debug pam static-libs +tools"

RDEPEND="( virtual/pam )"
DEPEND="${RDEPEND}
sys-devel/bison
sys-devel/flex"

pkg_setup() {
if use daemon && ! use tools; then
eerror "The daemon USE flag requires tools USE flag."
die "Please enable tools or disable daemon."
fi

local CONFIG_CHECK="~CGROUPS"
if use daemon; then
CONFIG_CHECK="${CONFIG_CHECK} ~CONNECTOR ~PROC_EVENTS"
fi
linux-info_pkg_setup
}

src_prepare() {
eautoreconf
}

src_configure() {
econf \
--enable-shared \
$(use_enable daemon) \
$(use_enable debug) \
$(use_enable pam) \
$(use_enable static-libs static) \
$(use_enable tools) \
--prefix=/usr \
--exec_prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=/$(get_libdir) || die
}

src_install() {
emake DESTDIR="${D}" install || die "Install failed"
find "${D}" -name '*.la' -exec rm -f {} + || die "la removal failed"

# Install PAM module into correct location.
mkdir -p ${D}$(get_libdir)/security
mv ${D}$(get_libdir)/security/pam_cgroup.so.*.*.* ${D}$(get_libdir)/security/pam_cgroup.so
rm -f ${D}$(get_libdir)/security/pam_cgroup.so.*

insinto /etc
doins samples/cgrules.conf || die

if use tools; then
doins samples/cgconfig.conf || die

newconfd "${FILESDIR}"/cgconfig.confd cgconfig || die
newinitd "${FILESDIR}"/cgconfig.initd cgconfig || die
fi

if use daemon; then
newconfd "${FILESDIR}"/cgred.confd cgred || die
newinitd "${FILESDIR}"/cgred.initd cgred || die
fi
}
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum