Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CD-ROM Mounting "__deviceImage-0" #158

Closed
clong opened this issue Oct 25, 2021 · 12 comments
Closed

CD-ROM Mounting "__deviceImage-0" #158

clong opened this issue Oct 25, 2021 · 12 comments

Comments

@clong
Copy link

clong commented Oct 25, 2021

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.

image

To Reproduce
Steps to reproduce the behavior:

  1. Build the Bento 20.04 Ubuntu box: https://github.com/chef/bento/tree/main/packer_templates/ubuntu
  2. Deploy to ESXi 7 using terraform-provider-esxi

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):

  • OS: MacOS 11.6
  • Terraform Version: 1.0.2
  • Ovftool Version: 4.4.3
  • This Plugin Version 1.8.2

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.

@clong
Copy link
Author

clong commented Oct 25, 2021

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

@clong
Copy link
Author

clong commented Oct 25, 2021

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

@clong clong closed this as completed Oct 25, 2021
@clong clong reopened this Oct 25, 2021
@clong
Copy link
Author

clong commented Oct 25, 2021

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" {
│
╵

@clong
Copy link
Author

clong commented Oct 25, 2021

Looks like there's a --noImageFiles flag in ovftool that could potentially be useful here.

@josenk
Copy link
Owner

josenk commented Oct 25, 2021

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.

#95

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.

@josenk
Copy link
Owner

josenk commented Oct 26, 2021

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.

@josenk
Copy link
Owner

josenk commented Oct 27, 2021

I just pushed v1.9.0 with the default hw version changed... Give it a try and let me know.

@clong
Copy link
Author

clong commented Oct 27, 2021

Thank you! I'll give that a shot

@clong
Copy link
Author

clong commented Oct 27, 2021

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.

@clong
Copy link
Author

clong commented Oct 27, 2021

Still no luck, even though it now shows "Workstation 15 machine"

@josenk
Copy link
Owner

josenk commented Oct 28, 2021

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?

@clong
Copy link
Author

clong commented Oct 30, 2021

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!

@clong clong closed this as completed Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants