SSH Timeout during Virtualbox image creation.

53 views
Skip to first unread message

Tekchand Dagar

unread,
Jan 14, 2019, 4:13:44 AM1/14/19
to Packer
Hello Team,

I am getting the below error during virtualbox image creation:

Error:

Build 'virtualbox-iso' errored: Timeout waiting for SSH.

Below is my .json file. 

{
  "builders": [
    {
      "type": "virtualbox-iso",
      "guest_os_type": "Ubuntu_64",
      "iso_checksum": "c94de1cc2e10160f325eb54638a5b5aa38f181d60ee33dae9578d96d932ee5f8",
      "iso_checksum_type": "sha256",
      "ssh_username": "ubuntu",
      "output_directory": "/tek",
      "vm_name": "packerimage",
      "disk_size": "10000",
      "headless": "true",
      "http_directory": "http",
      "boot_wait": "2m30s",
      "boot_command": [
                        "<enter><wait>",
                        "<f6><esc>",
                        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
                        "<bs><bs><bs>",
                        "/install/vmlinuz ",
                        "initrd=/install/initrd.gz ",
                        "net.ifnames=0 ",
                        "auto-install/enable=true ",
                        "debconf/priority=critical ",
                        "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg",
                        "<enter>"
                ],
                "ssh_timeout": "1m30s",
                "ssh_username": "ubuntu",
                "ssh_password": "ubuntu",
                "shutdown_command": "sudo systemctl poweroff",
                "shutdown_command": "sudo systemctl poweroff",
                "vboxmanage": [
                        ["modifyvm", "{{.Name}}", "--memory", 512],
                        ["modifyvm", "{{.Name}}", "--cpus", 1]
                ]
    }],
  "provisioners": [{
    "type": "shell",
    "script": "ansible.sh"
}
]}

Rickard von Essen

unread,
Jan 14, 2019, 4:26:57 AM1/14/19
to packe...@googlegroups.com
Please provide your preseed.cfg and also a screenshot of the VM console when SSH times out. Also your ssh_timeout seems way to short to install Ubuntu. Increase it to something like 15m. (And you have some duplicate keys in your config what can cause you trouble in the future).

--
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/0f31af57-6c7b-4056-8369-6fa597af052f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tekchand Dagar

unread,
Jan 14, 2019, 4:56:01 AM1/14/19
to Packer
Hello Rickard,
Thank you for your quick response.

I am also confused with preseed.cfg i have copied that .json template from internet and using. I need to specify the full URL for preseed.cfg or can i create preseed.cfg file at my packer machine and specify the file path in .json template?

Below is the link for preseed.cfg file but i didn't specify it anywhere in my .json template.

https://raw.githubusercontent.com/pavel-klimiankou/packer-example/master/http/preseed.cfg

How we can check the VM console because i don't have GUI mode for my packer machine. When i am trying to run the virualbox over my packer machine i am getting below error:

Selection_012.png


I have removed the duplicate keys from my .json file.

Please help me.

Rickard von Essen

unread,
Jan 14, 2019, 5:07:52 AM1/14/19
to packe...@googlegroups.com
Your preseed.cfg file should be in the http directory (specified by  "http_directory": "http"). And it will be availible to the VM on HTTP and loaded by the installer by this part of the boot_command:

preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg

There {{.HTTPIP}}:{{.HTTPPort}} will be replaced with the actual IP and port of a http-server that packer will start.

All of these things seems ok (if you putt the preseed.cfg in the http directory), but you need to be able to run (and start a VM manually) in VirtualBox without it core dumping.

Tekchand Dagar

unread,
Jan 14, 2019, 5:25:14 AM1/14/19
to Packer
Hello Rickard,

Thank you for your response.

I didn't get you, are you saying that we should have http server in our environment and we need to upload preseed.cfg file over that http server and then we need to use IP and port of that http server?

If this the the prerequisites according to current scenario then we don't have http server at our end.

Rickard von Essen

unread,
Jan 14, 2019, 6:03:48 AM1/14/19
to packe...@googlegroups.com
No, you should just have the following directory structure:

ansible.sh 
http/preseed.cfg 
template.json

Tekchand Dagar

unread,
Jan 15, 2019, 1:20:01 AM1/15/19
to Packer
Hello Rickard,

Thank you for your help. 

Now i am able to create the virtualbox image uisng packer. The only mistake which i was doing at my end was that i didn't have preseed.cfg file under http directory.

But now i have question, can packer export file as OVA format instead of OVF? 

Because OVF have 2 files and OVA have single bunch of file.

Really appreciated your help.

Thanks. 

Rickard von Essen

unread,
Jan 15, 2019, 2:51:51 AM1/15/19
to packe...@googlegroups.com

Tekchand Dagar

unread,
Jan 15, 2019, 4:10:45 AM1/15/19
to Packer
Thanks a lot. 
Reply all
Reply to author
Forward
0 new messages