Skip to content

Strange buildkit error on yarn test #1659

Closed

Description

@shykes

Problem

When running the standard integration tests for universe.dagger.io/yarn, on main, the test fails with a cryptic buildkit/docker error. As far as I know, this test is not failing in CI. There is no recent change to this package that seems relevant.

Steps to reproduce

1. Check current commit:

$ git show
commit 1135398beec4965f095ca70917908a06d804ff22 (HEAD -> main, origin/main, origin/HEAD)
Merge: 47a8bbc3 f6cee7f3
Author: Solomon Hykes <[email protected]>
Date:   Wed Feb 23 14:05:13 2022 -0800

    Merge pull request #1644 from shykes/go-fix
    
    go.#Build: small improvements

2. Run yarn test

$ dagger up ./pkg/universe.dagger.io/yarn/test
...

3. Observe cryptic error

...
$ dagger up
[✔] inputs.directories.testdata                                                                                                                   0.0s
[✔] actions.tests.customImage.buildImage                                                                                                          0.8s
[✔] actions.tests.customImage.build                                                                                                               0.6s
[✔] actions.tests.customName.build.container.script                                                                                               0.0s
[✔] inputs.directories.testdata2                                                                                                                  0.0s
[✔] actions.tests.simple.build                                                                                                                    0.7s
[✔] actions.tests.customName.build                                                                                                                0.8s
[✔] actions.tests.customImage.build.container.script                                                                                              0.0s
[✔] actions.tests.simple.build.container.script                                                                                                   0.0s
[✗] actions.tests.simple.build.container                                                                                                          0.1s
[✗] actions.tests.customImage.build.container                                                                                                     0.1s
[✗] actions.tests.customName.build.container                                                                                                      0.0s
7:27AM FTL failed to up environment: task failed: actions.tests.simple.build.container._exec:
process "bash --norc -e -o pipefail /bash/scripts/run.sh" did not complete successfully: unable to find user root: invalid argument

Speculation on root cause

Activity

  1. added
    kind/bug
    on Feb 25, 2022
  2. added this to the milestone on Feb 25, 2022
  3. modified the milestones: , v0.2.0-beta.1 on Mar 7, 2022
  4. shykes commented on Mar 7, 2022

    @shykes
    ContributorAuthor

    I believe this has been solved in the latest version of buildkit. It was related to the buildkit 0.10.0-rc1 and/or 0.10.0-rc2, and migration of cache layers. Clearing the cache solves the problem.

    cc @crazy-max who shared this information.

    @grouville can you double-check that this is correct, and close if so?

    Thanks!

  5. grouville commented on Mar 9, 2022

    @grouville
    Member

    cache

    It is correct. Clearing the cache did solve the issue. Reproducing from a fresh install (latest), the issue is not appearing.

  6. jpluscplusm commented on Apr 12, 2022

    @jpluscplusm
    Contributor

    I believe I have a currently-valid minimal repro for this:

    $ uname -a
    Linux ip-172-31-14-96 5.13.0-1017-aws #19-Ubuntu SMP Mon Mar 7 09:03:05 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 21.10
    Release:        21.10
    Codename:       impish
    $ ~/bin/dagger version
    dagger 0.2.5 (7d2f279c) linux/amd64
    $ cat dagger.cue 
    package asdf
    
    import (
            "dagger.io/dagger"
            "universe.dagger.io/docker"
    )
    dagger.#Plan
    
    actions: {
            some_dockerhub_container: docker.#Pull & {
                    source: "hello-world:latest"
            }
            hello: docker.#Run & {
                    input: some_dockerhub_container.image
            }
    }
    
    client: {
    }
    $ dagger do hello --log-format plain
    6:23PM INF actions.some_dockerhub_container._op | computing
    6:23PM INF actions.some_dockerhub_container._op | completed    duration=1.5s
    6:23PM INF actions.hello._exec | computing
    6:23PM ERR actions.hello._exec | failed: process "/hello" did not complete successfully: unable to find user root: invalid argument
        duration=200ms
    6:23PM FTL system | failed to execute plan: task failed: actions.hello._exec: process "/hello" did not complete successfully: unable to find user root: invalid argument
    

    On the buildkitd side of the fence:

    • same machine
    • unix socket communication between dagger and buildkit
    • using the version of buildkit-runc that's bundled with the v0.10.1 buildkit binary tarball
    $ ~/bin/buildkitd --version
    buildkitd github.com/moby/buildkit v0.10.1 5bc9c7b15891eecab8d1e0c34ed62a0177c45ae7
    $ ~/bin/buildkit-runc --version
    runc version unknown
    spec: 1.0.2-dev
    go: go1.17.8
    libseccomp: 2.5.2
    $ sudo rm -rf /var/lib/buildkit/
    $ sudo ${HOME}/bin/buildkitd --group $(id -g) --oci-worker true --oci-worker-binary ${HOME}/bin/buildkit-runc --debug
    INFO[2022-04-12T18:20:26Z] auto snapshotter: using overlayfs                                                                                                 
    WARN[2022-04-12T18:20:26Z] using host network as the default                                                                                                 
    INFO[2022-04-12T18:20:26Z] found worker "45oe31l6yiytk06mmzynzd32q", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.
    hostname:ip-172-31-14-96 org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worke
    r.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/386]                                                                    
    WARN[2022-04-12T18:20:26Z] skipping containerd worker, as "/run/containerd/containerd.sock" does not exist                                                   
    INFO[2022-04-12T18:20:26Z] found 1 workers, default="45oe31l6yiytk06mmzynzd32q"                                                                              
    WARN[2022-04-12T18:20:26Z] currently, only the default worker can be used.                                                                                   
    INFO[2022-04-12T18:20:26Z] running server on /run/buildkit/buildkitd.sock                                                                                    
    DEBU[2022-04-12T18:21:19Z] session started                                                                                                                   
    DEBU[2022-04-12T18:21:19Z] resolving                                     host=registry-1.docker.io                                                           
    [ ... snip lots of registry traffic ... ]
    DEBU[2022-04-12T18:21:20Z] diff applied                                  d="729.794µs" digest="sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54" media=application/vnd.docker.image.rootfs.diff.tar.gzip size=2479
    INFO[2022-04-12T18:21:20Z] detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf 
    ERRO[2022-04-12T18:21:20Z] /moby.buildkit.v1.frontend.LLBBridge/Solve returned error: rpc error: code = Unknown desc = process "/hello" did not complete successfully: unable to find user root: invalid argument 
    ERRO[2022-04-12T18:21:20Z] /moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = task failed: actions.hello._exec: process "/hello" did not complete successfully: unable to find user root: invalid argument
    
  7. jpluscplusm commented on Apr 12, 2022

    @jpluscplusm
    Contributor

    @shykes Ping for visibility ^^. Let me know if I should open a separate issue, or if you feel it's worth you re-opening this one.

  8. jpluscplusm commented on Apr 12, 2022

    @jpluscplusm
    Contributor

    I believe this has something to do with the sparse / not-a-shell-able nature of the image.

    I resurrected an example of this that I hit previously, whilst exploring dagger, but ignored because I assumed I was driving Dagger's Docker abstraction incorrectly. I don't /think/ I was, as this output shows (same machine as the example in #1659 (comment); cache cleared before each test).

    Here, I drive the 2 different flavours of the "shellcheck" image, and the one that contains /only/ /bin/shellcheck in the image fails with the same error as described in this issue. It's defined here, if it helps: https://github.com/koalaman/shellcheck/blob/master/Dockerfile.multi-arch#L21

    $ cat dagger.cue
    package asdf
    
    import (
            "dagger.io/dagger"
            "universe.dagger.io/docker"
    )               
                    
    dagger.#Plan    
            
    actions: {
            _dockerhub: {
                    shellcheck: alpine: docker.#Pull & {source: "koalaman/shellcheck-alpine:v0.8.0"}
                    shellcheck: binary: docker.#Pull & {source: "koalaman/shellcheck:v0.8.0"}
            }                       
            shellcheck: {                   
                    for flavour in [ "alpine", "binary"] {
                            (flavour): docker.#Run & {
                                    always: true
                                    input:  _dockerhub.shellcheck[flavour].image
                                    entrypoint: []
                                    command: {
                                            name: "/bin/shellcheck"
                                            args: [ "--version"]
                                    }
                            }
                    }
            }
    }
    # cache cleared
    $ dagger --log-format plain do shellcheck alpine
    8:54PM INF actions._dockerhub.shellcheck.alpine._op | computing
    8:54PM INF actions._dockerhub.shellcheck.alpine._op | completed    duration=1.4s
    8:54PM INF actions.shellcheck.alpine._exec | computing
    8:54PM INF actions.shellcheck.alpine._exec | #3 0.079 ShellCheck - shell script analysis tool
    8:54PM INF actions.shellcheck.alpine._exec | #3 0.079 version: 0.8.0
    8:54PM INF actions.shellcheck.alpine._exec | #3 0.079 license: GNU General Public License, version 3
    8:54PM INF actions.shellcheck.alpine._exec | #3 0.079 website: https://www.shellcheck.net
    8:54PM INF actions.shellcheck.alpine._exec | completed    duration=600ms
    # cache cleared
    $ dagger --log-format plain do shellcheck binary
    8:53PM INF actions._dockerhub.shellcheck.binary._op | computing
    8:53PM INF actions._dockerhub.shellcheck.binary._op | completed    duration=1.5s
    8:53PM INF actions.shellcheck.binary._exec | computing
    8:53PM ERR actions.shellcheck.binary._exec | failed: process "/bin/shellcheck --version" did not complete successfully: unable to find user root: invalid argument
        duration=400ms
    8:53PM FTL system | failed to execute plan: task failed: actions.shellcheck.binary._exec: process "/bin/shellcheck --version" did not complete successfully: unable to find user root: invalid argument
    

    Buildkit logs:

    ERRO[2022-04-12T20:54:57Z] /moby.buildkit.v1.frontend.LLBBridge/Solve returned error: rpc error: code = Unknown desc = process "/bin/shellcheck --version" did not complete successfully: unable to find user root: invalid argument 
    ERRO[2022-04-12T20:54:57Z] /moby.buildkit.v1.Control/Solve returned error: rpc error: code = Unknown desc = task failed: actions.shellcheck.binary._exec: process "/bin/shellcheck --version" did not complete successfully: unable to find user root: invalid argument
    
  9. reopened this on Apr 12, 2022
  10. shykes commented on Apr 12, 2022

    @shykes
    ContributorAuthor

    Thanks @jpluscplusm ! @grouville can you either look into it, or if you're too busy with other things, either find someone else to assign, or unassign so that we know it needs attention?

  11. removed their assignment
    on Apr 15, 2022
  12. sipsma commented on May 31, 2022

    @sipsma
    Contributor

    Another user in discord reported the same behavior here when using an image that did not have /etc/passwd. Sent out a fix here: #2542

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

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions