Bug 1290782

Summary: Git clone fails in build with error "Clone failed: fatal: unable to look up current user in the passwd file: no such user Unexpected end of command stream"
Product: OpenShift Container Platform Reporter: Miheer Salunke <misalunk>
Component: BuildAssignee: Cesar Wong <cewong>
Status: CLOSED WORKSFORME QA Contact: Wenjing Zheng <wzheng>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.1.0CC: abdo.hegazy, aos-bugs, bparees, haowang, mgbarbero, misalunk, xiao_chen
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-30 03:26:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miheer Salunke 2015-12-11 12:59:11 UTC
Description of problem:

Build of application fails with following error:

[root@vlds387 ~]# oc build-logs nodejs-example-11
I1130 12:01:31.781560       1 sti.go:74] The value of ALLOWED_UIDS is [1-]
I1130 12:01:31.811173       1 docker.go:211] Image registry.access.redhat.com/openshift3/nodejs-010-rhel7:latest available locally
I1130 12:01:31.811248       1 sti.go:96] Creating a new S2I builder with build config: "Builder Name:\t\tNode.js 0.10\nBuilder Image:\t\tregistry.access.redhat.com/openshift3/nodejs-010-rhel7:latest\nSource:\t\t\thttp://vlds113.netpost/vdaelal/simple-nodejs-app.git\nOutput Image Tag:\t172.30.56.179:5000/node-samples/nodejs-example:latest\nEnvironment:\t\tOPENSHIFT_BUILD_NAME=nodejs-example-11,OPENSHIFT_BUILD_NAMESPACE=node-samples,OPENSHIFT_BUILD_SOURCE=http://vlds113.netpost/vdaelal/simple-nodejs-app.git\nIncremental Build:\tdisabled\nRemove Old Build:\tdisabled\nForce Pull:\t\tdisabled\nQuiet:\t\t\tdisabled\nLayered Build:\t\tdisabled\nDocker Endpoint:\tunix:///var/run/docker.sock\n"
I1130 12:01:31.820344       1 docker.go:211] Image registry.access.redhat.com/openshift3/nodejs-010-rhel7:latest available locally
I1130 12:01:31.837063       1 sti.go:124] Preparing to build 172.30.56.179:5000/node-samples/nodejs-example:latest
I1130 12:01:31.914398       1 clone.go:30] Cloning sources and all GIT submodules into "/tmp/sti007792710/upload/src"
E1130 12:01:36.549819       1 git.go:102] Clone failed: fatal: unable to look up current user in the passwd file: no such user
Unexpected end of command stream
I1130 12:01:36.549853       1 clone.go:35] Git clone failed: exit status 128
I1130 12:01:36.549875       1 cleanup.go:23] Removing temporary directory /tmp/sti007792710
I1130 12:01:36.549883       1 fs.go:99] Removing directory '/tmp/sti007792710'
F1130 12:01:36.550112       1 builder.go:54] Build error: exit status 128

Version-Release number of selected component (if applicable):
3.1

How reproducible:
Reproducible at customer end with his git repo  http://vlds113.netpost/vdaelal/simple-nodejs-app.git and github repo as well.

Steps to Reproduce:
1. Run the build with a git repo or a github url mentioned in the bc
2. 
3.

Actual results:
The git clone during build shall succeed.

Expected results:
Git clone during build fails searching for a user in /etc/passwd

Additional info:
The customer's bc looks as follows -

apiVersion: v1
items:
- apiVersion: v1
  kind: BuildConfig
  metadata:
    creationTimestamp: 2015-12-02T15:18:48Z
    labels:
      app: jeeapp
    name: jeeapp
    namespace: test
    resourceVersion: "311830"
    selfLink: /oapi/v1/namespaces/test/buildconfigs/jeeapp
    uid: fc98fed7-9907-11e5-8cbf-005056ad2e20
  spec:
    output:
      to:
        kind: ImageStreamTag
        name: jeeapp:latest
    resources: {}
    source:
      git:
        uri: http://vlds113.netpost/vdaelal/bindeploy.git
      type: Git
    strategy:
      dockerStrategy:
        env:
        - name: BUILD_LOGLEVEL
          value: "2"
        from:
          kind: DockerImage
          name: registry.access.redhat.com/jboss-eap-6/eap-openshift:6.4
      type: Docker
    triggers:
    - github:
        secret: htw8dRgdBQ_CmINb7oHK
      type: GitHub
    - generic:
        secret: qJfEKBsAkdumMQbsTxII
      type: Generic
    - type: ConfigChange
  status:
    lastVersion: 3
kind: List
metadata: {}

For some unexplained reason we managed to get the git clone working from build pods by using an alternative repsitory location served by the same on-premise gitlab repo server.

This of course neither explains why previously we ran into this failure even when building from a public hosted github repository

Comment 1 Ben Parees 2016-01-05 20:35:29 UTC
after talking to Cesar it sounds like we should update the sti-builder and docker-builder to include the nss wrapping logic.

Comment 2 Cesar Wong 2016-01-05 21:51:32 UTC
Please ignore the comment above. We realized that the builder is running as root and as such its user id should be in the passwd file.

Miheer, I would like to get more information on the comments above:

1) For some unexplained reason we managed to get the git clone working from build pods by using an alternative repsitory location served by the same on-premise gitlab repo server.

-- Is it simply a different URL? what URL? Was user/password specified in the URL?

2) This of course neither explains why previously we ran into this failure even when building from a public hosted github repository

-- Is it a specific public github repository? Which repository?


-- It seems that the URL that is currently failing for the customer had worked on a different occassion. Was that on a different server? What version? What did the build config look like?

Comment 3 Ben Parees 2016-01-11 17:51:37 UTC
lowering severity as this appears to be specific to the user's config, not something we're seeing pervasively.

We'll be happy to investigate further if we can get the info Cesar requested, though.

Comment 5 Mariano Barbero 2016-04-09 19:11:16 UTC
Hi guys ! I have the same issue in my openshift 3 installation. How did you manage to resolve this ? Any help will be very appreciated.

This error is raised only when any git repository is used in the new-app command. I tried not only with a github repo but also with a private gitlab repo with the same result, didn't work, same error.

I am not sure which user needs to be in the passwd file to successfully clone the repository.

I am running all as root.

Thanks a lot

Comment 6 Cesar Wong 2016-04-09 20:27:25 UTC
Hi Mariano,
You can avoid this message by setting values on these environment variables before calling git clone (or oc new-app):

GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL

The actual value you set doesn't matter.

Comment 7 Mariano Barbero 2016-04-09 22:15:18 UTC
Hi Cesar, thank you for your help.
Should I set them in the deployment configuration or where ?

Comment 8 Mariano Barbero 2016-04-09 22:24:23 UTC
Cesar, setting them in the deployment configuration resolved the issue !!
Thanks a lot, you saved my day
Mariano

Comment 9 Mariano Barbero 2016-04-09 22:57:30 UTC
(In reply to Mariano Barbero from comment #8)
> Cesar, setting them in the deployment configuration resolved the issue !!
> Thanks a lot, you saved my day
> Mariano

Sorry, I made a mistake, the issue is not solved setting the env vars in de DC.
Cesar, where should I set them ?
Regards

Comment 10 Mariano Barbero 2016-04-09 23:18:36 UTC
I tried setting the env vars in a few places (DC, RC, BC and as parameters in the new-app command) without any luck, same error in all of them.

Comment 11 Wang Haoran 2016-04-28 06:16:17 UTC
(In reply to Mariano Barbero from comment #10)
> I tried setting the env vars in a few places (DC, RC, BC and as parameters
> in the new-app command) without any luck, same error in all of them.

Would you please provide :
1. scc configuration using cluster-admin
   $oc get scc -o json
2. get the failed build pod json file
   $oc get pod nodejs-example-build-1 -o json

I met this before , it is because someone change the scc and make the build pod running with none privileged, wo will get clone error .

Comment 12 Cesar Wong 2016-09-30 03:26:00 UTC
Closing this due to age. Please reopen if still an issue.

Comment 13 Abdel Hegazi 2017-02-24 16:53:30 UTC
Hi,

Apparently I just configured openshift 3.4 cluster mainly to be used for jenkins ci/cd.

I followed the official documentation but I am still not able to pull any repo using git either through jenkins pipeline or through the container 

always end up with the same error 

`+refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: remote: Counting objects: 40, done.        
remote: Total 40 (delta 0), reused 0 (delta 0), pack-reused 40        
fatal: unable to look up current user in the passwd file: no such user
`

I set up these couple environmental variables but still no luck?

any more suggestions ?

Thanks,

Comment 14 Abdel Hegazi 2017-02-24 16:58:28 UTC
I guess the main source of the problem is the current user should be jenkins but this is what I get when executing command id?


$ id
uid=1000080000 gid=0(root) groups=0(root),1000080000


FYI, I was following this blog post 
https://blog.openshift.com/pipelines-with-jenkins-2-on-openshift/

Comment 15 Cesar Wong 2017-02-24 18:41:07 UTC
Abdel, the random uid is expected. 

Where are you setting the environment variables?

Comment 16 Jackie 2017-08-21 00:31:30 UTC
I have the exactly same issue in OpenShift dedicated. I think it could be caused by the default SCC settings. I have raised a ticket #01913847, and waiting for their reply.