virtualbox-ovf: Timeout waiting for SSH

94 views
Skip to first unread message

hansman

unread,
Oct 15, 2018, 3:32:13 PM10/15/18
to Packer
This issue appears on packer build: virtualbox-ovf: Timeout waiting for SSH

  • packer version 1.3.1

  • host platform: circleci machine running circleci/classic:latest

  • guest image: ubuntu server 18 64 packaged as .ova

  • debug log (includes instructions)
    packer-debug.txt

  • template.json

{
  "variables": {
    "SSH_PASSWORD": "{{env `UBUNTU_PASSWORD`}}"
  },
  "builders": [
    {
      "type": "virtualbox-ovf",
      "source_path": "file:///home/circleci/bin/ubuntu-server-18.ova",
      "ssh_username": "myuser",
      "ssh_password": "{{user `SSH_PASSWORD`}}",
      "ssh_timeout": "10m",
      "shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "script": "packer/setup.sh" // a hello world script
    }
  ]
}
packer-debug.txt

Rickard von Essen

unread,
Oct 15, 2018, 3:44:04 PM10/15/18
to packe...@googlegroups.com
Could you publish your ubuntu-server-18.ova somewhere so we can try reproduce it?

What steps did you do to troubleshoot the network/connectivity? Try running with --on-error=ask and the VM will keep running after the time out so you have time to troubleshoot. 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/179c35b4-c8da-4544-8fcc-d7c33949900b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

hansman

unread,
Oct 15, 2018, 4:59:50 PM10/15/18
to Packer
i reproduced the same issue on a mac host machine. therefore i don't think it as a circleci issue. here is the image:


and template:

{
  "builders": [
    {
      "type": "virtualbox-ovf",
      "ssh_username": "packer",
      "ssh_password": "packer",
      "ssh_timeout": "15m",
      "shutdown_command": "echo 'packer' | sudo -S shutdown -P now"
    }
  ]
}


Rickard von Essen

unread,
Oct 16, 2018, 4:39:13 AM10/16/18
to packe...@googlegroups.com
If you start that build, wait for the console, login with packer/packer and run "ifconfig" you will see there is only a loopback interface.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.

hansman

unread,
Oct 17, 2018, 4:37:11 PM10/17/18
to Packer
Thanks Rickard. I went ahead configuring the network on ubuntu boot with the script posted below. On a mac host with packer 1.3.1 this works well. However when running in a circleci pipeline, packer build hangs on ssh:

==> virtualbox-ovf: Waiting for SSH to become available...
==> virtualbox-ovf: Timeout waiting for SSH.

I guess there is no dhcp in circleci so tried installing a dhcp server but that did not solve the problem as well. 


```
#!/bin/bash

if [ -f /etc/network/interfaces ]; then
  mv /etc/network/interfaces /etc/network/interfaces.orig
fi

echo "# generated on startup"  >> /etc/network/interfaces
echo  >> /etc/network/interfaces

for networkfile in /sys/class/net/*; do
    [ -e "$networkfile" ] || continue
    [ "$networkfile" != "/sys/class/net/lo" ] || continue
    networkname=$(basename $networkfile)
    echo auto $networkname >> /etc/network/interfaces
    echo iface $networkname inet dhcp >> /etc/network/interfaces
    echo  >> /etc/network/interfaces
done

cat /etc/network/interfaces

ifreload -a
```

Rickard von Essen

unread,
Oct 18, 2018, 7:49:24 AM10/18/18
to packe...@googlegroups.com
VirtualBox box have it's own dhcp server so you don't need to install that. More likely circleci have some restrictions on networking that interfere with this. 

Reply all
Reply to author
Forward
0 new messages