vsphere-iso - Centos 8 json example

91 views
Skip to first unread message

gowtham...@gmail.com

unread,
Sep 17, 2020, 6:08:21 AM9/17/20
to Packer
Team, 
 
Am using the following JSON and KS.cfg to build the centos 8 templates. But facing an error with floppy disks (which am not using in the config). Can someone help me with this? 

CentOS 8 JSON
```
{
  "variables": {
   "vsphere_uid": "Null",
   "vsphere_passwd": "Null",
   "vm_superuser_passwd" : "Null",
   "vsphere_vm_name": "Null",
   "bastion_host": "",
   "bastion_user": "",
   "bastion_password":"Null",
   "datacenter": "",
   "cluster": "",
   "datastore": "",
   "network": "",
   "iso_paths": ""
   },

  "builders": [
    {
      "type": "vsphere-iso",

      "vcenter_server":      "{{user `vsphere_server` }}",
      "username":            "{{user `vsphere_uid` }}",
      "password":            "{{user `vsphere_passwd` }}",
      "insecure_connection": "true",
      "datacenter": "{{user `datacenter` }}",
      "cluster": "{{user `cluster` }}",
      "datastore": "{{user `datastore` }}",
      "network": "{{user `network` }}",
      "vm_name": "{{user `vsphere_vm_name` }}",

      "guest_os_type": "centos7_64Guest",

      "ssh_username": "nubi-admin",
      "ssh_password": "{{user `vm_superuser_passwd` }}",
      "ssh_bastion_host": "{{user `bastion_host` }}",
      "ssh_bastion_username": "{{user `bastion_user` }}",
      "ssh_bastion_agent_auth": true,

      "CPUs":             2,
      "RAM":              5120,
      "RAM_reserve_all": false,

      "convert_to_template": true,

      "disk_controller_type":  "pvscsi",
      "disk_size":        102400,
      "disk_thin_provisioned": true,
      "network_card": "vmxnet3",
      "http_directory" :  "httpks",
      "iso_paths": [
        "[nfs] centos/CentOS-8.2.2004-x86_64-minimal.iso"
      ],
      "iso_checksum": "e15fb0e51726de0a4128448b9bd63e7b",
      "iso_checksum_type": "md5",
      "boot_command": "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg <enter><wait>"
          }
  ]

}
```

And  ks.cfg is 

```
#version=RHEL8
ignoredisk --only-use=sda
#autopart --type=lvm

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

# Partition clearing information
clearpart --none --initlabel
# Use graphical install
text
repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
# Use CDROM installation media
cdrom
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

firewall --disabled
selinux --enforcing

# Network information
#network  --bootproto=dhcp --device=enp0s3 --ipv6=auto --activate
#network  --hostname=centos9

network --device enp0s3 --bootproto=static --ip=10.1.23.18 --netmask=255.255.255.0 --gateway=10.1.23.1  --noipv6
network  --hostname=centos9
# Root password
rootpw --iscrypted $6$F7bzgUtNYJpooIdfgsferfgdfggdf56hhbAYgcPdgKCj3OAhOF27zWr6EBt1JU87Uqz.sRP9mcOesxf4xKZoyzI./
# Run the Setup Agent on first boot
firstboot --disabled

reboot
# Do not configure the X Window System
skipx
# System services
services --disabled="chronyd"
# System timezone
timezone Pacific/Auckland --isUtc --nontp

%packages
@^server-product-environment
#@container-management
@performance
#@remote-system-management
#@rpm-development-tools
@security-tools
@system-tools

%end

%addon com_redhat_kdump --disable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

%post
# Install open-vm-tools, required to detect IP when building on ESXi
yum -y install open-vm-tools
systemctl enable vmtoolsd
```
Error is :

```
dracut-pre-udev{585}: modprobe: FATAL: Module floppy not found in directory /lib/modules/4.18.0-193.2l8.x86_64

— 2020/09/17 05:17:40 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepConfigParams'. Press enter to continue. 2020/09/17 05:17:40 packer-builder-vsphere-iso.linux: 2020/09/17 05:17:40 No floppy files specified. Floppy disk will not be made. 2020/09/17 05:17:40 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepCreateFloppy'. Press enter to continue. 2020/09/17 05:17:40 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepAddFloppy'. Press enter to continue.
 — Dracut-initqueue: warning : could not boot Entering Emergency mode. 


```

Megan Marsh

unread,
Sep 18, 2020, 1:17:57 PM9/18/20
to packe...@googlegroups.com
Can you set the environment var PACKER_LOG=1 and share the verbose logs you get from 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/hashicorp/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/a89b07be-74a7-40e4-8f18-cfeb18750167n%40googlegroups.com.

Gowtham

unread,
Sep 19, 2020, 2:10:35 AM9/19/20
to packe...@googlegroups.com
Please check below for the log.

```
2020/09/19 07:00:36 [INFO] Packer version: 1.5.6 [go1.14.2 darwin amd64]
2020/09/19 07:00:36 Checking 'PACKER_CONFIG' for a config file path
2020/09/19 07:00:36 'PACKER_CONFIG' not set; checking the default config file path
2020/09/19 07:00:36 Attempting to open config file: /Users/gowgopal/.packerconfig
2020/09/19 07:00:36 [WARN] Config file doesn't exist: /Users/gowgopal/.packerconfig
2020/09/19 07:00:36 Setting cache directory: /Users/gowgopal/Cisco/dcloud-devops/packer-generic/packer_cache
2020/09/19 07:00:36 Creating plugin client for path: /usr/local/bin/packer
2020/09/19 07:00:36 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-builder-vsphere-iso"}
2020/09/19 07:00:37 Waiting for RPC address for: /usr/local/bin/packer
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: [INFO] Packer version: 1.5.6 [go1.14.2 darwin amd64]
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: Checking 'PACKER_CONFIG' for a config file path
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: Attempting to open config file: /Users/gowgopal/.packerconfig
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: [WARN] Config file doesn't exist: /Users/gowgopal/.packerconfig
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: Setting cache directory: /Users/gowgopal/packer-generic/packer_cache
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: args: []string{"packer-builder-vsphere-iso"}
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: Plugin address: unix /var/folders/p2/yryvx2wx1dvbwzz6rg4whzg80000gn/T/packer-plugin144997911
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: Waiting for connection...
2020/09/19 07:00:37 Received unix RPC address for /usr/local/bin/packer: addr is /var/folders/p2/yryvx2wx1dvbwzz6rg4whzg80000gn/T/packer-plugin144997911
2020/09/19 07:00:37 packer-builder-vsphere-iso plugin: Serving a plugin connection...
2020/09/19 07:00:37 ui: Debug mode enabled. Builds will not be parallelized.
2020/09/19 07:00:37 ui: vsphere-iso: output will be in this color.
2020/09/19 07:00:37 ui:
2020/09/19 07:00:37 Build debug mode: true
2020/09/19 07:00:37 Force build: false
2020/09/19 07:00:37 On error:
2020/09/19 07:00:37 Preparing build: vsphere-iso
2020/09/19 07:00:37 Debug enabled, so waiting for build to finish: vsphere-iso
2020/09/19 07:00:37 Starting build run: vsphere-iso
2020/09/19 07:00:37 Running builder: vsphere-iso
2020/09/19 07:00:37 [INFO] (telemetry) Starting builder vsphere-iso
2020/09/19 07:00:38 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepConnect'. Press enter to continue.
2020/09/19 07:00:56 ui: ==> vsphere-iso: Creating VM...
2020/09/19 07:00:58 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepCreateVM'. Press enter to continue.
2020/09/19 07:00:58 ui: ==> vsphere-iso: Customizing hardware...
2020/09/19 07:00:59 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepConfigureHardware'. Press enter to continue.
2020/09/19 07:00:59 ui: ==> vsphere-iso: Mounting ISO images...
2020/09/19 07:00:59 packer-builder-vsphere-iso plugin: Creating CD-ROM on controller '&{{{} 200 0xc00092a280 <nil> <nil> <nil> 0 <nil>} 0 []}' with iso '[nfs_iso_100] centos/CentOS-8.2.2004-x86_64-minimal.iso'
2020/09/19 07:01:00 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepAddCDRom'. Press enter to continue.
2020/09/19 07:01:10 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepConfigParams'. Press enter to continue.
2020/09/19 07:01:11 packer-builder-vsphere-iso plugin: No floppy files specified. Floppy disk will not be made.
2020/09/19 07:01:11 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepCreateFloppy'. Press enter to continue.
2020/09/19 07:01:18 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepAddFloppy'. Press enter to continue.
2020/09/19 07:01:19 packer-builder-vsphere-iso plugin: Found available port: 8852 on IP: 0.0.0.0
2020/09/19 07:01:19 ui: ==> vsphere-iso: Starting HTTP server on port 8852
2020/09/19 07:01:19 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepHTTPServer'. Press enter to continue.
2020/09/19 07:01:19 ui: ==> vsphere-iso: Set boot order temporary...
2020/09/19 07:01:20 ui: ==> vsphere-iso: Power on VM...
2020/09/19 07:01:21 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepRun'. Press enter to continue.
2020/09/19 07:01:21 ui: ==> vsphere-iso: Waiting 10s for boot...
2020/09/19 07:01:31 ui: ==> vsphere-iso: HTTP server is working at http://192.168.1.64:8852/
2020/09/19 07:01:31 ui: ==> vsphere-iso: Typing boot command...
2020/09/19 07:01:31 packer-builder-vsphere-iso plugin: Special code '<tab>' found, replacing with: CodeTab
2020/09/19 07:01:41 packer-builder-vsphere-iso plugin: Special code '<enter>' found, replacing with: CodeReturnEnter
2020/09/19 07:01:41 packer-builder-vsphere-iso plugin: Waiting 1 second
2020/09/19 07:01:42 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepBootCommand'. Press enter to continue.
2020/09/19 07:01:42 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 30m0s, settle timeout: 5s
2020/09/19 07:01:42 ui: ==> vsphere-iso: Waiting for IP...
2020/09/19 07:07:11 packer-builder-vsphere-iso plugin: Received interrupt signal (count: 1). Ignoring.
2020/09/19 07:07:11 ui error: Cancelling build after receiving interrupt
2020/09/19 07:07:11 Cancelling builder after context cancellation context canceled
2020/09/19 07:07:11 packer-builder-vsphere-iso plugin: [WARN] Interrupt detected, quitting waiting for IP.
2020/09/19 07:07:11 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepBootCommand'. Press enter to continue.
2020/09/19 07:07:11 packer-builder-vsphere-iso plugin: VM IP aquired:
2020/09/19 07:07:13 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepRun'. Press enter to continue.
2020/09/19 07:07:13 ui: ==> vsphere-iso: Clear boot order...
2020/09/19 07:07:14 ui: ==> vsphere-iso: Power off VM...
2020/09/19 07:07:15 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepHTTPServer'. Press enter to continue.
2020/09/19 07:07:15 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepAddFloppy'. Press enter to continue.
2020/09/19 07:07:15 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepCreateFloppy'. Press enter to continue.
2020/09/19 07:07:15 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepConfigParams'. Press enter to continue.
2020/09/19 07:07:16 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepAddCDRom'. Press enter to continue.
2020/09/19 07:07:16 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepConfigureHardware'. Press enter to continue.
2020/09/19 07:07:16 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepCreateVM'. Press enter to continue.
2020/09/19 07:07:17 ui: ==> vsphere-iso: Destroying VM...
2020/09/19 07:07:17 ui: ask: ==> vsphere-iso: Pausing before cleanup of step 'StepConnect'. Press enter to continue.
2020/09/19 07:07:17 [INFO] (telemetry) ending vsphere-iso
2020/09/19 07:07:17 ui: Build 'vsphere-iso' finished.
2020/09/19 07:07:17 Waiting on builds to complete...
2020/09/19 07:07:17 ui: Cleanly cancelled builds after being interrupted.
2020/09/19 07:07:17 [INFO] (telemetry) Finalizing.
2020/09/19 07:07:18 waiting for all plugin processes to complete...
2020/09/19 07:07:18 /usr/local/bin/packer: plugin process exited
 gowgopal@GOWGOPAL-M-H0VS  /tmp 
```

---
Best regards,
Gowtham
07798838879 


=====================
Learn from mistakes....

Please consider the environment before printing this email - Thanks


Megan Marsh

unread,
Sep 21, 2020, 12:20:03 PM9/21/20
to packe...@googlegroups.com
I'm not seeing that floppy modprobe error in the verbose logs. What I am seeing is "No floppy files specified. Floppy disk will not be made" so it doesn't seem to me like Packer is actually trying to create a floppy here.

```

2020/09/19 07:01:42 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 30m0s, settle timeout: 5s
2020/09/19 07:01:42 ui: ==> vsphere-iso: Waiting for IP...
2020/09/19 07:07:11 packer-builder-vsphere-iso plugin: Received interrupt signal (count: 1). Ignoring.
2020/09/19 07:07:11 ui error: Cancelling build after receiving interrupt
2020/09/19 07:07:11 Cancelling builder after context cancellation context canceled
```

meaning you cancelled the build after about 6 minutes. Is the dracut/modprobe error something you see in the vm's GUI instead?

Gowtham

unread,
Sep 21, 2020, 3:22:24 PM9/21/20
to packe...@googlegroups.com

Hello Megan, 

The attachment contains the errors. Please check. 

---
Best regards,
Gowtham
07798838879 


=====================
Learn from mistakes....

Please consider the environment before printing this email - Thanks

Screenshot 2020-09-21 at 20.14.45.png
Screenshot 2020-09-21 at 20.14.35.png
Screenshot 2020-09-21 at 20.16.18.png
Screenshot 2020-09-21 at 20.18.28.png
Screenshot 2020-09-21 at 20.21.04.png
Screenshot 2020-09-21 at 20.19.49.png

Gowtham

unread,
Sep 24, 2020, 2:43:53 PM9/24/20
to packe...@googlegroups.com
Dear Megan,

Any luck with this?

---
Best regards,
Gowtham
07798838879 


=====================
Learn from mistakes....

Please consider the environment before printing this email - Thanks

Megan Marsh

unread,
Sep 24, 2020, 6:01:12 PM9/24/20
to packe...@googlegroups.com
Sorry, my kid's sick and I've only been able to work limited hours. I think the floppy module thing is a red herring. I've seen that dracut initqueue timeout before when a VM's network configuration is messed up. See https://groups.google.com/g/packer-tool/c/wb3b4zdbcbE and https://github.com/hashicorp/packer/issues/8642

Since you're in vsphere, try connecting to the emergency shell via the web console and seeing whether you can actually reach the Packer server and files.

Gowtham

unread,
Oct 27, 2020, 5:12:47 PM10/27/20
to packe...@googlegroups.com
Hello Megan,

Hope you well. Am still stuck with this issue, By any chance could you please check "https://discuss.hashicorp.com/t/vsphere-iso-centos-8-http-directory-configuration/16649/2" ? 

I've tried locally and using Jenkins, both places it's throwing the file or directory is missing. Any suggestions? 

---
Best regards,
Gowtham
07798838879 


=====================
Learn from mistakes....

Please consider the environment before printing this email - Thanks

Reply all
Reply to author
Forward
0 new messages