Trying to use packer for kickstart and getting ssh_exchange_identification errirs

86 views
Skip to first unread message

rory toma

unread,
Jan 28, 2019, 8:37:21 PM1/28/19
to Packer
I have set the following in the packer json file:

{
  "builders":
  [
    {
      "type": "qemu",
      "iso_checksum": "d23eab94eaa22e3bd34ac13caf923801",
      "iso_checksum_type": "md5",
      "output_directory": "output_centos_tdhtest",
      "shutdown_command": "shutdown -P now",
      "disk_size": 50000,
      "format": "qcow2",
      "accelerator": "kvm",
      "headless": true,
      "qemuargs": [
          [ "-m", "8192M" ],
          [ "-smp", "cpus=1,maxcpus=2,cores=2" ]
      ],
      "http_directory": "http",
      "ssh_username": "root",
      "ssh_password": "password",
      "ssh_timeout": "2m",
      "vm_name": "centos-test",
      "output_directory": "centos7",
      "net_device": "virtio-net",
      "disk_interface": "virtio",
      "boot_wait": "10s",
      "boot_command": [
        "<tab> text ks=http://netinstall:80/kickstart/ks/new-configs/packer-CL7.6-X.cfg init.sshd<enter><wait>"
      ]
    }
  ]
}





In my centos kickstart file, I have:

lang en_US.UTF-8
keyboard us
cmdline
reboot --eject
firewall --disabled
services --enabled=NetworkManager,sshd
network --bootproto=dhcp --device=eth0 --onboot=on --hostname=test-packer
sshpw --username=root installme --plaintext


It sets it up to run on a non-default port on 127.0.0.1, however, when I try to ssh to it:

[root@menzoberranzan ~]# ssh -vvv -o PreferredAuthentications=password -o PubkeyAuthentication=no -l root 127.0.0.1 -p 3037
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug2: resolving "127.0.0.1" port 3037
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 3037.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
ssh_exchange_identification: Connection closed by remote host

Not sure what I'm missing here. I tried to set communicator to "none", but apparently, that doesn't really work.





Rickard von Essen

unread,
Jan 29, 2019, 8:48:15 AM1/29/19
to packe...@googlegroups.com
You can't ssh as root by default on CentOS. Check 

--
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/73b10fb2-3c57-4f88-b53c-4b802b187975%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rory toma

unread,
Jan 29, 2019, 2:53:07 PM1/29/19
to Packer
Actually, after more debugging, it appears that it is ignoring my kickstart file and going into straight install mode.

rory toma

unread,
Jan 29, 2019, 3:15:44 PM1/29/19
to Packer
So it seems to be completely ignoring my boot_command to tell it to install from a kickstart file.

Rickard von Essen

unread,
Jan 29, 2019, 4:01:16 PM1/29/19
to packe...@googlegroups.com
What happens when it types the boot command? 

On Tue, Jan 29, 2019, 21:15 rory toma <rory...@gmail.com wrote:
So it seems to be completely ignoring my boot_command to tell it to install from a kickstart file.

--
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.

rory toma

unread,
Jan 29, 2019, 4:10:24 PM1/29/19
to Packer
Nothing, it just sits on cdrom installer. I've worked around this for now by modifying isolinux.cfg and re-generating the iso. I have dracut issues now, but I can fix that.

Rickard von Essen

unread,
Jan 29, 2019, 4:23:44 PM1/29/19
to packe...@googlegroups.com
Could you rerun the previous setup (with boot_command) with env var PACKER_LOG=1 and post the log here. There seems to be something wrong. 

Rory Toma

unread,
Jan 29, 2019, 4:38:47 PM1/29/19
to packe...@googlegroups.com


Rickard von Essen wrote on 1/29/19 1:23 PM:
packer.log

Rickard von Essen

unread,
Jan 29, 2019, 4:48:19 PM1/29/19
to packe...@googlegroups.com
Don't run headless if you are trouble shooting. Your boot command is typed. The VM might not show the depending on when they happen. Your ssh_timeout is way to short for installing a fresh from ISO, set it to something like 30m to be safe.

Your boot commad reference the host netinst which is probably not what you want. It should be a template with HTTPIP and such, see the docs. 

Rory Toma

unread,
Jan 29, 2019, 4:50:19 PM1/29/19
to packe...@googlegroups.com, Rickard von Essen
If I set headless to "true" packer exits with SDL errors.
I looked at docs... how to HTTPIP and such get set?

Rickard von Essen wrote on 1/29/19 1:48 PM:

Rickard von Essen

unread,
Jan 30, 2019, 12:46:42 AM1/30/19
to Rory Toma, packe...@googlegroups.com
If you get SDL errors when running with head you should fix your qemu installation (assuming this is a desktop running X windows etc).


Reply all
Reply to author
Forward
0 new messages