user2066657
user2066657

Reputation: 479

generating kickstart ISO for post-fd OSes (eg CentOS 8) and using it in packer vsphere-iso invocation

I'm having a problem specifying the kickstart source on my Packer vsphere-iso template build. I suspect I'm close, but I'm still seeing that the ks is not found during boot and the install goes Interactive at that point.

In my vsphere-iso packer, I'm saying:

{
  "variables":
  {
:
    "ks"                : "CentOS-8-x86_64.ks",
:
    "cd_label"          : "OEMDRV",
    "vmipaddress"       : "10.1.8.47",
    "vmnetmask"         : "255.255.254.0",
    "vmgateway"         : "10.1.9.254",
    "vmnameserver"      : "10.1.9.210",
:
  },

  "builders":
  [
    {
      "type"                 : "vsphere-iso",
:
      "boot_wait"            : "5s",
      "boot_command":
      [
        "<esc>",
        " linux ks=hd:LABEL={{user `cd_label`}}:/{{user `ks`}}",
        " ip={{user `vmipaddress`}}::{{user `vmgateway`}}:{{user `vmnetmask`}}:template:eth0:none",
        " nameserver={{user `vmnameserver`}}",
        " biosdevname=0 net.ifnames=0",
        "<enter>",
        "<wait>"
      ],
:
      "cd_files"         : ["ks/{{user `ks`}}"],
      "cd_label"         : "{{user `cd_label`}}",
:
:
}

No, I can't refer it back to an HTTP URL. Trust me, I can't !

I can confirm that ks/CentOS-8-x86_64.ks exists, so I half assume anaconda should find it. Mounting a generated ISO image out of the packer cache dir on the DS shows that yes, it is being built with a non-empty ks file on-board.

I don't think the devname tunings (for actually consistent device naming) is causing a problem here, but I don't discount it.

The boot command ends up rendered as (manual copy, watch for typos):

boot:   linux ks=hd:LABEL=OEMDRV:/CentOS-8-x86_64.ks ip=10.1.8.47::10.1.9.254:255.255
.254.0:template:eth0:none nameserver=10.1.9.210 biosdevname=0 net.ifnames=0
Loading ... failed: No such file or directory
boot: _ 

Something's not right. It's gotta be a dumb typo, as I've got the typical "at wits' end" feeling that always precedes a typo fix.

Can you help me spot it?

Upvotes: 0

Views: 1376

Answers (1)

I too had the same problem. I didn't want to use HTTP because, reasons.

I wasn't able to get the ks=hd:LABEL=OEMDRV working.

I switched to using cdrom but for some odd reason, I had to explicitly specify /dev/sr1 when using cdrom. sr0 would be the CentOS ISO i'm booting from, so sr1 is the second ISO (that Packer builds and uploads on the fly)

Following your naming convention, I used the equivalent of inst.ks=cdrom:/dev/sr1:/CentOS-8-x86_64.ks and was able to get it working.

Tested using CentOS-8.2.2004-x86_64-minimal.iso

Upvotes: 1

Related Questions