You should increase the ssh_timeout, to rule that out also run with
-on-error=ask so you get infinite amount of time to troubleshot the
network. Also if you run Packer with env var PACKER_LOG=1 you will get a
lot of info on which port/ip packer tries to use. Verify if you can connect
over them.

PS. You shutdown command looks wrong, when you run with root "shutdown -P
now" should be enough.

On Fri, 24 Aug 2018 at 19:25, <[email protected]> wrote:

> I get the error like this
> ==> qemu: Waiting for SSH to become available...
>
>
>
>
> ==> qemu: Timeout waiting for SSH.
> ==> qemu: Deleting output directory...
> Build 'qemu' errored: Timeout waiting for SSH.
>
>
>
>
> On Friday, August 24, 2018 at 10:25:07 AM UTC-7, [email protected] wrote:
>>
>> Thanks. However, whether using iso or a pre-installed say raw image for
>> me packer never detects the vm has booted up. To be more specific, I have a
>> `raw` disk that had CentOS that boots up fine when I use `virsh` and I can
>> ssh into it with the username and password that I have configured. But when
>> I use the same credentials to do a build via packer, it cannot detect that
>> ssh connection is ready and times out. Here is my json file and the error
>> message
>>
>> {
>>   "builders":
>>   [
>>     {
>>       "type": "qemu",
>>       "disk_image":"true",
>>       "iso_url": "myimage.img",
>>       "iso_checksum": "951fc5be795d74acc1827fa000ca72dc",
>>       "iso_checksum_type": "md5",
>>       "output_directory": "/tmp/packerout1",
>>       "shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
>>       "disk_size": 9000,
>>       "format": "raw",
>>       "headless": false,
>>       "ssh_host_port_min": 2222,
>>       "ssh_host_port_max": 2229,
>>       "ssh_username": "root",
>>       "ssh_password": "check123",
>>       "ssh_port": 22,
>>       "ssh_timeout": "90s",
>>       "vm_name": "tdhtest"
>>     }
>>   ]
>> }
>>
>>
>>
>>
>>
>> On Friday, August 24, 2018 at 1:56:28 AM UTC-7, Rickard von Essen wrote:
>>>
>>> Use say QEMU with the option disk_image true 1) and boot a VM from the
>>> image, and a provisioner script that install whatever you need, docker
>>> engine, etc. When the build completes you will have a new disk image which
>>> includes docker engine.
>>>
>>> 1) https://www.packer.io/docs/builders/qemu.html#disk_image
>>>
>>> For the waiting for the "Waiting for SSH". What example do you follow?
>>>
>>> On Fri, 24 Aug 2018 at 10:16, <[email protected]> wrote:
>>>
>>>> Thanks but I should have asked the question more specifically. I did go
>>>> through the initial docs, but in the examples I found that there isn't a
>>>> case where only provision section can exist. From what I understand the
>>>> builders is a must as the doc also says. So what is the best way to achieve
>>>> this
>>>> 1. I have a raw image that has centos on it.
>>>> 2. I need to install say docker engine, and maybe few more apps.
>>>>
>>>> The examples that I have seen all seem to say start from ISO. Also,
>>>> when I start from ISO, my packer errors out saying waiting for SSH
>>>> connection
>>>>
>>>> On Friday, August 24, 2018 at 12:22:56 AM UTC-7, Rickard von Essen
>>>> wrote:
>>>>>
>>>>> Depending on which virtualisation software you run,
>>>>> qemu/VirtualBox/VMware, etc there are builders for starting from an
>>>>> existing image/disk, qemu, virtualbox-ovf, or vmware-vmx for example. You
>>>>> might need to convert the disk you download into the appropriate format
>>>>> before running packer on it depending on which builder you use.
>>>>>
>>>>> Packer will create a new copy of the image/disk, not alter the
>>>>> existing.
>>>>>
>>>>> Since building from an existing image can be a bit tricky I suggest
>>>>> that you get familiar with Packer by reading the getting started and then
>>>>> try out some of the builds from https://github.com/chef/bento, which
>>>>> all builds from an ISO.
>>>>>
>>>>> When you have gotten started, if you have any problems just send a
>>>>> email here. But try to provide all the files needed to run your template
>>>>> and example log output.
>>>>>
>>>>> On Fri, 24 Aug 2018 at 04:56, <[email protected]> wrote:
>>>>>
>>>>>> I downloaded a qcow2 centos from the internet and configured the
>>>>>> password using libguestfs. So far did not use packer to do these steps. 
>>>>>> For
>>>>>> my use case, I will always have an existing qcow2/raw/vmdk (one of the
>>>>>> three). I just want to install some packages inside these. Is it even
>>>>>> possible? Like if the VM disk already exists, packer can still inject 
>>>>>> stuff
>>>>>> inside it? I am following this `
>>>>>> https://www.packer.io/intro/getting-started/provision.html`
>>>>>> <https://www.packer.io/intro/getting-started/provision.html> but not
>>>>>> sure from the link if this is possible
>>>>>>
>>>>>> --
>>>>>> 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 [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/packer-tool/143ae367-2021-4dc5-9cfa-cc5f1c431e3a%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/packer-tool/143ae367-2021-4dc5-9cfa-cc5f1c431e3a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>> 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 [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/packer-tool/b324223a-bb0b-4688-9d53-50432b3b8442%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/packer-tool/b324223a-bb0b-4688-9d53-50432b3b8442%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/220d2501-c5d2-4a70-a8b5-3fe8f4663c15%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/220d2501-c5d2-4a70-a8b5-3fe8f4663c15%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt8JGVD_m6_7%2BsypTzU3FCJBP-vDUwQ7bzRwxgiq7r22yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to