centos7.4: ssh unable to authenticate, attempted methods [none], no supported methods remain

2,581 views
Skip to first unread message

wji...@quantcast.com

unread,
Jan 4, 2018, 4:33:39 PM1/4/18
to Packer
Has anyone experienced similar problems? Any ideas to further trouble-shoot?

The attached packer.json and ks.cfg work for centos7.3, but fails on centos7.4. I could ssh to the vm using root/vagrant in the Virtualbox UI before packer destroyed it, but packer failed to login via ssh using the same credentials.

Host: OS X El Capitan 10.11.6
Virtualbox: 5.1.30
Vagrant: 2.0.1
Packer: 1.1.3

==> virtualbox-iso: Waiting for SSH to become available...
==> virtualbox-iso: Error waiting for SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

==> Builds finished but no artifacts were created.

The full build.log with PACKER_LOG=1 to run is attached as build.log


build.log
packer.json
ks.cfg

Alvaro Miranda Aguilera

unread,
Jan 5, 2018, 7:55:15 AM1/5/18
to packe...@googlegroups.com
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

wji...@quantcast.com

unread,
Jan 5, 2018, 12:24:09 PM1/5/18
to Packer
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

Alvaro Miranda Aguilera

unread,
Jan 5, 2018, 1:18:14 PM1/5/18
to packe...@googlegroups.com
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

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


I don't think this is packer issue

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 packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/00e5954b-12ae-4e6c-891a-741cfcbca469%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Gabo Kete

unread,
Jan 5, 2018, 3:28:11 PM1/5/18
to Packer
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"

To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.



--
Alvaro

wji...@quantcast.com

unread,
Jan 5, 2018, 4:46:49 PM1/5/18
to Packer
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...

Rickard von Essen

unread,
Jan 5, 2018, 4:57:08 PM1/5/18
to packe...@googlegroups.com
Run packer build -on-error=ask template.json

And debug your network setup from the console. 

To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/47c30bd6-92a1-45e6-8c7b-76d97f7750ae%40googlegroups.com.

wji...@quantcast.com

unread,
Jan 5, 2018, 5:41:55 PM1/5/18
to Packer
Thank you! That helped: found the problem: PasswordAuthentication is set to be yes in /etc/ssh/sshd_config...

wji...@quantcast.com

unread,
Jan 5, 2018, 5:42:36 PM1/5/18
to Packer
I meant it was set to be no:-)

wji...@quantcast.com

unread,
Jan 6, 2018, 12:40:04 AM1/6/18
to Packer
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/

 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
Screen Shot 2018-01-05 at 9.36.04 PM.png
Reply all
Reply to author
Forward
0 new messages