Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
When scanning for uid/gid maps, discard if not mapped in the user namespace #2885
Comments
jameinel
referenced this issue
in juju/juju
Feb 15, 2017
Merged
even when the bridge has no addresses, still use DHCP #6985
lagunax
commented
Feb 15, 2017
|
i think that nest-test is unprivileged container, does it? |
|
nest-test is (security.privileged=false, security.nested=true) because the goal was to be able to nest containers without having to set privileged=true. Otherwise, why would you have a separate setting? |
|
If I make it (security.privileged=true, security.nested=true) then I can successfully create the container 'inside-test'. |
lagunax
commented
Feb 15, 2017
|
i don't know exactly, but i think that you can do it with chown -R for /var/lib/lxd/containers/inside-test. unpriviledge level limits rights of conteiner to users rights. priviledget level gives root's rights |
|
You only need security.nesting=true at the host level, but if you do that and your container doesn't have enough uid/gid to carve a second allocation, then you need the NESTED containers to be marked as security.privileged so they re-use their parent's container allocation instead of attempting to get their own. This situation is detected and handled properly when you run "lxd init" inside a container. It will detect that it's got insufficient uid/gid and ask you (defaulting to Yes) if you want to use the same uid/gid map as the parent. |
stgraber
closed this
Feb 15, 2017
|
|
It feels like at a minimum there could be a better message on launching the
container than "failed to chown /.../rootfs"
It is nice that you give a message in "lxd init", though that doesn't quite
solve what to do for automated deployments. I suppose some of that is us
coming up with a reasonable policy, and messaging that appropriately.
John
=:->
…
|
|
We should be able to tweak LXD's uid/gid map handling to ignore maps that aren't available due to the underlying ids not being mapped in the namespace. That'd then have LXD fallback to only supporting privileged containers and be able to fail a bit earlier. |
jameinel commentedFeb 15, 2017
Required information
driver: lxc
driverversion: 2.0.6
kernel: Linux
kernelarchitecture: x86_64
kernelversion: 4.4.0-62-generic
server: lxd
serverpid: 3426
serverversion: "2.8"
storage: zfs
storageversion: "5"
(lxc info has gotten awfully long, but I can include it if you want)
Issue description
A brief description of what failed or what could be improved.
Steps to reproduce
I'm currently running Xenial with the backported 2.8 LXD. If I try to do nested containers with Juju (juju bootstrap lxd; juju add-machine --to lxd:0) it is failing with:
If I set "security.privileged: true" in the profile, then I'm able to create a nested container. I thought "security.nested" was intended to be all you really needed to do.
When I track through the lxd code the line appears to be from:
shared/util_linux.go ShiftOwner()
which only seems to be called from:
shared/idmapset_linux.go doUidshiftIntoContainer
A simpler way to trigger this seems to be:
Note that if I set "security.privileged=true" along with "security.nested=true" then it does work to launch a nested container.