Error getting SSH address

258 views
Skip to first unread message

Aaron Kulbe

unread,
Apr 13, 2018, 10:41:43 PM4/13/18
to Packer
The management won't let us run packer builds on vSphere yet. So we're stuck standing up a VM with nested virt enabled on it.

When I attempt to do a build, I get this in the log:

2018/04/14 01:01:03 packer: 2018/04/14 01:01:03 [DEBUG] Error getting SSH address: IP lookup failed: None of the found device(s) [vmnet8] has a DHCP lease for MAC 00:0c:29:81:91:5d
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 Located networkmapper configuration file using Workstation: /etc/vmware/netmap.conf
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 GuestIP discovered device matching nat: vmnet8
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 Lookup up IP information...
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 GuestAddress found MAC address in VMX: 00:0c:29:81:91:5d
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 Trying DHCP leases path: /etc/vmware/vmnet8/dhcpd/dhcpd.leases
2018/04/14 01:01:08 packer: 2018/04/14 01:01:08 IP lookup failed: None of the found device(s) [vmnet8] has a DHCP lease for MAC 00:0c:29:81:91:5d

(it repeats continuously)

Here is my template:

➜  build_here cat rhel72.json
{
  "builders": [
    {
      "type": "vmware-iso",
      "boot_command": [
        "<up><tab> text biosdevname=0 net.ifnames=0 ks=hd:fd0/baseimage_130_72.cfg<enter><wait>"
      ],
      "boot_wait": "15s",
      "disk_size": "20480",
      "guest_os_type": "rhel7-64",
      "headless": true,
      "iso_urls": [
        "rhel-server-7.2-x86_64-dvd.iso"
      ],
      "floppy_files": [ "http/baseimage_130_72.cfg" ],
      "iso_checksum_type": "sha256",
      "iso_checksum": "03f3a0291634335f6995534d829bd21ffaa0d000004dfeb1b2fb81052d64a4d5",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_port": 22,
      "ssh_wait_timeout": "20000s",
      "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
      "tools_upload_flavor": "linux",
      "vm_name": "packer-rhel-72-x86_64",
      "vnc_port_min": "5902",
      "vnc_port_max": "5902",
      "vnc_disable_password": true,
      "network": "nat",
      "vmx_data": {
        "cpuid.coresPerSocket": "1",
        "memsize": "1024",
        "numvcpus": "1"
      }
    }
  ],
  "post-processors": [
    {
      "output": "builds/{{.Provider}}-rhel72.box",
      "type": "vagrant",
      "keep_input_artifact": true
    },
    {
      "type": "ovftool",
      "only": [
        "vmware-iso"
      ],
      "format": "ova"
    }
  ]
}

Rickard von Essen

unread,
Apr 14, 2018, 7:06:49 AM4/14/18
to packe...@googlegroups.com
(Change management)... There have been some fixes around this is 1.2.1 and 1.2.2 be sure to test it with 1.2.2. 

If that doesn't solve it provide your KS file so we can comment on it.

--
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/75afbb96-e1cb-4879-962f-6d2b30c32f30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron Kulbe

unread,
Apr 14, 2018, 11:44:23 AM4/14/18
to Packer
I have been using 1.2.2, but I also checked out the latest 1.2.3-dev code, and still get the same issue. 

Here's my sanitized KS file.



#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'

# Root password
rootpw "$1$<my password hash>" --iscrypted

# System Services
services --enabled="chronyd"
services --enabled="sshd"

# Create default user
user --name=myuser --groups=myuser,wheel
user --name=vagrant --groups=vagrant,wheel --password=vagrant

# System timezone
timezone UTC --utc
# System language
lang en_US.UTF-8
# Firewall configuration
firewall --disabled
# System authorization information
auth --enableshadow --enablemd5

# Use CDROM installation media
cdrom

# Use text mode install
text

# SELinux configuration
selinux --permissive

# Do not configure the X Window System
skipx

# Network information
network --bootproto=dhcp --device=eth0
network --hostname=localhost.localdomain

# Reboot after installation
reboot

# System bootloader configuration
bootloader --location=mbr

# Disk partitioning information
zerombr
clearpart --all --drives=sda
part /boot --fstype ext4 --size=500
part pv.00 --size=16000 --ondisk=sda
volgroup vg00 pv.00
logvol / --vgname=vg00 --fstype=xfs --size=12288 --name=lv_root
#logvol /home --vgname=vg00 --fstype=xfs --size=2048 --name=lv_home
#logvol /var/log --vgname=vg00 --fstype=xfs --size=2048 --name=lv_varlog

%packages
# Minimal RHEL install
@core
# Further minimize unneeded packages
-alsa-lib
-mariadb-libs
-parted
-aic94xx-firmware
-iwl*
-plymouth
-firewalld
# Add packages we actually need
chrony
tmux
libyaml
ncurses-libs
setools-libs
open-vm-tools
vim-enhanced
yum-utils
net-tools
wget
bzip2
unzip
mtr
nmap-ncat
strace
tcpdump
selinux-policy-devel
libselinux-utils
sssd
realmd
policycoreutils-python
samba-common-tools
krb5-workstation
setools-console
make
openssh-clients
openssh-server
%end

%post --log=/root/ks-post.log
# Register with Red Hat
/usr/sbin/subscription-manager register --org=<my org number> --activationkey=<my activationkey>
# Unpinning for now.
/usr/sbin/subscription-manager release --set=7.2

# add extra repos
/usr/sbin/subscription-manager repos --enable rhel-7-server-optional-rpms
/usr/sbin/subscription-manager repos --enable rhel-7-server-rh-common-rpms

# add EPEL and packages on EPEL
rpm -ivh epel-release-latest-7.noarch.rpm
yum check-update
yum -y install facter katello-agent mailx yum-utils
yum -y erase mariadb-libs postfix ivtv-firmware emacs-filesystem fxload

# set time
ln -s /usr/share/zoneinfo/UTC /etc/localtime

# Set up regular users & keys
mkdir -p /home/myuser/.ssh/
chmod 700 /home/myuser/.ssh
curl -k http://<my web server>/myco_CD_rsa.pub -o /home/myuser/.ssh/authorized_keys
curl -k http://<my web server>/myco_CD_DEV_rsa.pub >> /home/myuser/.ssh/authorized_keys
chown -R myuser:myuser /home/myuser/.ssh/
chmod 600 /home/myuser/.ssh/authorized_keys
echo "myuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/myuser
echo "Defaults:myuser !requiretty" >> /etc/sudoers.d/myuser
chown root:root /etc/sudoers.d/myuser
chmod 440 /etc/sudoers.d/myuser

mkdir -p /home/vagrant/.ssh/
chmod 700 /home/vagrant/.ssh
curl -k http://<my web server>/myco_CD_rsa.pub -o /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh/
chmod 600 /home/vagrant/.ssh/authorized_keys
echo "vagrant ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/vagrant
echo "Defaults:vagrant !requiretty" >> /etc/sudoers.d/vagrant
chown root:root /etc/sudoers.d/vagrant
chmod 440 /etc/sudoers.d/vagrant

# Set up Manifest generation
echo "export BASE_IMAGE_VERSION=1.3.0" > /etc/profile.d/baseimage.sh
chmod +x /etc/profile.d/baseimage.sh

curl -k http://<my web server>/generate_manifest.sh -o /home/myuser/generate_manifest.sh
chmod +x /home/myuser/generate_manifest.sh

# update everything
yum -y update

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

Nicholas Bayle

unread,
Apr 14, 2018, 2:58:34 PM4/14/18
to packe...@googlegroups.com
I had this issue.

The problem occurs when the host VM has permission to "monitor all traffic" on the parent host. The DHCP request ends up going outside the VMware host (despite whatever your nat/hostonly settings are) to the parent VMware installation or external DHCP server. You can verify this by looking at what subnet the VM is supposed to be on ( /etc/vmware/vmnet8/dhcpd/dhcpd.conf) and comparing it to the actual IP that the VM receives (VNC to the instance packer is building). If you go to your parent DHCP server and look at the leases, you will likely find your DHCP lease.

If you can figure out how to deny that traffic, it will get the correct DHCP server and the lease will end up in the correct file for packer.

It's all terribly confusing, so hopefully this makes sense.

Nick

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/da3012d7-8dfa-4827-8cda-176b8f215525%40googlegroups.com.

Aaron Kulbe

unread,
Apr 14, 2018, 3:13:16 PM4/14/18
to packe...@googlegroups.com

Does that apply if there is no external DHCP server? I’ll draw a text diagram, and hope it’ll render okay. Are you saying that the “builder VM” (as diagrammed below) is forwarding the DHCP request back upstream to the cluster, in hopes of getting an address there?

 

[target VM] (whose final destination will be the cluster on the bottom)

^

^

^

[builder VM where packer runs] (this VM has to have an IP statically configured, as all we have is vRA’s crappy IPAM, and no DHCP)

^

^

^

[vSphere cluster w/vRealize Automation (vRA)]


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 packer-tool...@googlegroups.com.

Rickard von Essen

unread,
Apr 14, 2018, 5:42:54 PM4/14/18
to packe...@googlegroups.com
This is usually quite easy to troubleshoot, use a playbook a something like this:

1) Disable headless, or use VNC
2) Run the build, connect to the console. Check any error messages.
3) After reboot login as root and check what's the status of the network is it up, does it have an IP. Do the normal troubleshooting for networking.
4) Check if you can ssh from the host to the guest: ssh -l vagrant <IP>.

Interesting things to check where did it receive it's DHCP lease from? If it did get one. What's the mac for the NIC etc.

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


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 packer-tool+unsubscribe@googlegroups.com.

--
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/AFF4642F-4FAB-49DA-8DA1-71027E49DEBF%40longviewbits.com.

Aaron Kulbe

unread,
Apr 16, 2018, 12:00:46 PM4/16/18
to packe...@googlegroups.com

Hi Rickard,

 

I’m not sure how this is supposed to be easy. I’m guessing I cannot attach screenshots to this group list post, but if it doesn’t work, you can see it at https://www.dropbox.com/s/w3o23riipmz3fpw/packer_issues.png?dl=0

 

The VM doesn’t getting a network, so I’m not sure how I can connect to it. On the left, is the packer run. On the right is tailing the debug log, and on top is the VNC connection to the host.


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 packer-tool...@googlegroups.com.

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


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 packer-tool...@googlegroups.com.

packer_issues.png

Rickard von Essen

unread,
Apr 16, 2018, 1:27:25 PM4/16/18
to packe...@googlegroups.com
You picture shows the problem. "Warning: can not boot. Starting emergency shell"

This is most likely a problem with your ks file. Try building a known good one such as https://github.com/chef/bento/blob/master/centos/centos-7.4-x86_64.json and compare what is different in their ks. If you don't find the cause but theirs is working, us it and evolve it in small steps to what you need.

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


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 packer-tool+unsubscribe@googlegroups.com.

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

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

--
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/CY4PR15MB19105E7414E3E8B36D4AC825CDB00%40CY4PR15MB1910.namprd15.prod.outlook.com.

Aaron Kulbe

unread,
Apr 16, 2018, 3:54:31 PM4/16/18
to packe...@googlegroups.com
I provided a copy of my kickstart file earlier in the thread. I can take the kickstart file and pass it to the OS install manually and everything works fine but when I attempt to do it with Packer nothing works.

I'm not saying that it is not a configuration issue. I just need help determining where I am getting this wrong.


From: packe...@googlegroups.com <packe...@googlegroups.com> on behalf of Rickard von Essen <rickard....@gmail.com>
Sent: Monday, April 16, 2018 10:27:02 AM

Gabo Kete

unread,
Apr 16, 2018, 5:10:38 PM4/16/18
to Packer
Hi Aaron

In order to rule out any possible issue with the DHCP server in VmWare or any lease issues, I'd suggest you build another VM where you install/configure another DHCP server or setup on an already running VM a  DHCP server.. Once this server is up you can check the logs to see if your DHCP server just built is leasing any kind of IP address

What does VMware server logs shows you in regards the dhcp lease time?


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 packer-tool...@googlegroups.com.

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


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 packer-tool...@googlegroups.com.

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

Rickard von Essen

unread,
Apr 17, 2018, 3:26:06 PM4/17/18
to packe...@googlegroups.com
Pulling my hair a bit on this before finding the error. The "boot_command" is missing a colon after fd0. A correct line is:

"<up><tab> text biosdevname=0 net.ifnames=0 ks=hd:fd0:/baseimage_130_74.cfg<enter><wait>"

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/120bfd6d-f818-4205-b5a6-f5c1433411ea%40googlegroups.com.

Aaron Kulbe

unread,
Apr 20, 2018, 8:30:19 PM4/20/18
to Packer
Thank you, Rickard. I'm not sure why, but this went to my Junk Mail folder. I ended up going back to the generic CentOS template I'd used at the beginning, and it worked. Then I used a diff util to compare it with my template, and I saw the missing colon. Once I put it in there, everything started working.

Thank you for your help, and my apologies for my obvious frustration coming through in the responses.
Reply all
Reply to author
Forward
0 new messages