Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 530138 - sys-apps/openrc-0.13.1 - cgroup mounting issues
Summary: sys-apps/openrc-0.13.1 - cgroup mounting issues
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 529332 openrc-0.14
  Show dependency tree
 
Reported: 2014-11-22 18:19 UTC by Eric Gisse
Modified: 2014-11-24 04:57 UTC (History)
1 user (show)

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


Attachments
sysfs.patch (sysfs.patch,500 bytes, patch)
2014-11-22 21:35 UTC, William Hubbs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Gisse 2014-11-22 18:19:11 UTC
The sysfs init script is printing out a bunch of spurious noise when one attempts to re-run it, relating to the cgroup sysfs entry not liking being remounted. 

This originally presented itself while working with selinux, however I'd like to emphasize that this does not limit itself to selinux machines.

During the boot process, sysfs gets ran in sysvinit. But it then gets called again by localmount/procfs later and you see something like this:

mkdir: cannot create directory '/sys/fs/cgroup/cpuset': File exists
mount: cpuset is already mounted or /sys/fs/cgroup/cpuset busy
       cpuset is already mounted on /sys/fs/cgroup/cpuset
mkdir: cannot create directory '/sys/fs/cgroup/cpu': File exists
mount: cpu is already mounted or /sys/fs/cgroup/cpu busy
       cpu is already mounted on /sys/fs/cgroup/cpu
mkdir: cannot create directory '/sys/fs/cgroup/cpuacct': File exists
mount: cpuacct is already mounted or /sys/fs/cgroup/cpuacct busy
       cpuacct is already mounted on /sys/fs/cgroup/cpuacct
mkdir: cannot create directory '/sys/fs/cgroup/net_prio': File exists
mount: net_prio is already mounted or /sys/fs/cgroup/net_prio busy
       net_prio is already mounted on /sys/fs/cgroup/net_prio
 * ERROR: sysfs failed to start

This in turn causes dependency issues down the road when wanting to manually start interfaces and such.

The mounting issues have happened across 3 separate machines of mine, two of which are selinux and one explicitly not. This causes a nontrivial amount of confusion (well, at least for myself) when initially troubleshooting boot issues.

Failures like this are mostly cosmetic because the systems start up quite fine, though this adds a bit of noise to the process which I find annoying to deal with.

My shortcut for dealing with this is to explicitly return 0 just like localmount does, because I don't want to deal with this blocking everything.

I think a reasonable way to deal with this would be to explicitly add checks such that the cgroup mounting does not try to happen if there are already mounts in place.

It has been my experience that sysfs is a very special snowflake that does not like to be messed with.

This additionally ties into an actual selinux issue: https://bugs.gentoo.org/show_bug.cgi?id=529332
Comment 1 William Hubbs gentoo-dev 2014-11-22 21:28:46 UTC
I want to ask a couple of questions about your comments.

(In reply to Eric Gisse from comment #0)
> During the boot process, sysfs gets ran in sysvinit. But it then gets called
> again by localmount/procfs later and you see something like this:

I'm not sure what you mean here, because localmount does not have a dependency on sysfs.

> mkdir: cannot create directory '/sys/fs/cgroup/cpuset': File exists
> mount: cpuset is already mounted or /sys/fs/cgroup/cpuset busy
>        cpuset is already mounted on /sys/fs/cgroup/cpuset
> mkdir: cannot create directory '/sys/fs/cgroup/cpu': File exists
> mount: cpu is already mounted or /sys/fs/cgroup/cpu busy
>        cpu is already mounted on /sys/fs/cgroup/cpu
> mkdir: cannot create directory '/sys/fs/cgroup/cpuacct': File exists
> mount: cpuacct is already mounted or /sys/fs/cgroup/cpuacct busy
>        cpuacct is already mounted on /sys/fs/cgroup/cpuacct
> mkdir: cannot create directory '/sys/fs/cgroup/net_prio': File exists
> mount: net_prio is already mounted or /sys/fs/cgroup/net_prio busy
>        net_prio is already mounted on /sys/fs/cgroup/net_prio
>  * ERROR: sysfs failed to start

The only way you would get this type of message is if everything was already set up from the first run, so I'm thinking that we can just modify sysfs to return 0.

If I do that, sysfs would behave the same way localmount and netmount behave.
Comment 2 William Hubbs gentoo-dev 2014-11-22 21:35:01 UTC
Created attachment 390080 [details, diff]
sysfs.patch

All,

this is the patch I would apply to fix this.
I don't want to hide the messages from the mounts, because we don't do
that in localmount unless we use mountinfo, and having the messages
visible may show us if there is another issue.


Thanks,

William
Comment 3 Eric Gisse 2014-11-22 21:44:16 UTC
(In reply to William Hubbs from comment #1)
> I want to ask a couple of questions about your comments.
> 
> (In reply to Eric Gisse from comment #0)
> > During the boot process, sysfs gets ran in sysvinit. But it then gets called
> > again by localmount/procfs later and you see something like this:
> 
> I'm not sure what you mean here, because localmount does not have a
> dependency on sysfs.

Misremembering. I fought with this on an unrelated matter for awhile.

One of the later scripts, say lvm, does depend on sysfs. Which runs a second time, resulting in the output below.

I'm not clear why it does that, thus the bug report.

> 
> > mkdir: cannot create directory '/sys/fs/cgroup/cpuset': File exists
> > mount: cpuset is already mounted or /sys/fs/cgroup/cpuset busy
> >        cpuset is already mounted on /sys/fs/cgroup/cpuset
> > mkdir: cannot create directory '/sys/fs/cgroup/cpu': File exists
> > mount: cpu is already mounted or /sys/fs/cgroup/cpu busy
> >        cpu is already mounted on /sys/fs/cgroup/cpu
> > mkdir: cannot create directory '/sys/fs/cgroup/cpuacct': File exists
> > mount: cpuacct is already mounted or /sys/fs/cgroup/cpuacct busy
> >        cpuacct is already mounted on /sys/fs/cgroup/cpuacct
> > mkdir: cannot create directory '/sys/fs/cgroup/net_prio': File exists
> > mount: net_prio is already mounted or /sys/fs/cgroup/net_prio busy
> >        net_prio is already mounted on /sys/fs/cgroup/net_prio
> >  * ERROR: sysfs failed to start
> 
> The only way you would get this type of message is if everything was already
> set up from the first run, so I'm thinking that we can just modify sysfs to
> return 0.

That's precisely what's happening.

> 
> If I do that, sysfs would behave the same way localmount and netmount behave.

That's why I mentioned it as a solution. 

Now, I'm not saying *suppress* the messages. Just do checks to make sure nothing is mounted before trying to mount, because that causes errors and messy output.

That sysfs patch, by the way, is largely what I've been doing when this has been an issue in troubleshooting other - unrelated - things.
Comment 4 William Hubbs gentoo-dev 2014-11-23 23:04:08 UTC
(In reply to Eric Gisse from comment #3)
> (In reply to William Hubbs from comment #1)
> > I want to ask a couple of questions about your comments.
> > 
> > (In reply to Eric Gisse from comment #0)
> > > During the boot process, sysfs gets ran in sysvinit. But it then gets called
> > > again by localmount/procfs later and you see something like this:
> > 
> > I'm not sure what you mean here, because localmount does not have a
> > dependency on sysfs.
> 
> Misremembering. I fought with this on an unrelated matter for awhile.
> 
> One of the later scripts, say lvm, does depend on sysfs. Which runs a second
> time, resulting in the output below.
> 
> I'm not clear why it does that, thus the bug report.

The first time sysfs runs, it is run because it is in the sysinit runlevel.

The second time it runs is because a later script has "need sysfs" in the depend function, and need means that it will try to run whatever is listed on the need line if it is not already started.

> Now, I'm not saying *suppress* the messages. Just do checks to make sure
> nothing is mounted before trying to mount, because that causes errors and
> messy output.

Ok, I see what the deal is.

mountinfo -q is what we use to check to see if something is mounted, e.g.:

mount_sys()
{
    mountinfo -q /sys && return 0
    # code below here, in this function, doesn't execute if /sys is mounted
}

> That sysfs patch, by the way, is largely what I've been doing when this has
> been an issue in troubleshooting other - unrelated - things.

That patch needs to be used then, and I'll also improve the mount_cgroups function via using mountinfo -q checks.
Comment 5 William Hubbs gentoo-dev 2014-11-24 03:56:25 UTC
This is fixed in commit 30cc3cd and will be in OpenRC-0.14.
Comment 6 William Hubbs gentoo-dev 2014-11-24 04:57:01 UTC
This is also in OpenRC-0.13.6.