Hi Rickard:
Please let me know if anymore info is required. Just to summarize the whole
thing again, I have a qemu disk image with the username and password that
is in my packer json file. I also created a toy provisioner script that
just should create a directory However, no matter how many things I try,
the packer never detects the VM has booted up. I use headless=false and can
easily see that VM has booted up. I can even login at the qemu windows, but
packer literally never detects it and just sticks there. And eventually
times out even with large timeouts. I want to use packer rather than
libguestfs, etc.

Can you please help on this?

On Sat, Aug 25, 2018 at 10:21 AM <[email protected]> wrote:

> Also here is the output of ifconfig -a form inside the vm(note there is no
> 192.x.x.x) ip for some reasons(attached as jpg). Also, I am using CentOS7.
> Does packer fail with it?
>
>
> On Saturday, August 25, 2018 at 9:55:08 AM UTC-7, [email protected] wrote:
>>
>> Thanks, if you look at my json file, I do have "username" and "password"
>> specified. When I see QEMU terminal, I can easily ssh into the terminal
>> manually via typing the credentials. However, even though my json has it,
>> the logs say that login is failing on authentication. Is there something
>> missing in the config or what. Just to note, this is not passwordless ssh
>> or pub-pvt key stuff. I have the creds in json.
>> Pasting the logs
>> 2018/08/25 09:46:53 packer: 2018/08/25 09:46:53 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:46:53 packer: 2018/08/25 09:46:53 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:46:53 packer: 2018/08/25 09:46:53 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:46:53 packer: 2018/08/25 09:46:53 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:46:53 packer: 2018/08/25 09:46:53 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:00 packer: 2018/08/25 09:47:00 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:47:00 packer: 2018/08/25 09:47:00 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:47:00 packer: 2018/08/25 09:47:00 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:47:00 packer: 2018/08/25 09:47:00 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:47:00 packer: 2018/08/25 09:47:00 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:07 packer: 2018/08/25 09:47:07 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:47:07 packer: 2018/08/25 09:47:07 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:47:07 packer: 2018/08/25 09:47:07 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:47:07 packer: 2018/08/25 09:47:07 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:47:07 packer: 2018/08/25 09:47:07 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:14 packer: 2018/08/25 09:47:14 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:47:14 packer: 2018/08/25 09:47:14 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:47:14 packer: 2018/08/25 09:47:14 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:47:14 packer: 2018/08/25 09:47:14 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:47:14 packer: 2018/08/25 09:47:14 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:21 packer: 2018/08/25 09:47:21 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:47:21 packer: 2018/08/25 09:47:21 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:47:21 packer: 2018/08/25 09:47:21 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:47:21 packer: 2018/08/25 09:47:21 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:47:21 packer: 2018/08/25 09:47:21 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:28 packer: 2018/08/25 09:47:28 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:47:28 packer: 2018/08/25 09:47:28 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:47:28 packer: 2018/08/25 09:47:28 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:47:28 packer: 2018/08/25 09:47:28 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:47:28 packer: 2018/08/25 09:47:28 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:35 packer: 2018/08/25 09:47:35 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:47:35 packer: 2018/08/25 09:47:35 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:47:35 packer: 2018/08/25 09:47:35 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:47:35 packer: 2018/08/25 09:47:35 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:47:35 packer: 2018/08/25 09:47:35 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:42 packer: 2018/08/25 09:47:42 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:47:42 packer: 2018/08/25 09:47:42 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:47:42 packer: 2018/08/25 09:47:42 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:47:42 packer: 2018/08/25 09:47:42 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:47:42 packer: 2018/08/25 09:47:42 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:49 packer: 2018/08/25 09:47:49 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:47:49 packer: 2018/08/25 09:47:49 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:47:49 packer: 2018/08/25 09:47:49 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:47:49 packer: 2018/08/25 09:47:49 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:47:49 packer: 2018/08/25 09:47:49 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:56 packer: 2018/08/25 09:47:56 [INFO] Attempting SSH
>> connection...
>> 2018/08/25 09:47:56 packer: 2018/08/25 09:47:56 [DEBUG] reconnecting to
>> TCP connection for SSH
>> 2018/08/25 09:47:56 packer: 2018/08/25 09:47:56 [DEBUG] handshaking with
>> SSH
>> 2018/08/25 09:47:56 packer: 2018/08/25 09:47:56 [DEBUG] SSH handshake
>> err: ssh: handshake failed: ssh: unable to authenticate, attempted methods
>> [none], no supported methods remain
>> 2018/08/25 09:47:56 packer: 2018/08/25 09:47:56 [DEBUG] Detected
>> authentication error. Increasing handshake attempts.
>> 2018/08/25 09:47:56 ui error: ==> qemu: Error waiting for SSH: ssh:
>> handshake failed: ssh: unable to authenticate, attempted methods [none], no
>> supported methods remain
>> ==> qemu: Error waiting for SSH: ssh: handshake failed: ssh: unable to
>> authenticate, attempted methods [none], no supported methods remain
>> 2018/08/25 09:47:56 ui error: ==> qemu: ssh: handshake failed: ssh:
>> unable to authenticate, attempted methods [none], no supported methods
>> remain
>> ==> qemu: ssh: handshake failed: ssh: unable to authenticate, attempted
>> methods [none], no supported methods remain
>> 2018/08/25 09:47:56 ui: ==> qemu: Step "StepConnect" failed
>> ==> qemu: Step "StepConnect" failed
>> 2018/08/25 09:47:56 ui: ask: ==> qemu: [c] Clean up and exit, [a] abort
>> without cleanup, or [r] retry step (build may fail even if retry succeeds)?
>> ==> qemu: [c] Clean up and exit, [a] abort without cleanup, or [r] retry
>> step (build may fail even if retry succeeds)?
>>
>>
>>
>>
>> On Saturday, August 25, 2018 at 7:04:47 AM UTC-7, Rickard von Essen wrote:
>>>
>>> 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/687b9332-bd30-4aa5-9af2-54cac39d2187%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/687b9332-bd30-4aa5-9af2-54cac39d2187%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/CAEkY76tOwir4ApcWNdL95NkY6Xg3SxJLUa%3D89wyL2g7ZB8DOOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to