Error getting network with vmware-iso+esx

394 views
Skip to first unread message

Shyam J

unread,
Feb 13, 2017, 1:50:13 AM2/13/17
to Packer
,

I am trying to create template in a ESX machine from a VMWare VM in another host. Below are versions.

Packer version - 0.12.2
Host platform - RHEL 6.7
ESX 5.1

I am using below JSON and kickstart to create template. When I check the "Network adapter" in the VM. I see no VLAN is assigned to it. Please help me with parameter to mention the VLAN and any other required parameters if any required.
(Initially tried without passing much data to vmx_data unlike the code below, but error is same.)

JSON

{
"variables": {
"vm_name": "packer",
"vm_description": "rhel7 base",
"iso": "/packer/Virtualbox/rhel-server-7.0-x86_64-dvd.iso",
"checksum": "85a9fedc2bf0fc825cc7817056aa00b3ea87d7e111e0cf8de77d3ba643f8646c",
"iso_checksum_type": "sha256"
},

"builders": [
{
"type": "vmware-iso",
"ssh_username": "packer",
"ssh_password": "packer",
"ssh_port": 22,
"ssh_wait_timeout": "30m",
"http_directory": "http",

"vm_name": "{{ user `vm_name` }}",
"guest_os_type": "rhel7-64",
"iso_url": "{{ user `iso` }}",
"iso_checksum": "{{ user `checksum` }}",
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
"tools_upload_flavor": "linux",
"remote_datastore": "removed",
"remote_host": "removed",
"remote_password": "removed",
"remote_type": "esx5",
"remote_username": "root",
"headless": false,
"vmx_data": {
"cpuid.coresPerSocket": 1,
"memsize": 512,
"ethernet0.present":"true",
"ethernet0.pciSlotNumber":"192",
"ethernet0.virtualDev":"vmxnet3",
"ethernet0.dvs.switchId":"",
"ethernet0.dvs.connectionId":"0",
"ethernet0.addressType":"vpx",
"numvcpus": 1
},

"boot_wait": "10s",
"boot_command": [
"<esc><wait>",
"vmlinuz initrd=initrd.img net.ifnames=0 biosdevname=0 ",
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks3.cfg<enter><wait>"
],

"shutdown_command": "echo '{{ user `username` }}' | sudo -S shutdown -P now"
}
]
}
Kickstart

install
cdrom
lang en_US.UTF-8
keyboard us
timezone America/New_York --isUtc
network --bootproto=dhcp

user --name=packer --plaintext --password packer --groups=packer --gecos="packer"
rootpw --iscrypted xxxxxxx
auth --enableshadow --passalgo=sha512 --kickstart
firewall --disabled
selinux --disabled

bootloader --location=mbr
services --disabled="ip6tables,iptables" --enabled=NetworkManager,sshd
text
skipx
zerombr
clearpart --all --initlabel
autopart --type=lvm
firstboot --disable
eula --agreed
reboot

%packages --instLangs=en_US.utf8 --nobase --ignoremissing --excludedocs
@Core
@Base
@Development Tools
@Console internet tools
@Legacy UNIX compatibility
@Network Infrastructure Server
@Networking Tools
@Perl Support
@Security Tools
@System administration tools
@Debugging Tools
@Compatibility libraries
%end

%post
groupadd -g 9999 packer
useradd -u 9999 -g packer -G wheel packer
echo "packer" | passwd --stdin packer
sed -E -i '/Defaults[[:space:]]+requiretty/ s/^/#/' /etc/sudoers
echo "packer ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
%end
Thanks in advance
Shyam

Rickard von Essen

unread,
Feb 13, 2017, 3:06:29 AM2/13/17
to packe...@googlegroups.com
Packer doesn't work with dvs (distributed virtual switches), I recommend unsetting those in the vmx_data section and add "ethernet0.networkName": "VM Network" or whatever your ESXi network is called. 

/ Rickard 

--
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/510caa6f-7bd0-4a98-bac1-f4f568260cd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shyam J

unread,
Feb 13, 2017, 5:13:30 AM2/13/17
to Packer
Thanks a lot. It worked
After that I see it is looking for Dhcp, but I don't have a Dhcp in that network and configured in kick-start static IP details.
Is packet co figured to use only Dhcp?

Thanks
Shyam

Rickard von Essen

unread,
Feb 13, 2017, 5:57:58 AM2/13/17
to packe...@googlegroups.com
It should work even with static IP's. Worst case you need to set ssh_host. 

Shyam

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

Shyam J

unread,
Feb 14, 2017, 4:27:27 AM2/14/17
to Packer
With mentioning ssh_host, ssh_port packer is still looking for Dhcp. Am I missing any other parameter?

Thanks
Shyam

Rickard von Essen

unread,
Feb 14, 2017, 5:37:00 AM2/14/17
to packe...@googlegroups.com
"With mentioning ssh_host, ssh_port packer is still looking for Dhcp" Sorry I don't follow this.


Thanks
Shyam

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

Shyam J

unread,
Feb 14, 2017, 5:49:46 AM2/14/17
to Packer
Hi Rickard,

What I was trying to explain is after adding ssh_host in my JSon file getting network error agsin. Packer is looking for dhcp. Please see error attached

Thanks


ShyanOn Tuesday, 14 February 2017 16:07:00 UTC+5:30, Rickard von Essen wrote:
> "With mentioning ssh_host, ssh_port packer is still looking for Dhcp" Sorry I don't follow this.
>
>
> On 14 February 2017 at 10:27, Shyam J <shya...@gmail.com> wrote:
> With mentioning ssh_host, ssh_port packer is still looking for Dhcp. Am I missing any other parameter?
>
>
>
> Thanks
>
> Shyam
>
>
>
> --
>
> 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.

IMG_20170214_161655.jpg

Rickard von Essen

unread,
Feb 14, 2017, 7:34:37 AM2/14/17
to packe...@googlegroups.com
Ok, that is not packer that is RHEL, you haven't configured networking in your kickstart. The default is dhcp.

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/8f25615e-94ed-4a23-ac0f-8b5163f9d649%40googlegroups.com.

Alvaro Miranda Aguilera

unread,
Feb 14, 2017, 3:33:20 PM2/14/17
to packe...@googlegroups.com
your kickstart

network --bootproto=dhcp

is dhcp

if you will use fixed ip, update kickstart (check rh documentation) and pass the same fixed ip to packer

alvaro

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/8f25615e-94ed-4a23-ac0f-8b5163f9d649%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Shyam J

unread,
Feb 20, 2017, 4:05:04 AM2/20/17
to Packer
Thanks Alvaro for checking..But even when I remove Dhcp entry and give full network details with IP it is searching for dhcp

Alvaro Miranda Aguilera

unread,
Feb 20, 2017, 1:46:30 PM2/20/17
to packe...@googlegroups.com
can you share your project over github?

it will be easier to review.

Thanks
Alvaro

On Mon, Feb 20, 2017 at 10:05 AM, Shyam J <shya...@gmail.com> wrote:
Thanks Alvaro for checking..But even when I remove Dhcp entry and give full network details with IP it is searching for dhcp
--
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.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Shyam J

unread,
Feb 22, 2017, 4:18:22 AM2/22/17
to Packer
Sorry I'm not much familiar with creating project in github.
I have raised a case for this and link for that is
https://github.com/mitchellh/packer/issues/4540

Thanks
Shyam

Kevin Gibbs

unread,
Feb 24, 2017, 2:59:03 AM2/24/17
to Packer
Do you have a DHCP server on the network?
AFAIK ESX does not provide a DHCP server, so you would need a separate one on your network to handle this for you

Shyam J

unread,
Mar 2, 2017, 3:04:46 AM3/2/17
to Packer
Hey,

Thanks everyone for checking.
I was able to fix this by adding network details along with kick-start details in same line under boot_command option. Even when we put network details in kick-start file packer can't communicate.

Thanks
Shyam

Reply all
Reply to author
Forward
0 new messages