Skip to content

Kawasaki missing some parts #1640

Closed
Closed

Description

@TiredPixel

Concourse 3.5.0 Docker images don't work on CentOS 7, kernel 4.12.9-1.el7.elrepo.x86_64, Docker 17.05.0-ce, build 89658be, run within Docker Swarm.

runc create: exit status 1: container_linux.go:264: starting container process caused "process_linux.go:247: running exec setns process for init caused \"exit status 38\""

Considering #1424, #1501, and the fact that I've had serious problems related to containers and volumes with almost every version of Concourse on a variety of environments for the past few months of versions (usually leaky containers, getting stuck after a few hours or days, or failing to start entirely), without wanting to sound unduly confrontational (or ungrateful)—on which environments does Concourse work through the Docker images? Pre 3.5.0, it at least ran on the described environment with a later-than-standard kernel, albeit periodically breaking every few days and needing the workers to be recreated, and experiencing frequent stalled workers and volumes reaped from underneath—even if it didn't work on any recent Kubernetes cluster I've been running, no matter what the kernel. But now, even the configuration which did work is broken, and now I need to roll back to 3.4.1 again (which also has plenty of problems). Is there an environment build matrix or something somewhere? As I say, I don't want to sound unduly confrontational, here—but having experienced so many problems (such as the ones I've reported previously) on a variety of installations, OSes, kernels, and image orchestrators, this is becoming frustrating. Is Concourse 3.x stable? :|

Update: I'm suspecting this is another kernel-related incompatibility; the kernel was recently upgraded within the channel I'm tracking to a later 4.12, and having rolled back to Concourse 3.4.1, this doesn't appear to work anymore either. So, it might not actually be Concourse 3.5.0 itself, but rather a wider issue.

Update: This also appears to be a problem with kernel 4.13.3-1.el7.elrepo.x86_64.

Update: This also appears to be a problem with stock kernel 3.10.0-693.2.2.el7.x86_64. In case you're wondering why I'm usually tracking mainline 4.x above, it's because on previous versions of Concourse workers didn't work pre-4.10.x (specifically, I couldn't get 3.x working). However, I just tried using upgraded CentOS 7 stock kernel (non-mainline), and get the same problem.

Activity

  1. TiredPixel commented on Sep 24, 2017

    @TiredPixel
    Author

    Update: On further investigation, it seems these failures are for different reasons. Previously, error messages bubbled right up to the UI. But on closer examination of the Worker logs, I see that the exit status 38 is caused by different things.

    Kernel 3.10.0-693.2.2.el7.x86_64 fails with:

    {"timestamp":"1506245419.984744787","source":"guardian","message":"guardian.create.containerizer-create.runtime-create-failed","log_level":2,"data":{"error":"runc create: exit status 1: container_linux.go:264: starting container process caused \"unknown capability \\\"CAP_AUDIT_READ\\\"\"\n","handle":"c868b544-500a-4d96-78c5-55363fdd0635","session":"10340.2"}}
    

    This is actually as I'd expect, since Concourse requires kernels with CAP_AUDIT_READ. So, let's ignore this part.

    Kernel 4.13.3-1.el7.elrepo.x86_64, however, fails with:

    {"timestamp":"1506250805.274657011","source":"guardian","message":"guardian.create.create-failed-cleaningup.no-properties-for-container-skipping-destroy-network","log_level":2,
    "data":{"cause":"runc create: exit status 1: container_linux.go:264: starting container process caused \"process_linux.go:247: running exec setns process for init caused \\\"exit status 38\\\"\"\n","error":"property not found: kawasaki.host-interface","handle":"fb58371c-9c29-40dd-53a5-487822b16b76","session":"808.3"}}
    {"timestamp":"1506250805.274869442","source":"guardian","message":"guardian.api.garden-server.create.failed","log_level":2,"data":{"error":"runc create: exit status 1: container_linux.go:264: starting container process caused \"process_linux.go:247: running exec setns process for init caused \\\"exit status 38\\\"\"\n","request":{"Handle":"fb58371c-9
    c29-40dd-53a5-487822b16b76","GraceTime":0,"RootFSPath":"raw:///worker-state/volumes/live/e1e947d5-54f5-44de-424f-84e2acda58b6/volume","BindMounts":[{"src_path":"/worker-state/volumes/live/a768d503-31f1-4e4b-71f6-d9318d6ee0f7/volume","dst_path":"/scratch","mode":1}],"Network":"","Privileged":false,"Limits":{"bandwidth_limits":{},"cpu_limits":{},"disk_limits":{},"memory_limits":{},"pid_limits":{}}},"session":"3.1.1025"}}
    

    Am I right in deducing that the main issue is property not found: kawasaki.host-interface?

  2. TiredPixel commented on Sep 24, 2017

    @TiredPixel
    Author

    Update: This also happens with Docker 17.06.2-ce, build cec0b72.

  3. changed the title [-]process_linux exec setns init exit status 38[/-] [+]Kawasaki missing some parts[/+] on Sep 25, 2017
  4. TiredPixel commented on Sep 27, 2017

    @TiredPixel
    Author

    Update: On a different cluster, Concourse 3.5.0 works for running with Kubernetes 1.7.0, Ubuntu 16.04.3 LTS, non-default kernel 4.10.0-28-generic. (This is a big improvement on some recent versions—hurrah! :) ) However, note #1669, which I believe to be unrelated to this issue, yet prevents me from declaring that Concourse 3.5.0 actually works properly on this environment.

  5. topherbullock commented on Sep 27, 2017

    @topherbullock
    Contributor

    TLDR: I feel like this is an issue with Garden / RunC on the kernel version you've mentioned, and not a Concourse issue.

    There's an existing issue on RunC opencontainers/runc#1343 , which also mentions CentOS 7.x, which may point to a root cause in the kernel's support for user namespaces.

    3.10.0 is definitely a non-starter as you've deduced from the missing CAP_AUDIT_READ, but it seems like the host-interface property cannot be found for containers being initialized.

    Here's where the error occurs in Guardian: https://github.com/cloudfoundry/guardian/blob/58d21e4cdc8c2ca8330760be81508a50cdadb632/kawasaki/networker.go#L330
    It seems like that property should be saved here:
    https://github.com/cloudfoundry/guardian/blob/master/kawasaki/networker.go#L156-L165
    And config_creator.go figures out the host interface here:
    https://github.com/cloudfoundry/guardian/blob/master/kawasaki/config_creator.go#L75

    I'm convinced the networking component would fail earlier if it was unable to determine the host interface, and this error is a side effect.

    no-properties-for-container-skipping-destroy-network seems to indicate that these properties required for configuring the container's network are never actually propagated, and so garden isn't able to tell RunC what to initialize, which may indicate a deeper issue with setns and more missing user namespace capabilities.

  6. TiredPixel commented on Sep 27, 2017

    @TiredPixel
    Author

    @topherbullock, thanks for your reply, and indeed for your debugging notes. I'm inclined to agree with you, that it might not be Concourse itself at a top level—but I filed against this, because I think most people will consider it as such an issue given that this is the end-user program, and also because I'm not entirely sure where else I should file. It's also worth noting that the dependencies of Concourse come bundled, so it's not simply a case of swapping out a soft-dependency (indeed, I previously attempting patching runc version, but understandly lower components seem very sensitive to the version included).

    However, I have experienced this on multiple kernels—admittedly all non-stock mainline builds. What's interesting is that Concourse 3.4.0 (? I can't remember which recent version wouldn't work), used to work, albeit it frequent file not found and apparent garbage-collection errors. But certainly, the kernel has been upgraded, and this no longer runs.

    Given your thoughts, I intend to continue trying to run this with different kernel versions; I'll seemingly need at least < 4.13.3, but of course late enough to contain CAP_AUDIT_READ. I'll try to get some time to try some other recent kernels, and report back.

  7. topherbullock commented on Sep 27, 2017

    @topherbullock
    Contributor

    @TiredPixel Thanks for letting us know of the issue and looking into this more. We're on track to update our included version of Garden RunC to the latest release, which may help here; I agree with your point about how coupled we are to specific versions.

    I'm actually going to be spending a couple weeks with the Garden team next month, so I'm adding this to my list of things to cover with them while I'm there.

  8. chrisdpa-tvx commented on Sep 27, 2017

    @chrisdpa-tvx

    @topherbullock I managed to get this working on Centos by downgrading to kernel-ml 4.10.0-1.el7.elrepo.x86_64 and by adding a few selinux rules. In this instance

    1. setenforce 0
    2. tail -f /var/log/audit/audit.log | grep denied > ~/audit.log.cc
    3. start concourse
    4. use audit2allow to create the new rules
    5. update selinux & setenforce 1

    FYI it looks like this

    require {
    	type spc_t;
    	class cap_userns { dac_override dac_read_search kill setgid setpcap setuid sys_admin sys_chroot sys_ptrace };
    }
    
    #============= spc_t ==============
    allow spc_t self:cap_userns { dac_override dac_read_search kill setgid setpcap setuid sys_admin sys_chroot sys_ptrace };
    
  9. TiredPixel commented on Sep 28, 2017

    @TiredPixel
    Author

    @topherbullock, interesting to hear that you're considering updating the version of runc. Thanks for planning to cover it with the Garden team.

  10. TiredPixel commented on Sep 28, 2017

    @TiredPixel
    Author

    @chrisdpa-tvx, ahhhhhhhh, I didn't even explore SELinux; I'm running it enforcing on CentOS, but not on Ubuntu. This could well explain some of the confusion I've had in trying to get something working on even previous kernels. I'll keep this in mind when I attempt to find a working combination.

  11. chrisdpa-tvx commented on Sep 28, 2017

    @chrisdpa-tvx

    @TiredPixel I've got this working on kernel-ml-4.13.3-1.el7.elrepo.x86_64 in centos with SELinux updated using my method from yesterday... no downgrade needed. <= This is nice because 4.10 is no longer available in centos from repo = elrepo-kernel.

  12. TiredPixel commented on Sep 29, 2017

    @TiredPixel
    Author

    @chrisdpa-tvx, thanks a lot for your suggestions about this! I confirm that I've been able to resolve the issue on kernel 4.13.3-1.el7.elrepo.x86_64, installing a custom SELinux policy module.

    The audit failure started off as:

    type=AVC msg=audit(1506598563.515:10477): avc:  denied  { sys_admin } for  pid=10901 comm="runc:[1:CHILD]" capability=21  scontext=system_u:system_r:spc_t:s0 tcontext=system_u:system_r:spc_t:s0 tclass=cap_userns permissive=0
    type=SYSCALL msg=audit(1506598563.515:10477): arch=c000003e syscall=272 success=no exit=-1 a0=7c020000 a1=8780e4 a2=0 a3=0 items=0 ppid=10894 pid=10901 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="runc:[1:CHILD]" exe="/worker-state/3.5.0/assets/bin/runc" subj=system_u:system_r:spc_t:s0 key=(null)
    type=PROCTITLE msg=audit(1506598563.515:10477): proctitle=2F70726F632F73656C662F65786500696E6974
    

    This analysed as:

    type=AVC msg=audit(1506699421.216:223292): avc:  denied  { sys_admin } for  pid=17842 comm="runc:[1:CHILD]" capability=21  scontext=system_u:system_r:spc_t:s0 tcontext=system_u:system_r:spc_t:s0 tclass=cap_userns permissive=0
            Was caused by:
                    Missing type enforcement (TE) allow rule.
    
                    You can use audit2allow to generate a loadable module to allow this access.
    

    Iteratively analysing failures to build up a policy, these errors were reported in Concourse (the last one multiple iterations, as some denys don't result in a different exit code):

    runc create: exit status 1: container_linux.go:264: starting container process caused "process_linux.go:247: running exec setns process for init caused \"exit status 53\""
    
    runc create: exit status 1: container_linux.go:264: starting container process caused "process_linux.go:247: running exec setns process for init caused \"exit status 54\""
    
    runc create: exit status 1: container_linux.go:264: starting container process caused "process_linux.go:339: container init caused \"operation not permitted\""
    
    runc create: exit status 1: container_linux.go:264: starting container process caused "operation not permitted"
    

    Building a final policy file (refactored by hand):

    module concourse_1640 1.0;
    
    require {
            type spc_t;
            class cap_userns { dac_override dac_read_search kill net_admin setgid setpcap setuid sys_admin sys_chroot sys_ptrace };
            class file setattr;
    }
    
    #============= spc_t ==============
    allow spc_t self:cap_userns { dac_override dac_read_search kill net_admin setgid setpcap setuid sys_admin sys_chroot sys_ptrace };
    allow spc_t self:file setattr;
    

    There shouldn't be any need to disable and enable SELinux, so far as I'm aware. Certainly, I didn't when developing this policy module.

    I have no idea if it's actually safe to run with all these grants or not, but it does appear to be a minimal policy, for me. With this, Concourse is finally running. Hurrah!

    Who in the chain is responsible for creating SELinux policies? Is this a runc problem, or somewhere else?

    I also tried running Docker with selinux-enabled mode, but then pretty much nothing worked. :)

  13. gezhiwei8899 commented on Dec 18, 2017

    @gezhiwei8899

    @TiredPixel I still don't know how to solve the problem. : (

  14. TiredPixel commented on Dec 18, 2017

    @TiredPixel
    Author

    @gezhiwei8899, I'm sorry to hear that. I was able to to sort it in the end by applying my own SELinux policies, but other than that, I'm not aware of a solution. But I also haven't used Concourse much in the past few weeks, so it's possible it's been fixed on the latest version… I haven't heard anything, though.

  15. gezhiwei8899 commented on Dec 19, 2017

    @gezhiwei8899

    @TiredPixel thanks for replying.I update kernel to 4.0+.The problem solved. thanks!

  16. TiredPixel commented on Aug 12, 2018

    @TiredPixel
    Author

    Still happens on fresh install using kernel 4.17.14-1.el7.elrepo.x86_64. Applying custom policy again sorts it.

  17. TiredPixel commented on Aug 12, 2018

    @TiredPixel
    Author

    The upgrade to kernel 4.x was needed because stock 3.10.0-862.9.1.el7.x86_64 doesn't work, similar to before.

  18. stale commented on Jul 16, 2019

    @stale

    Beep boop! This issue has been idle for long enough that it's time to check
    in and see if it's still important.

    If it is, what is blocking it? Would anyone be interested in submitting a
    PR
    or
    continuing the discussion to help move things forward?

    If no activity is observed within the next week, this issue will be
    exterminated closed, in accordance with our stale issue
    process
    .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions