Newbie - not converting to a template and suck on waiting for ip

91 views
Skip to first unread message

Steve Schofield

unread,
Aug 23, 2018, 10:07:31 PM8/23/18
to Packer
I'm new to packer and vsphere-iso provider.  I've been able provision a centos7 build where it does an unattended install va kickstart (vsphere 6.7).  It fails on finding open-vm-tools.  Could this be the reason?  After the install, the server boots back to a command prompt instead of powering off, converting to a template. I can ssh to the server and login as root. (yeah!)  I'd prefer it turn off and convert to a template.  I see on the packer site, there is a convert_to_template property.  I tried putting in post-processors, no luck.   I sense I'm close to having this work, but stuck on Waiting for IP.

Any tips / tricks are appreciated.  I can post the ks.cfg and other files if necessary.  Newer to this community so not sure all what to post for assistance.  Thanks for your patience.

Rickard von Essen

unread,
Aug 24, 2018, 3:15:31 AM8/24/18
to packe...@googlegroups.com
Show us your template, kickstart file, and the log output and we might be able to help. Without that I can only give the general advice to run packer with env var PACKER_LOG=1 and look for what packer is trying to connect to and use that to troubleshoot the network the usual way, both from the host side and from inside the VM (open a console from vSphere).

On Fri, 24 Aug 2018 at 04:07, Steve Schofield <steve.s...@gmail.com> wrote:
I'm new to packer and vsphere-iso provider.  I've been able provision a centos7 build where it does an unattended install va kickstart (vsphere 6.7).  It fails on finding open-vm-tools.  Could this be the reason?  After the install, the server boots back to a command prompt instead of powering off, converting to a template. I can ssh to the server and login as root. (yeah!)  I'd prefer it turn off and convert to a template.  I see on the packer site, there is a convert_to_template property.  I tried putting in post-processors, no luck.   I sense I'm close to having this work, but stuck on Waiting for IP.

Any tips / tricks are appreciated.  I can post the ks.cfg and other files if necessary.  Newer to this community so not sure all what to post for assistance.  Thanks for your patience.

--
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/c27c21ea-9370-490a-b9dc-10178a0595f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve Schofield

unread,
Aug 24, 2018, 6:01:44 AM8/24/18
to packe...@googlegroups.com

Made some progress and thanks for your patience.  I started a few days ago and my knowledge of linux / packer is growing leaps and bounds.  For testing, I manually logged into the VM, run yum install open-vm-tools and Packer finishes successfully, converts itself into a template.  This points to me having the provider can retrieve the ip information.   Here is what I’ve included.

 

·         Ks-log inside VM (error can’t resolve the mirror list) – does resolve after I log into VM

·         Packer debug log

·         The JSON file (I think that is what you meant by template)

·         Kickstart file

 

===============

KS log inside VM

===============

 

+ yum-config-manager --add-repo http://centos.mirror.org

/tmp/ks-script-LpgGJe: line 4: yum-config-manager: command not found

+ echo 'Installing VM Tools...'

Installing VM Tools...

+ sudo yum -y install open-vm-tools

Loaded plugins: fastestmirror

Determining fastest mirrors

 

 

One of the configured repositories failed (Unknown),

and yum doesn't have enough cached data to continue. At this point the only

safe thing yum can do is fail. There are a few ways to work "fix" this:

 

     1. Contact the upstream for the repository and get them to fix the problem.

 

     2. Reconfigure the baseurl/etc. for the repository, to point to a working

        upstream. This is most often useful if you are using a newer

        distribution release than is supported by the repository (and the

        packages for the previous distribution release still work).

 

     3. Run the command with the repository temporarily disabled

            yum --disablerepo=<repoid> ...

 

     4. Disable the repository permanently, so yum won't use it by default. Yum

        will then just ignore the repository until you permanently enable it

        again or use --enablerepo for temporary usage:

 

            yum-config-manager --disable <repoid>

        or

            subscription-manager repos --disable=<repoid>

 

     5. Configure the failing repository to be skipped, if it is unavailable.

        Note that yum will try to contact the repo. when it runs most commands,

        so will have to try and fail each time (and thus. yum will be be much

        slower). If it is a very temporary problem though, this is often a nice

        compromise:

 

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

 

Cannot find a valid baseurl for repo: base/7/x86_64

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was

14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

+ sudo systemctl enable vmtoolsd

Operation failed: No such file or directory

+ sudo systemctl start vmtoolsd

Running in chroot, ignoring request.

 

===============

Packer Log

===============

 

2018/08/24 05:36:43 [INFO] Packer version: 1.2.2

2018/08/24 05:36:43 Packer Target OS/Arch: linux amd64

2018/08/24 05:36:43 Built with Go Version: go1.10

2018/08/24 05:36:43 [DEBUG] Discovered plugin: vsphere-iso = /apps/packer/packer-builder-vsphere-iso.linux

2018/08/24 05:36:43 [DEBUG] Discovered plugin: vsphere = /apps/packer/packer-builder-vsphere.linux

2018/08/24 05:36:43 Detected home directory from env var: /root

2018/08/24 05:36:43 Using internal plugin for cloudstack

2018/08/24 05:36:43 Using internal plugin for docker

2018/08/24 05:36:43 Using internal plugin for file

2018/08/24 05:36:43 Using internal plugin for hyperv-vmcx

2018/08/24 05:36:43 Using internal plugin for oneandone

2018/08/24 05:36:43 Using internal plugin for azure-arm

2018/08/24 05:36:43 Using internal plugin for null

2018/08/24 05:36:43 Using internal plugin for lxc

2018/08/24 05:36:43 Using internal plugin for amazon-ebssurrogate

2018/08/24 05:36:43 Using internal plugin for oracle-classic

2018/08/24 05:36:43 Using internal plugin for scaleway

2018/08/24 05:36:43 Using internal plugin for virtualbox-iso

2018/08/24 05:36:43 Using internal plugin for virtualbox-ovf

2018/08/24 05:36:43 Using internal plugin for vmware-vmx

2018/08/24 05:36:43 Using internal plugin for hyperv-iso

2018/08/24 05:36:43 Using internal plugin for amazon-ebs

2018/08/24 05:36:43 Using internal plugin for digitalocean

2018/08/24 05:36:43 Using internal plugin for googlecompute

2018/08/24 05:36:43 Using internal plugin for openstack

2018/08/24 05:36:43 Using internal plugin for qemu

2018/08/24 05:36:43 Using internal plugin for triton

2018/08/24 05:36:43 Using internal plugin for amazon-chroot

2018/08/24 05:36:43 Using internal plugin for lxd

2018/08/24 05:36:43 Using internal plugin for ncloud

2018/08/24 05:36:43 Using internal plugin for oracle-oci

2018/08/24 05:36:43 Using internal plugin for parallels-iso

2018/08/24 05:36:43 Using internal plugin for amazon-instance

2018/08/24 05:36:43 Using internal plugin for amazon-ebsvolume

2018/08/24 05:36:43 Using internal plugin for parallels-pvm

2018/08/24 05:36:43 Using internal plugin for vmware-iso

2018/08/24 05:36:43 Using internal plugin for alicloud-ecs

2018/08/24 05:36:43 Using internal plugin for profitbricks

2018/08/24 05:36:43 Using internal plugin for chef-solo

2018/08/24 05:36:43 Using internal plugin for file

2018/08/24 05:36:43 Using internal plugin for puppet-server

2018/08/24 05:36:43 Using internal plugin for salt-masterless

2018/08/24 05:36:43 Using internal plugin for shell

2018/08/24 05:36:43 Using internal plugin for ansible-local

2018/08/24 05:36:43 Using internal plugin for powershell

2018/08/24 05:36:43 Using internal plugin for converge

2018/08/24 05:36:43 Using internal plugin for chef-client

2018/08/24 05:36:43 Using internal plugin for puppet-masterless

2018/08/24 05:36:43 Using internal plugin for ansible

2018/08/24 05:36:43 Using internal plugin for windows-restart

2018/08/24 05:36:43 Using internal plugin for windows-shell

2018/08/24 05:36:43 Using internal plugin for shell-local

2018/08/24 05:36:43 Using internal plugin for atlas

2018/08/24 05:36:43 Using internal plugin for checksum

2018/08/24 05:36:43 Using internal plugin for docker-push

2018/08/24 05:36:43 Using internal plugin for vsphere-template

2018/08/24 05:36:43 Using internal plugin for amazon-import

2018/08/24 05:36:43 Using internal plugin for artifice

2018/08/24 05:36:43 Using internal plugin for googlecompute-export

2018/08/24 05:36:43 Using internal plugin for vagrant

2018/08/24 05:36:43 Using internal plugin for vsphere

2018/08/24 05:36:43 Using internal plugin for alicloud-import

2018/08/24 05:36:43 Using internal plugin for compress

2018/08/24 05:36:43 Using internal plugin for docker-save

2018/08/24 05:36:43 Using internal plugin for manifest

2018/08/24 05:36:43 Using internal plugin for shell-local

2018/08/24 05:36:43 Using internal plugin for docker-import

2018/08/24 05:36:43 Using internal plugin for docker-tag

2018/08/24 05:36:43 Using internal plugin for vagrant-cloud

2018/08/24 05:36:43 Detected home directory from env var: /root

2018/08/24 05:36:43 Attempting to open config file: /root/.packerconfig

2018/08/24 05:36:43 [WARN] Config file doesn't exist: /root/.packerconfig

2018/08/24 05:36:43 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[oneandone:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oneandone profitbricks:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-profitbricks hyperv-vmcx:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-vmcx oracle-classic:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oracle-classic virtualbox-iso:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-iso oracle-oci:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oracle-oci parallels-pvm:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-pvm amazon-ebsvolume:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebsvolume alicloud-ecs:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-alicloud-ecs vmware-vmx:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-vmx hyperv-iso:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-iso openstack:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-openstack triton:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-triton amazon-chroot:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-chroot ncloud:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-ncloud vsphere-iso:/apps/packer/packer-builder-vsphere-iso.linux cloudstack:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-cloudstack parallels-iso:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-iso vsphere:/apps/packer/packer-builder-vsphere.linux file:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-file virtualbox-ovf:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-ovf digitalocean:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-digitalocean googlecompute:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-googlecompute qemu:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-qemu azure-arm:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-azure-arm amazon-ebssurrogate:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebssurrogate lxd:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxd amazon-instance:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-instance scaleway:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-scaleway amazon-ebs:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebs docker:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-docker null:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-null lxc:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxc vmware-iso:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-iso] PostProcessors:map[atlas:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-atlas checksum:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-checksum vsphere-template:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere-template docker-save:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-save docker-push:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-push artifice:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-artifice googlecompute-export:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-googlecompute-export alicloud-import:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-alicloud-import manifest:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-manifest docker-import:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-import amazon-import:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-amazon-import vagrant:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant shell-local:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-shell-local docker-tag:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-tag vagrant-cloud:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant-cloud vsphere:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere compress:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-compress] Provisioners:map[file:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file shell:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell puppet-masterless:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-masterless chef-solo:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-solo converge:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-converge salt-masterless:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-salt-masterless chef-client:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-client ansible:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible windows-restart:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-restart ansible-local:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible-local powershell:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-powershell windows-shell:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-shell shell-local:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell-local puppet-server:/apps/packer/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-server]}

2018/08/24 05:36:43 Detected home directory from env var: /root

2018/08/24 05:36:43 Setting cache directory: /tmp/packer_cache

2018/08/24 05:36:43 Detected home directory from env var: /root

2018/08/24 05:36:43 Loading builder: vsphere-iso

2018/08/24 05:36:43 Creating plugin client for path: /apps/packer/packer-builder-vsphere-iso.linux

2018/08/24 05:36:43 Starting plugin: /apps/packer/packer-builder-vsphere-iso.linux []string{"/apps/packer/packer-builder-vsphere-iso.linux"}

2018/08/24 05:36:43 Waiting for RPC address for: /apps/packer/packer-builder-vsphere-iso.linux

2018/08/24 05:36:43 packer-builder-vsphere-iso.linux: 2018/08/24 05:36:43 Plugin minimum port: 10000

2018/08/24 05:36:43 packer-builder-vsphere-iso.linux: 2018/08/24 05:36:43 Plugin maximum port: 25000

2018/08/24 05:36:43 packer-builder-vsphere-iso.linux: 2018/08/24 05:36:43 Plugin address: unix /tmp/packer-plugin040179003

2018/08/24 05:36:43 packer-builder-vsphere-iso.linux: 2018/08/24 05:36:43 Waiting for connection...

2018/08/24 05:36:43 packer-builder-vsphere-iso.linux: 2018/08/24 05:36:43 Serving a plugin connection...

2018/08/24 05:36:43 Loading provisioner: shell

2018/08/24 05:36:43 Plugin could not be found. Checking same directory as executable.

2018/08/24 05:36:43 Current exe path: /apps/packer/packer

2018/08/24 05:36:43 Creating plugin client for path: /apps/packer/packer

2018/08/24 05:36:43 Starting plugin: /apps/packer/packer []string{"/apps/packer/packer", "plugin", "packer-provisioner-shell"}

2018/08/24 05:36:43 Waiting for RPC address for: /apps/packer/packer

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 [INFO] Packer version: 1.2.2

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Packer Target OS/Arch: linux amd64

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Built with Go Version: go1.10

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Detected home directory from env var: /root

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Attempting to open config file: /root/.packerconfig

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 [WARN] Config file doesn't exist: /root/.packerconfig

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[] PostProcessors:map[] Provisioners:map[]}

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Detected home directory from env var: /root

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Setting cache directory: /tmp/packer_cache

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 args: []string{"packer-provisioner-shell"}

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Plugin minimum port: 10000

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Plugin maximum port: 25000

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Detected home directory from env var: /root

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Plugin address: unix /tmp/packer-plugin133455204

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Waiting for connection...

2018/08/24 05:36:43 packer: 2018/08/24 05:36:43 Serving a plugin connection...

2018/08/24 05:36:43 ui: Debug mode enabled. Builds will not be parallelized.

2018/08/24 05:36:43 ui: [1;32mvsphere-iso output will be in this color.[0m

2018/08/24 05:36:43 ui:

2018/08/24 05:36:43 Build debug mode: true

2018/08/24 05:36:43 Force build: false

2018/08/24 05:36:43 On error:

2018/08/24 05:36:43 Preparing build: vsphere-iso

2018/08/24 05:36:43 Debug enabled, so waiting for build to finish: vsphere-iso

2018/08/24 05:36:43 Starting build run: vsphere-iso

2018/08/24 05:36:43 Running builder: vsphere-iso

2018/08/24 05:36:43 [INFO] (telemetry) Starting builder vsphere-iso

2018/08/24 05:36:43 ui: ask: [1;32m==> vsphere-iso: Pausing after run of step 'StepConnect'. Press enter to continue.[0m

2018/08/24 05:36:45 ui: [1;32m==> vsphere-iso: Creating VM...[0m

2018/08/24 05:36:48 ui: ask: [1;32m==> vsphere-iso: Pausing after run of step 'StepCreateVM'. Press enter to continue.[0m

2018/08/24 05:36:49 ui: [1;32m==> vsphere-iso: Customizing hardware...[0m

2018/08/24 05:36:49 ui: ask: [1;32m==> vsphere-iso: Pausing after run of step 'StepConfigureHardware'. Press enter to continue.[0m

2018/08/24 05:36:50 ui: ask: [1;32m==> vsphere-iso: Pausing after run of step 'StepConfigParams'. Press enter to continue.[0m

2018/08/24 05:36:50 ui: [1;32m==> vsphere-iso: Adding CD-ROM drives...[0m

2018/08/24 05:36:51 ui: ask: [1;32m==> vsphere-iso: Pausing after run of step 'StepAddCDRom'. Press enter to continue.[0m

2018/08/24 05:36:52 packer-builder-vsphere-iso.linux: 2018/08/24 05:36:52 No floppy files specified. Floppy disk will not be made.

2018/08/24 05:36:52 ui: ask: [1;32m==> vsphere-iso: Pausing after run of step 'StepCreateFloppy'. Press enter to continue.[0m

2018/08/24 05:36:52 ui: ask: [1;32m==> vsphere-iso: Pausing after run of step 'StepAddFloppy'. Press enter to continue.[0m

2018/08/24 05:36:53 ui: [1;32m==> vsphere-iso: Set boot order...[0m

2018/08/24 05:36:53 ui: [1;32m==> vsphere-iso: Power on VM...[0m

2018/08/24 05:36:59 ui: ask: [1;32m==> vsphere-iso: Pausing after run of step 'StepRun'. Press enter to continue.[0m

2018/08/24 05:36:59 ui: [1;32m==> vsphere-iso: Waiting 15s for boot...[0m

2018/08/24 05:37:14 ui: [1;32m==> vsphere-iso: Typing boot command...[0m

2018/08/24 05:37:14 packer-builder-vsphere-iso.linux: 2018/08/24 05:37:14 Special code '<tab>' found, replacing with: CodeTab

2018/08/24 05:37:17 packer-builder-vsphere-iso.linux: 2018/08/24 05:37:17 Special code '<enter>' found, replacing with: CodeReturnEnter

2018/08/24 05:37:17 packer-builder-vsphere-iso.linux: 2018/08/24 05:37:17 Waiting 1 second

2018/08/24 05:37:18 ui: ask: [1;32m==> vsphere-iso: Pausing after run of step 'StepBootCommand'. Press enter to continue.[0m

2018/08/24 05:37:19 ui: [1;32m==> vsphere-iso: Waiting for IP...[0m

 

===============

JSON file

===============

{

  "builders": [

    {

      "type": "vsphere-iso",

      "vcenter_server":      "vc1.ss.local",

      "username":            "admini...@vsphere.local",

      "password":            "prayerworks",

      "insecure_connection": "true",

      "vm_name": "centos-7-{{ timestamp }}",

      "cluster": "Cluster",

      "datastore": "Datastore1",

      "network": "VM Network1",

      "boot_wait": "15s",

      "boot_order": "disk,cdrom",

      "guest_os_type": "rhel7_64Guest",

      "convert_to_template": "true",

      "folder": "Templates",

      "ssh_username": "root",

      "ssh_password": "prayerworks",

      "CPUs":             2,

      "CPU_limit":        -1,

      "RAM":              4096,

      "RAM_reserve_all": false,

      "disk_controller_type":  "pvscsi",

      "disk_size":        51200,

      "network_card": "vmxnet3",

      "iso_paths": [

                    "Datastore1] ISO/boot3.iso"

      ],

      "boot_command": [

        "<tab> ks=cdrom:/ks.cfg <enter><wait>"

      ]

      }

  ],

 

  "provisioners": [

    {

      "type": "shell",

      "inline": ["ls /"]

    }

  ]

}

 

================

Kickstart file

# Set repo to mirror.centos.org

repo --name="CentOS" --baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ --cost=100

repo --name="Updates" --baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ --cost=100

 

# Required settings

lang en_US.UTF-8

keyboard us

rootpw vagrant

authconfig --enableshadow --enablemd5

timezone UTC

 

# Optional settings

install

cdrom

user --name=root --plaintext --password prayerworks

rootpw " prayerworks"

unsupported_hardware

network --device eth0 --bootproto=dhcp

firewall --disabled

selinux --disabled

 

# Disk partitioning information

bootloader --location=mbr --append="no_timer_check console=tty0 console=ttyS0,115200 net.ifnames=0 biosdevname=0" --boot-drive=sda

text

skipx

zerombr

clearpart --all --initlabel

clearpart --all --drives=sda

ignoredisk --only-use=sda

part /boot --fstype="xfs" --ondisk=sda --size=512

part / --fstype="xfs" --ondisk=sda --grow --size=1

firstboot --disabled

reboot

 

%packages --ignoremissing --excludedocs

@^minimal

@core

 

# Prerequisites for installing VMware Tools or VirtualBox guest additions.

# Put in kickstart to ensure first version installed is from install disk,

# not latest from a mirror.

kernel-headers

kernel-devel

gcc

make

perl

curl

wget

bzip2

patch

net-tools

selinux-policy-devel

# Core selinux dependencies installed on 7.x, no need to specify

# Other stuff

sudo

nfs-utils

-fprintd-pam

-intltool

 

# Microcode updates cannot work in a VM

-microcode_ctl

# unnecessary firmware

-aic94xx-firmware

-alsa-firmware

-alsa-tools-firmware

-atmel-firmware

-b43-openfwwf

-bfa-firmware

-ipw*-firmware

-irqbalance

-ivtv-firmware

-iwl*-firmware

-kernel-firmware

-libertas-usb8388-firmware

-ql*-firmware

-rt61pci-firmware

-rt73usb-firmware

-xorg-x11-drv-ati-firmware

-zd1211-firmware

# Don't build rescue initramfs

-dracut-config-rescue

%end

 

%post --log=/var/log/ks.post02.log

#!/bin/bash

 

set -x

yum-config-manager --add-repo http://centos.mirror.org

 

# Install sdc-vmtools guest tools

echo "Installing VM Tools..."

# Install open-vm-tools, required to detect IP when building on ESXi

sudo yum -y install open-vm-tools

sudo systemctl enable vmtoolsd

sudo systemctl start vmtoolsd

 

%end

Rickard von Essen

unread,
Aug 24, 2018, 6:06:55 AM8/24/18
to packe...@googlegroups.com
Your kickstart seems to have an error in setting the root pwd:
rootpw " prayerworks"
it contains a leading space.

Steve Schofield

unread,
Aug 24, 2018, 6:19:37 AM8/24/18
to packe...@googlegroups.com

That is a typo by me when removing actual values.  There is no space otherwise. 

Rickard von Essen

unread,
Aug 24, 2018, 6:37:36 AM8/24/18
to packe...@googlegroups.com
You have to troubleshot your kickstart post script so it works correctly. http://centos.mirror.org doesn't exist.

Steve Schofield

unread,
Aug 24, 2018, 7:32:12 AM8/24/18
to packe...@googlegroups.com

At the top of my kickstart file there are two repo names.  Don’t those get added by default?

 

# Set repo to mirror.centos.org

repo --name="CentOS" --baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ --cost=100

repo --name="Updates" --baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ --cost=100

 

 

 

Rickard von Essen

unread,
Aug 25, 2018, 7:01:28 AM8/25/18
to packe...@googlegroups.com
I think it's best to step back and try to run one known good config (such as https://github.com/chef/bento) with virtualbox or vmware. I don't have access to vSphere and have never used the vsphere builder.

I tried you kickstart and it seems correct, in the end it will get down to standard network troubleshooting. As long as Packer finds the correct IP/port to ssh to and have the correct credentials it should work. 

Run with -on-error=ask when you build so you have infinite time to troubleshoot.
Reply all
Reply to author
Forward
0 new messages