First attempt at Packer in my ESXi 7 lab, got a couple if issues, but I'm close I think


I’m using Packer with ESXi 7 on my lab (to learn for work). I’m trying to build a Ubuntu 18.04 vm using Packer, but it gets stuck at the partition section:


This is my preseed.cfg

Can you see anything I’m missing?


I am using this one and it’s working. Maybe you can compare.

# partitioning
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman/alignment string optimal
d-i partman-auto-lvm/new_vg_name string os
d-i partman-auto/choose_recipe select custom-lvm
d-i partman/default_filesystem string ext4
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

I removed the recipe due to it’s length.

I think you are missing the overall

d-i partman/confirm boolean true

Just removed my partman and added yours but I get the same issues.

You should compare, not replace it. :smiley:

Well I did compare and it was very similar so I tried that and it stopped at the same point, so I thought I’d try yours.

Does it work through the list in order to answer?

Good question, but I don’t think so.

Is this preseed also for a Ubuntu flavour?

Yes, it is. Ubuntu 18.04.

Great that is what I’m using. So I have fixed that and it now builds the 18.04 vm and I can login, but my packer cli shows:

==> Ubuntu-18.04: Waiting for SSH to become available…
==> Ubuntu-18.04: Connected to SSH!
==> Ubuntu-18.04: Gracefully halting virtual machine…

It just stays on this.

I then hit control-c and it aborted and deleted it, what should I do?

Cancelling build after receiving interrupt
==> Ubuntu-18.04: Timeout while waiting for machine to shut down.
==> Ubuntu-18.04: Provisioning step had errors: Running the cleanup provisioner, if present…
==> Ubuntu-18.04: Stopping virtual machine…
==> Ubuntu-18.04: Destroying virtual machine…
Build ‘Ubuntu-18.04’ errored after 12 minutes 59 seconds: Timeout while waiting for machine to shut down.

==> Wait completed after 12 minutes 59 seconds
Cleanly cancelled builds after being interrupted.

Packer is waiting for privisioner (script).

You should read the docs about it (could be a shell script, Chef, Ansible, etc.) how to install packages and stuff.

This site should be worth reading, too:

I will thanks for the link.

So you have added something like this to your build.json file?

Yes. My repository isn’t public so I can’t share my scripts. But do you know the learn platform already?

For provisioning this should be the right place:

Yes you are right it looks like I need something like this at the end, I’m just struggling to get the { and [ in the right place at the end

"provisioners": [


          "type": "shell",

          "inline": ["echo 'template build complete'"]