Closed clong closed 2 years ago
Even more strange is that the .vmx file shows bios.bootorder = "hdd,cdrom"
, so I have no idea why this VM thinks it should be booting from the CDROM
I'm going to try using cleanup_remote_cache
in my Packer config since it seems to be mounting the cached packer ISO in the CD-ROM
Arg, no luck - it's still trying to mount it
│ Error: There was an ovftool Error: Opening VI source: vi://root@esxi:443/Ubuntu2004
│ Error: Message is: Received SOAP response fault from [<SSL(<io_obj p:0x00007fe23e7ae648, h:12, <TCP '192.168.x.x : 56333'>, <TCP '192.168.x.x : 443'>>), /sdk>]: exportVm
│ File /vmfs/volumes/5fa2e867-a99660fa-8e1a-001fc69bd4f1/packer_cache/48e4ec4daa32571605576c5566f486133ecc271f.iso was not found,
│ Fault cause: vim.fault.FileNotFound
│
│ Completed with errors
│
│ exit status 1
│
│
│ with esxi_guest.logger,
│ on main.tf line 17, in resource "esxi_guest" "logger":
│ 17: resource "esxi_guest" "logger" {
│
╵
Looks like there's a --noImageFiles
flag in ovftool that could potentially be useful here.
I will look into this further... But I can give a few comments abour your research on the CDrom.
I don't really do anything with the CDrom in the plugin. OVFtool handles it and I don't modify what it copies or does not copy. Honestly, I don't really remember exactly how OVFtool deals with each option. There's a lot of options and a lot that can go wrong if you want or don't want CDrom settings to be copied???
BTW: I've had only a single other request to support CDrom.
I looked into it and I decided not add support because there is so little demand and it will be complex to do. (Connected button, there is 3 device types, I have to add a controller if it's not there and deal with the ISO medias). There's so many options and they all need to be validated...
To answer one of your questions " I have no idea why this VM thinks it should be booting from the CDROM". If the system cannot boot the hdisk, it will then try to boot the cdrom. I've experienced this problem many times with ESXi 7.x because the default firmware type is now "efi". Switch to "bios", then your hdisk will boot.
I 'kinda' re-created your issue using my Vagrant plugin and using the Bento boxes. Not sure it's the exact problem, but I was able to fix the booting problem by increasing the default vmguest hw version from 8 to 13. You can probably go higher depending on your esxi version).
I notice in your screenshot the compatibility is "ESXi 5.1 Virtual Machine"... Try setting the virthw
option to to something higher it might resolve the problem. (13+). Let me know how it works out.
I just pushed v1.9.0 with the default hw version changed... Give it a try and let me know.
Thank you! I'll give that a shot
Hmm I still saw ESXi 5.1 after building with v1.9.0 but it's possible I missed something. I'm going to try defining virtualhw.version
in the Packer config to see if that works as well.
How did you realize this could be related to the hw version? I would have never made that connection.
Still no luck, even though it now shows "Workstation 15 machine"
I was suspecting the hwversion because I did some tests using Vagrant and the Bento Boxes. Using hwverion 8 I would get an error about a file not found, while hwversion 13 it worked.
I'm sorry, but I never worked with Packer. Is there an option to disable the CDrom completely?
I just came across https://www.packer.io/docs/builders/vmware/iso#vmx_data_post which should let me disconnect the CD after the build finishes - I totally missed that directive. However, per this (old) issue, it does look like passing --noImageFiles
using ovftool is another way to fix this. Feel free to close, but it could be nice to have that be an optional flag to pass to ovftool. Thanks for all your help digging into this!
Describe the bug After building a vmware-iso box with Packer, the VM is attempting to mount a file called
__deviceImage-0
in the CD-ROM when booting. This can cause the boot to hang indefinitely if it boots from the CD-ROM first as it will try to reinstall the OS.To Reproduce Steps to reproduce the behavior:
Expected behavior No CD-ROM file should get mounted.
Terraform files https://github.com/clong/DetectionLab/blob/master/ESXi/main.tf
Desktop (please complete the following information):
Additional context I don't know "who" is responsible for clearing the CD-ROM after building, but this seems to have started happening only within the last few months. Not sure if you have any insight.