OK, as attached: centos7.4 has a default? /etc/cloud/cloud.cfg which 
disables password authentication after reboot:
ssh_pwauth: 0

Here is how I fixed it in my setup:
wjiang@OE00364-ml:packer-centos7$ git diff
diff --git a/packer-centos7/cleanup.sh b/packer-centos7/cleanup.sh
index 0110c86..cdfbcf8 100755
--- a/packer-centos7/cleanup.sh
+++ b/packer-centos7/cleanup.sh
@@ -17,6 +17,9 @@ rm -rf /tmp/*
 # remove interface persistent
 rm -f /etc/udev/rules.d/70-persistent-net.rules

+# re-enable cloud-init
+rm -f /etc/cloud/cloud-init.disabled
+
 for ifcfg in $(ls /etc/sysconfig/network-scripts/ifcfg-*)
 do
     if [ "$(basename ${ifcfg})" != "ifcfg-lo" ]
diff --git a/packer-centos7/ks.cfg b/packer-centos7/ks.cfg
index 3b39dc8..fcf9e18 100644
--- a/packer-centos7/ks.cfg
+++ b/packer-centos7/ks.cfg
@@ -1,5 +1,5 @@
 install
-url --url https://mirror.centos.org/centos/7.3.1611/os/x86_64/
+url --url http://mirror.centos.org/centos/7.4.1708/os/x86_64/
 repo --name=salt_centos7 
--baseurl=http://repo.saltstack.com/yum/redhat/7/x86_64/latest
 repo --name=epel --baseurl=https://dl.fedoraproject.org/pub/epel/7/x86_64
 user --name=centos
@@ -70,5 +70,8 @@ yum update -y
 dkms install -m ixgbevf
 # sudo
 sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
+# cloud-init
+touch /etc/cloud/cloud-init.disabled
+# dhcp
 echo 'append domain-name " us-west-2.compute.internal";' > 
/etc/dhcp/dhclient.conf
 %end
diff --git a/packer-centos7/packer.yaml b/packer-centos7/packer.yaml
index 06aa292..5dd42af 100644
--- a/packer-centos7/packer.yaml
+++ b/packer-centos7/packer.yaml
@@ -5,9 +5,10 @@ builders:
   guest_os_type: RedHat_64
   headless: 'true'
   http_directory: .
-  iso_checksum: 
f2f7367deb90a25822947660c71638333ca0eceeabecc2d631be6cd508c24494
+  iso_checksum: 
fe3d960cce4d2c1c9f1b66817fe87cc0ee1a1c6c5dd126204cb5c33d51a45620
   iso_checksum_type: sha256
-  iso_url: 
https://mirrors.kernel.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1611.iso
+  iso_url: 
https://mirrors.kernel.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1708.iso
+  post_shutdown_delay: 2m
   shutdown_command: echo 'vagrant' | sudo -S /sbin/halt -h -p
   ssh_password: vagrant
   ssh_username: root
On Friday, January 5, 2018 at 2:42:36 PM UTC-8, [email protected] wrote:
>
> I meant it was set to be no:-)
>
> On Friday, January 5, 2018 at 2:41:55 PM UTC-8, [email protected] 
> wrote:
>>
>> Thank you! That helped: found the problem: PasswordAuthentication is set 
>> to be yes in /etc/ssh/sshd_config...
>>
>> On Friday, January 5, 2018 at 1:57:08 PM UTC-8, Rickard von Essen wrote:
>>>
>>> Run packer build -on-error=ask template.json
>>>
>>> And debug your network setup from the console. 
>>>
>>> On Jan 5, 2018 10:46 PM, <[email protected]> wrote:
>>>
>>>> That's a typo and has been fixed. Somehow, only one build passed the 
>>>> waiting for ssh stage and almost succeeded. But when I repeated the build, 
>>>> it started to fail again. I don't think it's a packer issue since the same 
>>>> configs worked with centos7.1/2/3 before. Most likely something is changed 
>>>> on centos7.4 and requires certain updates in my configs. Just don't know 
>>>> what they are... 
>>>>
>>>> On Friday, January 5, 2018 at 12:28:11 PM UTC-8, Gabo Kete wrote:
>>>>>
>>>>> Check your JSON file , you are not using root  as your username to ssh 
>>>>> the guest but vagrant user.. unless you have created the user vagrant 
>>>>> during your installation  ( which I couldn't see in your kickstart file  
>>>>> so 
>>>>> I doubt you did )
>>>>>
>>>>> I would recommend you change in your builder the 
>>>>>
>>>>> "ssh_username": "vagrant"
>>>>>
>>>>>
>>>>> with
>>>>>
>>>>>
>>>>> "ssh_username": "root"
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Saturday, January 6, 2018 at 7:18:14 AM UTC+13, Alvaro Miranda 
>>>>> Aguilera wrote:
>>>>>>
>>>>>> so my suggestion will be go back to the yum repo 7.3 and see if 
>>>>>> works, and replace to the corresponding link
>>>>>>
>>>>>> 7 without number doesn't have al lthe needed for installation
>>>>>>
>>>>>> on side note, https://mirror.centos.org/centos/7.3.1611/os/x86_64/ not 
>>>>>> working for me.
>>>>>>
>>>>>> so perhaps you can try a different mirror
>>>>>>
>>>>>> ie
>>>>>> http://mirror.centos.org/centos/7.4.1708/os/x86_64/
>>>>>>
>>>>>> the repo should match the dvd doing the installation
>>>>>>
>>>>>> If you want to make sure the installation is fully update, check the 
>>>>>> kickstart documentation, you need to add an aditional repo using repo
>>>>>>
>>>>>>
>>>>>> https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax
>>>>>>
>>>>>> I don't think this is packer issue
>>>>>>
>>>>>> Alvaro.
>>>>>>
>>>>>> On Fri, Jan 5, 2018 at 6:24 PM, <[email protected]> wrote:
>>>>>>
>>>>>>> OK, let me try that. I was using centos 7.3 and here is the diff:
>>>>>>>
>>>>>>> wjiang@OE00364-ml:packer-centos7$ git diff
>>>>>>> diff --git a/packer-centos7/ks.cfg b/packer-centos7/ks.cfg
>>>>>>> index 3b39dc8..fee451f 100644
>>>>>>> --- a/packer-centos7/ks.cfg
>>>>>>> +++ b/packer-centos7/ks.cfg
>>>>>>> @@ -1,5 +1,5 @@
>>>>>>>  install
>>>>>>> -url --url https://mirror.centos.org/centos/7.3.1611/os/x86_64/
>>>>>>> +url --url https://mirrors.kernel.org/centos/7/os/x86_64/
>>>>>>>  repo --name=salt_centos7 --baseurl=
>>>>>>> http://repo.saltstack.com/yum/redhat/7/x86_64/latest
>>>>>>>  repo --name=epel --baseurl=
>>>>>>> https://dl.fedoraproject.org/pub/epel/7/x86_64
>>>>>>>  user --name=centos
>>>>>>> diff --git a/packer-centos7/packer.yaml b/packer-centos7/packer.yaml
>>>>>>> index 06aa292..e9bab0e 100644
>>>>>>> --- a/packer-centos7/packer.yaml
>>>>>>> +++ b/packer-centos7/packer.yaml
>>>>>>> @@ -5,9 +5,9 @@ builders:
>>>>>>>    guest_os_type: RedHat_64
>>>>>>>    headless: 'true'
>>>>>>>    http_directory: .
>>>>>>> -  iso_checksum: 
>>>>>>> f2f7367deb90a25822947660c71638333ca0eceeabecc2d631be6cd508c24494
>>>>>>> +  iso_checksum: 
>>>>>>> fe3d960cce4d2c1c9f1b66817fe87cc0ee1a1c6c5dd126204cb5c33d51a45620
>>>>>>>    iso_checksum_type: sha256
>>>>>>> -  iso_url: 
>>>>>>> https://mirrors.kernel.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1611.iso
>>>>>>> +  iso_url: 
>>>>>>> https://mirrors.kernel.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1708.iso
>>>>>>>    shutdown_command: echo 'vagrant' | sudo -S /sbin/halt -h -p
>>>>>>>    ssh_password: vagrant
>>>>>>>    ssh_username: root
>>>>>>>
>>>>>>> On Friday, January 5, 2018 at 4:55:15 AM UTC-8, Alvaro Miranda 
>>>>>>> Aguilera wrote:
>>>>>>>>
>>>>>>>> hello
>>>>>>>>
>>>>>>>> you are using this iso:
>>>>>>>>
>>>>>>>> CentOS-7-x86_64-NetInstall-1708.iso
>>>>>>>>
>>>>>>>>
>>>>>>>> That goes to the latest 7, and the packages came from the yum repo 
>>>>>>>> latest, so there is no sense of centos 7.3 or 7.4
>>>>>>>>
>>>>>>>>
>>>>>>>> can you share what was before and what changed?
>>>>>>>>
>>>>>>>> when you go from net install will always use the latest packages, it 
>>>>>>>> may be good include a yum update kernel* and a reboot to ensure all is 
>>>>>>>> on the latest kernel as part of the provisioning but lost on the 7.3 / 
>>>>>>>> 7.4 part
>>>>>>>>
>>>>>>>> Alvaro
>>>>>>>>
>>>>>>>> -- 
>>>>>>> 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/00e5954b-12ae-4e6c-891a-741cfcbca469%40googlegroups.com
>>>>>>>  
>>>>>>> <https://groups.google.com/d/msgid/packer-tool/00e5954b-12ae-4e6c-891a-741cfcbca469%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> Alvaro
>>>>>>
>>>>>> -- 
>>>> 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/47c30bd6-92a1-45e6-8c7b-76d97f7750ae%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/packer-tool/47c30bd6-92a1-45e6-8c7b-76d97f7750ae%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/f81f9954-ffee-44fb-8904-2342fa7a3e5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to