Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

stage1: common: mount also the host cgroup hierarchy #1437

Merged
merged 4 commits into from Sep 24, 2015

Conversation

iaguis
Copy link
Member

@iaguis iaguis commented Sep 18, 2015

To avoid problems on environments without a properly mounted cgroup
hierarchy and/or without the systemd hierarchy we also deal with
mounting the host cgroup hierarchy.

Since we're in a different mount namespace the host is not affected.

Fixes #1320
Fixes #1076
Fixes #1042

@iaguis
Copy link
Member Author

iaguis commented Sep 18, 2015

With this PR I managed to run rkt on Void Linux without needing to do anything else. For it to work I needed to create and join a subcgroup (see last commit).

Isolators don't work, I'll look into it next week.

@iaguis
Copy link
Member Author

iaguis commented Sep 22, 2015

Isolators work now too in Void Linux

@jaybuff
Copy link

jaybuff commented Sep 23, 2015

I tried this and it works as advertised. Thanks @iaguis!

// 1. Mount RW knobs we need to make the enabled isolators work
for _, c := range controllers {
cPath := filepath.Join(cgroupTmpfs, c)
// 1a. Check if we're running from a unit to know which subcgroup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code below does not seem to check if you are running from a unit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, comment rot

@jonboulle
Copy link
Contributor

@iaguis this also fixes #1042 right?

@iaguis
Copy link
Member Author

iaguis commented Sep 24, 2015

@iaguis this also fixes #1042 right?

Yep!

@iaguis iaguis force-pushed the mount-host-cgroups branch 5 times, most recently from 9bacdfe to 7c8a789 Compare September 24, 2015 13:12
var flags uintptr

// 1. Mount /sys read-only
// Mount /sys read-only
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/read-only//

To avoid problems on environments without a properly mounted cgroup
hierarchy and/or without the systemd hierarchy we also mount the host
cgroup hierarchy.

Since we're in a different mount namespace the host is not affected.
systemd-nspawn doesn't allow the caller process to be in the root
cgroup. If that is the case, we create and add ourselves to a new "rkt"
subcgroup.

Distributions like Void Linux put every process in the root cgroup by
default so this allows rkt to work on them.
@alban
Copy link
Member

alban commented Sep 24, 2015

LGTM if the tests pass.

@iaguis
Copy link
Member Author

iaguis commented Sep 24, 2015

Thanks!

iaguis added a commit that referenced this pull request Sep 24, 2015
stage1: common: mount also the host cgroup hierarchy
@iaguis iaguis merged commit d858582 into rkt:master Sep 24, 2015
@jonboulle
Copy link
Contributor

👍
@jaybuff thanks for the suggestion, much better!

@jaybuff
Copy link

jaybuff commented Sep 24, 2015

Thanks for getting this done! I tried it and it works great.

@iaguis
Copy link
Member Author

iaguis commented Sep 24, 2015

Yeah, thanks a lot @jaybuff!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants