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

Jenkins fails to create remote FS root if it doesn't exist, at least on EC2

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ec2-plugin
    • None

      On Jenkins 1.492, EC2 1.17, when I launch an instance that has a custom Remote FS root set in the EC2 plugin configuration for the AMI, the root isn't created.

      If I set the remote cache root to /var/cache/jenkins/ on an EC2-launched Debian instance, for example, I get the error:

      Verifying that java exists
      java full version "1.6.0_18-b18"
      Copying slave.jar
      Launching slave agent: java  -jar /tmp/slave.jar
      <===[JENKINS REMOTING CAPACITY]===>Slave.jar version: 2.18
      This is a Unix slave
      ERROR: Failed to copy /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.2.jar to /var/cache/jenkins/maven-agent.jar
      hudson.util.IOException2: Failed to copy /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.2.jar to /var/cache/jenkins/maven-agent.jar
      	at hudson.FilePath.copyTo(FilePath.java:1650)
      	at hudson.maven.MavenComputerListener.copyJar(MavenComputerListener.java:90)
      	at hudson.maven.MavenComputerListener.preOnline(MavenComputerListener.java:57)
      	at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:368)
      	at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:316)
      	at hudson.plugins.ec2.ssh.EC2UnixLauncher.launch(EC2UnixLauncher.java:134)
      	at hudson.plugins.ec2.EC2ComputerLauncher.launch(EC2ComputerLauncher.java:57)
      	at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:199)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	at java.lang.Thread.run(Thread.java:636)
      Caused by: java.io.FileNotFoundException: /var/cache/jenkins/maven-agent.jar (No such file or directory)
      	at java.io.FileOutputStream.open(Native Method)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:209)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:160)
      	at hudson.FilePath$28.call(FilePath.java:1558)
      	at hudson.FilePath$28.call(FilePath.java:1554)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:326)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	... 5 more
      ERROR: Connection terminated
      java.io.IOException: Unexpected termination of the channel
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50)
      Caused by: java.io.EOFException
      	at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2570)
      	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1314)
      	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
      	at hudson.remoting.Command.readFrom(Command.java:90)
      	at hudson.remoting.ClassicCommandTransport.read(ClassicCommandTransport.java:59)
      	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)
      

          [JENKINS-16027] Jenkins fails to create remote FS root if it doesn't exist, at least on EC2

          Craig Ringer added a comment - - edited

          If I:

          sudo mkdir /var/cache/jenkins
          sudo chown admin /var/cache/jenkins
          

          to create the working dir and grant ownership to the user the slave runs as, then re-launch the slave, it works.

          It looks like the EC2 plugin needs to create the working directory using the sudo command prefix and then set its ownership before proceeding.

          Craig Ringer added a comment - - edited If I: sudo mkdir / var /cache/jenkins sudo chown admin / var /cache/jenkins to create the working dir and grant ownership to the user the slave runs as, then re-launch the slave, it works. It looks like the EC2 plugin needs to create the working directory using the sudo command prefix and then set its ownership before proceeding.

          Francis Upton added a comment -

          Still needs to be fixed as of 1.30

          Francis Upton added a comment - Still needs to be fixed as of 1.30

            francisu Francis Upton
            ringerc Craig Ringer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: