4

I was trying to do a kickstart installation for CentOS 6.4 but it always show me a warning of re-initializing the HDD as it say may contain invalid partition table or a virtual disk. I have added below is the snapshot of the kickstart file I am trying to use

# System bootloader configuration
bootloader --append="crashkernel=auto rhgb quiet" --location=mbr --driveorder="sda"
autopart
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel --drives=sda
part /boot --fstype ext4 --size=300
part / --fstype="ext4" --grow --size=1 --asprimary

Even I have created partitions to try as workaround but no resort. Any thoughts how to make this warning go away. I am trying to do this through Packer-tools for ESXI host (which has 5.5 version) running. Below is the JSON template I am using

# cat base-packer.json
{
  "builders": [
    {
      "vm_name": "Centos6.5",
      "type": "vmware-iso",
      "iso_url": "http://127.0.0.1:8000/CentOS-6.5-x86_64-minimal.iso",
      "iso_checksum": "0d9dc37b5dd4befa1c440d2174e88a87",
      "iso_checksum_type": "md5",
      "disk_size": "20480",
      "disk_type_id": "thin",
      "http_directory": "~/packertemplatebuilding",
      "remote_host": "191.168.42.3",
      "remote_datastore": "52dfe32b-a996d262-9b46-2c4138a85a23/Centos6.5",
      "remote_username": "root",
      "remote_password": "rootpass",
      "remote_type": "esx5",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_port": 22,
      "ssh_wait_timeout": "250s",
      "shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
      "headless": "false",
      "boot_command": [
        "<tab> text ks=http://148.147.206.152:8000/ks_new.cfg<enter><wait>"
      ],
      "boot_wait": "20s",
      "vmx_data": {
        "ethernet0.virtualDev": "vmxnet3",
        "ethernet0.networkName": "VM Network",
        "ethernet0.addressType": "generated",
        "ethernet0.present": "TRUE",
        "ethernet1.virtualDev": "vmxnet3",
        "ethernet1.networkName": "VM Network 2",
        "ethernet1.addressType": "generated",
        "ethernet1.present": "TRUE",
        "ide0:0.fileName": "disk.vmdk",
        "ide0:0.present": "TRUE",
        "ide0:0.redo": "",
        "scsi0:0.present": "FALSE",
        "memsize": "2048",
        "numvcpus": "2",
        "cpuid.coresPerSocket": "1"
      }
    }
  ],
"provisioners": [
    {
      "type": "shell",
      "script": "ssh-commands.sh"
    }
  ]
}

Below is the snapshot of the error I am getting. enter image description here

PS The image I am using is a custom spin from CentOS 6.4. But I don't think that kickstart config should have an impact on the same.

ewwhite
  • 197,159
  • 92
  • 443
  • 809
Abhinav
  • 225
  • 1
  • 4
  • 12
  • 1
    Can you show the error message? – ewwhite Jun 13 '14 at 11:31
  • Its a re-initialize dialog box come when the machine boots up. Saying that its either a virtual disk. So would you like to continue as it will loose any existing data. – Abhinav Jun 13 '14 at 11:34
  • 1
    So you installer is running in Graphical mode as well? Can you add `text` to your kickstart? Also, please correct the `clearpart --all` line. – ewwhite Jun 13 '14 at 12:44
  • What is the custom spin? Also, you seem to be interchanging CentOS 6.4 and 6.5. – ewwhite Jun 13 '14 at 13:04
  • @ewwhte, Sorry for creating confusion. The example above have CentOS6.5 iso as due to some reason I can't specify the actual name of ISO. But as I said the ISO is spin using CentOS 6.4 base and it should not impact the kickstart installation. – Abhinav Jun 13 '14 at 13:25
  • If you're so confident about it you should try the same file on a standard ISO to verify. – MikeyB Jun 13 '14 at 13:26
  • Was this ever resolved? – ewwhite Jun 25 '14 at 12:16
  • Nope finally I left trying it :( As I tried Centos image (from official site) it work out of box but the image we deliver didn't work and got busy with other work. So not much progress. – Abhinav Jun 25 '14 at 14:56

3 Answers3

5

If you're receiving an error message similar to the following in your EL6 kickstart, you'll need to add zerombr to the kickstart command set.

You should also have this instead:

zerombr
clearpart --all --initlabel

enter image description here

From the documentation:

zerombr: If zerombr is specified any invalid partition tables found on disks are initialized. This destroys all of the contents of disks with invalid partition tables. This command is required when performing an unattended installation on a system with previously initialized disks.

Edit:

I just tried this on a fresh CentOS EL6.5 virtual machine running on a vSphere 5.5 platform... The following worked three times in succession without issue, including a reinstallation on the same disks:

zerombr
clearpart --all --initlabel
part /boot --fstype ext4 --size=300
part /usr --fstype ext4 --size=10240 --asprimary
part / --fstype ext4 --size=20480 --asprimary
part /var --fstype ext4 --size=6144
part swap --size=8192
part /tmp --fstype ext4 --size=2048
ewwhite
  • 197,159
  • 92
  • 443
  • 809
3

I found a potential problem:

      "iso_url": "http://127.0.0.1:8000/CentOS-6.5-x86_64-minimal.iso",

The CentOS "minimal" disk is customized and may do unexpected things, as it was intended and customized only to install a single set of packages. It should not be used with a kickstart installation; use the netinstall or DVD images instead.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • 1
    Oh, I use the minimal ISO all the time for kickstart installs. It's never been an issue. I repeated the test below with the minimal ISO instead of the net install ISO with no change in outcome. – ewwhite Jun 13 '14 at 12:51
  • You're a braver man than I am, then. Knowing how they built the minimal image, I wouldn't use it for anything but pets. – Michael Hampton Jun 13 '14 at 12:54
  • This is an example as I can't put the actual image name in the config. We have our own custom spin for the application which is based on CentOS 6.4. So the actual errors is being reported through those disk installation. One more thing with CentOS-6.5-x86_64-minimal.iso I am not facing any issue and the VM get created without any error. – Abhinav Jun 13 '14 at 13:23
2

But as I said the ISO is spin using CentOS 6.4 base and it should not impact the kickstart installation.

You need to verify this. Try with a standard ISO.


If it still gives the error, you told it to only clear sda:

# Partition clearing information
clearpart --all --initlabel --drives=sda

Change to:

clearpart --all --initlabel

and try again.

MikeyB
  • 39,291
  • 10
  • 105
  • 189
  • Already did that but still same error. – Abhinav Jun 13 '14 at 13:31
  • 1
    Did what? Both things? Or are you picking the one you already did and ignoring the other? – MikeyB Jun 13 '14 at 13:39
  • I have tried once `clearpart --all --initlabel` and when the problem still persist then I tried `clearpart --all --initlabel --drives=sda`. In both cases zerombr was put in the file. Also the kickstart file I am using is the one which anaconda installer create after manual install. – Abhinav Jun 13 '14 at 14:08
  • So the answer is no, you haven't tried both suggestions. OK. – MikeyB Jun 13 '14 at 17:08