cgroup-bin prevents libvirt from starting

Bug #828061 reported by Serge Hallyn
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libcgroup (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

It should not start cgred if cgred is not already started. In fact it should not deal with cgred at all. Rather it should wait until cgconfig is started. That is when we know cgconfig's prestart - which is where the reclassification of all tasks is done - has completed.

With the current libvirt-cgred-wait.conf, the first libvirtd to start after boot cannot start new VMs. The reason can be seen by running the following script:

#!/bin/bash
p=`pidof libvirtd`
echo "task: $p"
cat /proc/$p/cgroup
echo -n "threads:"
for t in `/bin/ls /proc/$p/task`; do
        echo -n $t
done
echo

echo "Cgroups:"
for t in `/bin/ls /proc/$p/task`; do
        echo -n "$t: "
        cat /proc/$t/cgroup
        echo
done

This shows that while the parent libvirt task is in /sysdefault, all its thread are still in /. After doing 'stop libvirt-bin; start libvirt-bin' all tasks are in sysdefault.

By using the attached /etc/init/libvirt-cgconfig-wait.conf instead, libvirt appears to (in my repeated testing) start up correctly.

Tags: patch
Changed in libcgroup (Ubuntu):
status: New → In Progress
importance: Undecided → Critical
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

While the libvirt-cgred-wait.conf problem is real, there is another problem.

According to upstart debub output, cgconfig is running twice. Every time it runs, it reclassifies all tasks, moving them first to '/' and then to '/sysdefault'.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

This debdiff has been workign for me across several tests.

tags: added: patch
summary: - libvirt-cgred-wait.conf is broken
+ cgroup-bin prevents libvirt from starting
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

reducing priority because there is a workaround - using cgroup-lite.

The packages at https://bugs.launchpad.net/ubuntu/+source/libcgroup/+bug/828061 are fixing this problem for me.

At heart the problem was that the libvirt-cgred-wait job would, if cgred was not already running, start it. But it's not cgred that we're waiting on. Rather it is the pre-start for cgconfig which must finish. So the new libvirt-cgconfig-wait job waits for cgconfig to be in state 'start'. If it takes more than 2 minutes to start, then something is wrong, with cgtroup-bin and libvirt can go ahead and start, since what matters for libvirt is not that cgroup-bin be running, but rather that it not reclassify libvirt while libvirt is running.

Changed in libcgroup (Ubuntu):
importance: Critical → Medium
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Sorry! Bad cut-paste. The packages are at:

http://people.canonical.com/~serge/libcgroup-fix-libvirt/

(smoser: those do not yet have the fixes discussed on irc. I will put the final version at

http://people.canonical.com/~serge/libcgroup-fix-libvirt2

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libcgroup - 0.37.1-1ubuntu7

---------------
libcgroup (0.37.1-1ubuntu7) oneiric; urgency=low

  * Replace broken /etc/init/libvirt-cgred-wait.conf with (hopefully much
    improved) /etc/init/libvirt-cgconfig-wait.conf. (LP: #828061)
  * Add a check to make sure /etc/init/cgconfig.conf only runs once, so
    that it does not (a) overmount /sys/fs/cgroup and (b) re-classify all
    tasks a second time, which is not only a waste of time, but is in fact
    harmful, for instance breaking libvirtd. (LP: #828061)
  * Don't run libvirt-cgconfig-wait.conf on install or upgrade. It's
    only mean to start when libvirt is starting, to make sure cgroups are
    set up before libvirt continues.
  * Rename /usr/sbin/create_default_cgroups.sh to
    /usr/sbin/create_default_cgroups (thanks to smoser)
  * cgroup-bin.libvirt-cgconfig-wait.upstart: just check grep return
    value rather than the length of its returned string.
 -- Serge Hallyn <email address hidden> Thu, 01 Sep 2011 20:08:49 -0500

Changed in libcgroup (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.