[Lxc-users] lxc_cgroup start error

Serge Hallyn serge.hallyn at canonical.com
Fri Aug 24 12:50:50 UTC 2012


Quoting Christoph Mitasch (cmitasch at thomas-krenn.com):
> Hello,
> 
> I've built a LXC HA Cluster with Pacemaker and DRBD with Ubuntu 12.04.
> 
> >From time to time I get the following error when a container is startet.
>       lxc-start 1345755927.759 ERROR    lxc_cgroup - File exists - failed to create '/sys/fs/cgroup/perf_event//lxc' directory
>       lxc-start 1345755927.759 ERROR    lxc_start - failed to spawn 'test2'
>       lxc-start 1345755928.023 ERROR    lxc_cgroup - No such file or directory - failed to remove cgroup '/sys/fs/cgroup/perf_event//lxc/test2'
> 
> Any ideas what the problem could be here?

Sounds like a race in src/lxc/cgroup.c.  I'm guessing that:

        /* if cgparent does not exist, create it */
        if (access(cgparent, F_OK) && mkdir(cgparent, 0755)) {
                SYSERROR("failed to create '%s' directory", cgparent);
                return -1;
        }

the first two containers created after boot are racing here, and this
should be changed to

        /* if cgparent does not exist, create it */
        if (access(cgparent, F_OK) && mkdir(cgparent, 0755)) {
		if (errno != EEXIST) {
			SYSERROR("failed to create '%s' directory", cgparent);
			return -1;
		}
        }




More information about the lxc-users mailing list