Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-45712

p4 credentials fail, can't write .p4tickets file

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • p4-plugin
    • jenkins 2.60.1
      p4 plugin 1.7.1

       

      Jenkins is launched with JENKINS_HOME set to /home/jenkins, yet for some reason that I can't find, the p4 plugin is complaining about /var/lib/jenkins. 

      Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper connect
      SEVERE: P4: Unable to login: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.AccessDeniedException: /var/lib/jenkins
      Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper <init>
      INFO: P4: Unable to login: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.AccessDeniedException: /var/lib/jenkins
      Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper connectionRetry
      SEVERE: P4: Connection retry: 1
      Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper <init>
      INFO: P4: Connection retry: 1
      Jul 20, 2017 4:11:31 PM org.jenkinsci.plugins.p4.client.ConnectionHelper connectionRetry
      SEVERE: P4: Connection retry giving up...
      

      If I make /var/lib/jenkins a symlink to /home/jenkins, then the error changes to 

      SEVERE: P4: Unable to login: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.FileAlreadyExistsException: /var/lib/jenkins

      Jenkins is launched as :

      /usr/java/jdk1.8.0_141/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/home/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --debug=10 --handlerCountMax=100 --handlerCountMaxIdle=20

       

       

          [JENKINS-45712] p4 credentials fail, can't write .p4tickets file

          Matthew Hall created issue -
          Matthew Hall made changes -
          Description Original:  

          Jenkins is launched with JENKINS_HOME set to /home/jenkins, yet for some reason that I can't find, the p4 plugin is complaining about /var/lib/jenkins. 
          {noformat}
          Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper connect
          SEVERE: P4: Unable to login: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.AccessDeniedException: /var/lib/jenkins
          Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper <init>
          INFO: P4: Unable to login: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.AccessDeniedException: /var/lib/jenkins
          Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper connectionRetry
          SEVERE: P4: Connection retry: 1
          Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper <init>
          INFO: P4: Connection retry: 1
          Jul 20, 2017 4:11:31 PM org.jenkinsci.plugins.p4.client.ConnectionHelper connectionRetry
          SEVERE: P4: Connection retry giving up...
          {noformat}
          If I make /var/lib/jenkins a symlink to /home/jenkins, then the error changes to 
          {noformat}
          SEVERE: P4: Unable to login: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.FileAlreadyExistsException: /var/lib/jenkins{noformat}
           

           

           
          New:  

          Jenkins is launched with JENKINS_HOME set to /home/jenkins, yet for some reason that I can't find, the p4 plugin is complaining about /var/lib/jenkins. 
          {noformat}
          Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper connect
          SEVERE: P4: Unable to login: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.AccessDeniedException: /var/lib/jenkins
          Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper <init>
          INFO: P4: Unable to login: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.AccessDeniedException: /var/lib/jenkins
          Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper connectionRetry
          SEVERE: P4: Connection retry: 1
          Jul 20, 2017 4:11:28 PM org.jenkinsci.plugins.p4.client.ConnectionHelper <init>
          INFO: P4: Connection retry: 1
          Jul 20, 2017 4:11:31 PM org.jenkinsci.plugins.p4.client.ConnectionHelper connectionRetry
          SEVERE: P4: Connection retry giving up...
          {noformat}
          If I make /var/lib/jenkins a symlink to /home/jenkins, then the error changes to 
          {noformat}
          SEVERE: P4: Unable to login: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.FileAlreadyExistsException: /var/lib/jenkins{noformat}
          Jenkins is launched as :
          {noformat}
          /usr/java/jdk1.8.0_141/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/home/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --debug=10 --handlerCountMax=100 --handlerCountMaxIdle=20{noformat}
           

           

          Matthew Hall added a comment -

          So I moved the entire /home/jenkins to /var/lib/jenkins, and ran/started jenkins again. It worked fine. 

          It created the following file based on how new the timestamp was:

          -r--------    1 jenkins jenkins    60 Jul 20 16:30 .p4tickets

          Which makes me think that the p4 plugin, or the p4java api underneath refused to follow the symlink to write out the tickets file?

          If I move the .p4tickets file away, the error returns.

           

          Matthew Hall added a comment - So I moved the entire /home/jenkins to /var/lib/jenkins, and ran/started jenkins again. It worked fine.  It created the following file based on how new the timestamp was: -r--------    1 jenkins jenkins    60 Jul 20 16:30 .p4tickets Which makes me think that the p4 plugin, or the p4java api underneath refused to follow the symlink to write out the tickets file? If I move the .p4tickets file away, the error returns.  

          Matthew Hall added a comment - - edited

          I guess the .p4tickets file is trying to be written out to the $HOME of the jenkins user account (regardless of the JENKINS_HOME). 

          On my machine, $HOME is /var/lib/jenkins, which I just symlinked to /home/jenkins. I guess I can remedy this by making jenkins user $HOME a real directory, while maintaining the $JENKINS_HOME separate. (or editing the password file and changing the jenkins user homedir to match)

          Matthew Hall added a comment - - edited I guess the .p4tickets file is trying to be written out to the $HOME of the jenkins user account (regardless of the JENKINS_HOME).  On my machine, $HOME is /var/lib/jenkins, which I just symlinked to /home/jenkins. I guess I can remedy this by making jenkins user $HOME a real directory, while maintaining the $JENKINS_HOME separate. (or editing the password file and changing the jenkins user homedir to match)
          Matthew Hall made changes -
          Priority Original: Major [ 3 ] New: Minor [ 4 ]

          Matthew Hall added a comment - - edited

          So I'm not sure what to do with this bug. 

          It seems odd that given all the credential storing in Jenkins, that I stubbed my toe on the fact that I still need a .p4tickets file written out to disk.

          I'll let p4paul decide on next steps.

          EDIT: changed bug summary to match what i think issue is

          Matthew Hall added a comment - - edited So I'm not sure what to do with this bug.  It seems odd that given all the credential storing in Jenkins, that I stubbed my toe on the fact that I still need a .p4tickets file written out to disk. I'll let p4paul decide on next steps. EDIT: changed bug summary to match what i think issue is
          Matthew Hall made changes -
          Summary Original: p4 credentials fail, using wrong JENKINS_HOME New: p4 credentials fail, can't write .p4tickets file

          Paul Allen added a comment -

          P4Java requires a .p4ticket file and therefore the p4-plugin.  P4Java would typically use the OS user account's home directory, but perhaps if that is not defined Java will write it to where the JVM started up. 

          Jenkins recently change the JENKINS_HOME as my older 1.642.3 starts up with /var/lib/jenkins.  I can assure you that there are no fixed paths in the p4-plugin, so this is down to the environment.

          Paul Allen added a comment - P4Java requires a .p4ticket file and therefore the p4-plugin.  P4Java would typically use the OS user account's home directory, but perhaps if that is not defined Java will write it to where the JVM started up.  Jenkins recently change the JENKINS_HOME as my older 1.642.3 starts up with /var/lib/jenkins.  I can assure you that there are no fixed paths in the p4-plugin, so this is down to the environment.

          Paul Allen added a comment -

          What type of Credential are you using?

           - Perforce Password

           - Perforce Ticket with ticket value

           - Perforce Ticket with specified ticket file

          Paul Allen added a comment - What type of Credential are you using?  - Perforce Password  - Perforce Ticket with ticket value  - Perforce Ticket with specified ticket file

          Matthew Hall added a comment -

          Using Perforce user/password stored in Jenkins as a perforce credential. 

          This wouldn't have even been an issue if the P4Java had followed the $HOME dir symlink when writing out the .p4tickets file.

          Matthew Hall added a comment - Using Perforce user/password stored in Jenkins as a perforce credential.  This wouldn't have even been an issue if the P4Java had followed the $HOME dir symlink when writing out the .p4tickets file.

            Unassigned Unassigned
            mhall4 Matthew Hall
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: