I am trying to get the VirtualBox plugin working with Jenkins. My plan is then to hook up the Selenium plugin as well and get a grid running on the VirtualBox cloud. When I follow the instructions on the plugin page to create the new node, that works fine. When I try to launch the slave agent, the VM does start up, but I continuously get the following error during SSH connection until it reaches the maximum number of attempts:

[VirtualBox] Launching node ubuntu-12.10-desktop-i386
[VirtualBox] Powering up VirtualBoxMachine{host=VirtualBoxHost{url='http://localhost:18083', username='*MY DOMAIN/USER NAME ON MY LOCAL MACHINE IS HERE*'},name='ubuntu-12.10-desktop-i386'}...
[VirtualBox] starting node ubuntu-12.10-desktop-i386 from state PoweredOff
[VirtualBox] node ubuntu-12.10-desktop-i386 started
[VirtualBox] Sleep before stage 2 launcher, attempt 1
[VirtualBox] Starting stage 2 launcher (SSHLauncher)
[01/04/13 14:13:26] [SSH] Opening SSH connection to
java.io.IOException: There was a problem while connecting to
    at com.trilead.ssh2.Connection.connect(Connection.java:793)
    at com.trilead.ssh2.Connection.connect(Connection.java:565)
    at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:693)
    at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:278)
    at hudson.plugins.virtualbox.VirtualBoxComputerLauncher.delegateLaunch(VirtualBoxComputerLauncher.java:80)
    at hudson.plugins.virtualbox.VirtualBoxComputerLauncher.launch(VirtualBoxComputerLauncher.java:64)
    at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:199)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at com.trilead.ssh2.transport.TransportManager.establishConnection(TransportManager.java:346)
    at com.trilead.ssh2.transport.TransportManager.initialize(TransportManager.java:454)
    at com.trilead.ssh2.Connection.connect(Connection.java:733)
    ... 11 more
[01/04/13 14:13:28] [SSH] Connection closed.
[VirtualBox] Stage 2 launcher completed
[VirtualBox] Sleep before stage 2 launcher, attempt 2

This is my configuration:

VirtualBox Cloud Config

VirtualBox Node Config (updated)

Why is this not working?

UPDATE: The slave VM is running Ubuntu and openssh-server is in fact running once I log in on that VM. I have made a couple of more updates since posting here, some based on an answer to Stack Overflow question How to SSH to a VirtualBox Ubuntu guest externally through a Windows host?. A few questions that might help solve this:

  • When Jenkins boots up the slave VM, does Ubuntu need to be configured so that it automatically logs into the desired user's account?
  • If not, how do I tell Jenkins to log in as a specific user?
  • Does it matter if it logs into the Guest account or one with more privileges?
  • What should my network configuration settings look like? This is what I have currently:

VirtualBox Ubuntu VM Adapter 1

VirtualBox Ubuntu VM Adapter 1 Port Forwarding Rules

VirtualBox Ubuntu VM Adapter 1

VirtualBox Host-Only Ethernet Adapter #2

VirtualBox Ubuntu VM openssh-server information

  • 2
    sfarbota, welcome to SQA. I think this is close enough to testing. It would be interesting to know if the SSH daemon is running inside the VirtualBox instance.
    – user246
    Commented Dec 20, 2012 at 22:17
  • Sorry for the delay - I'm blaming the holidays! Please see update for further information.
    – sfarbota
    Commented Jan 4, 2013 at 19:12
  • Also, I just updated the error because during the course of my changes it's gone from "Connection refused" to "Connection timed out". Any help here would be GREATLY appreciated!!
    – sfarbota
    Commented Jan 4, 2013 at 20:21
  • Thanks :) You just saved my days So I have Jenkins under Windows and have a VM linux mint slave. But I had to set in the the VM linux slave as: Host: Port 3022 Under Linux I had to: sudo apt-get install openssh-server
    – user6984
    Commented Feb 13, 2014 at 11:22

2 Answers 2


Figured it out. The host IP in the VM configuration window in Jenkins has to be the IPv4 address of the host-only adapter (in this case, I also changed the host port in the port forwarding rule from 3022 to 22.

For historical reference, the username and password fields (which appear when the "Advanced" button under the "Host" field in the the Jenkins VM configuration window is clicked) need to be set the the username and password on your VM. I'm not sure if you need to configure Ubuntu to log in that user automatically when the machine boots up (so that the SSH daemon can start) but I did.

  1. Configure the VirtualBox server, that allows to remotely manage VMs, and start it.

    VBoxManage setproperty websrvauthlibrary null 

(from https://wiki.jenkins-ci.org/display/JENKINS/VirtualBox+Plugin)

  • Thanks for the answer but that's not actually where I'm getting caught up. I have tested the connection to my VirtualBox cloud and that works fine. I can even make Jenkins start up the correct VM, but then it can't seem to do anything with it, apparently because SSH is not working properly.
    – sfarbota
    Commented Jan 7, 2013 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.