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

Error creating ISO during build #93

Closed
benjamin-crill opened this issue Feb 6, 2023 · 29 comments
Closed

Error creating ISO during build #93

benjamin-crill opened this issue Feb 6, 2023 · 29 comments

Comments

@benjamin-crill
Copy link

/kind bug

*Packer HCL validates fine, but errors when going to build with the following screenshot. Tried with specifying image name on the cluster and with ISO downloaded to Packer directory. This is after getting xorriso installed which an ISO handler is not documented as a requirement for the Packer config to work.

image
What did you expect to happen:

Environment:

  • packer-plugin-nutanix version (use packer plugins installed): 0.3
  • Packer version (use packer version): 1.8.5
  • OS (e.g. from /etc/os-release): 2019
@tuxtof
Copy link
Contributor

tuxtof commented Feb 7, 2023

Sounds like a xorriso issue and not related to nutanix packer plugin

Cygwin is maybe causing trouble based on the path in the failure ?

@benjamin-crill
Copy link
Author

Is there documentation on the pre-reqs to get this working? I don't see any mention of needing something to handle ISOs. Which begs the question the need for it as with other Packer plugins the ISO mounting is handled on the hypervisor side, so what's different?

@tuxtof
Copy link
Contributor

tuxtof commented Feb 7, 2023

behaviour is exactly the same for some other plugins like the vsphere one
iso need to be created first and packer check for local tools to do that
after, iso is send to hypervisor who mount it

in the log we clearly see the issue is when packer call the iso tools

cam you try your packer file on a linux vm ?

@benjamin-crill
Copy link
Author

In the VMware packer you specify the ISO path on the datastore and it mounts it to the VM. Never installed any ISO tools on a local station before.

@tuxtof
Copy link
Contributor

tuxtof commented Feb 8, 2023

@benjamin-crill can you start sharing your packer file please, It will be easier for everyone to understand what we are talking about

@benjamin-crill
Copy link
Author

packer {
required_plugins {
nutanix = {
version = ">= 0.1.3"
source = "github.com/nutanix-cloud-native/nutanix"
}
}
}

variable "nutanix_username" {
type = string
default = ""
}

variable "nutanix_password" {
type = string
sensitive = true
default = ""
}

variable "nutanix_endpoint" {
type = string
default = ""
}

variable "nutanix_port" {
type = number
default = 9440
}

variable "nutanix_insecure" {
type = bool
default = true
}

variable "nutanix_subnet" {
type = string
default = ""
}

variable "nutanix_cluster" {
type = string
default = ""
}

variable "windows_2016_iso_image_name" {
type = string
default = "Win_Server_STD_CORE_and_DataCtr_2019_STD.ISO"
}

variable "virtio_iso_image_name" {
type = string
default = "Nutanix-VirtIO-1.1.7.iso"
}

source blocks are generated from your builders; a source can be referenced in

build blocks. A build block runs provisioner and post-processors on a

source. Read the documentation for source blocks here:

https://www.packer.io/docs/templates/hcl_templates/blocks/source

source "nutanix" "autogenerated_1" {
nutanix_username = var.nutanix_username
nutanix_password = var.nutanix_password
nutanix_endpoint = var.nutanix_endpoint
nutanix_insecure = var.nutanix_insecure
cluster_name = var.nutanix_cluster

vm_disks {

image_type = "ISO_IMAGE"

source_image_name = var.windows_2016_iso_image_name

}

vm_disks {

image_type = "ISO_IMAGE"

source_image_name = var.virtio_iso_image_name

}

vm_disks {
image_type = "DISK"
disk_size_gb = 40
}

vm_nics {
subnet_name = var.nutanix_subnet
}

cd_files = ["scripts/gui/autounattend.xml","scripts/win-update.ps1"]

image_name ="win2019pck-{{isotime Jan-_2-15:04:05}}"
shutdown_command = "shutdown /s /t 10 /f /d p:4:1 /c "Packer Shutdown""
shutdown_timeout = "3m"
cpu = 2
os_type = "Windows"
memory_mb = "8192"
communicator = "winrm"
winrm_port = 5986
winrm_insecure = true
winrm_use_ssl = true
winrm_timeout = "45m"
winrm_password = ""
winrm_username = ""
}

a build block invokes sources and runs provisioning steps on them. The

documentation for build blocks can be found here:

https://www.packer.io/docs/templates/hcl_templates/blocks/build

build {
sources = ["source.nutanix.autogenerated_1"]

provisioner "powershell" {
scripts = ["scripts/win-update.ps1"]
pause_before = "2m"
}
provisioner "windows-restart" {
restart_timeout = "30m"
}

}

This is what I'm using. Combo of a working file I have used on vSphere along with stuff from the example here. On Linux this won't even validate saying that the required plugins section is not expected.

@tuxtof
Copy link
Contributor

tuxtof commented Feb 10, 2023

When we talk about ISO there is two different things:

  • the iso you mount directly inside your VM like (windows image or virtio image) in this case pushed to the hypervisor and directly mounted
  • the iso created by packer who contain your cd_files ("scripts/gui/autounattend.xml","scripts/win-update.ps1") and this one is generated on the fly that's why you need a tools to generate ISO (same for vmware as explained here for exemple https://developer.hashicorp.com/packer/plugins/builders/vsphere/vsphere-iso#optional-3)

i try to take a look on your exemple , despite difficulty based on the way you paste the content

it seems i don't see specific issue for me the main error is this line

Cannot determine attributes of source file "/cygdrive/c/Service/Packer/example/C: \Users\BCRILL
1\AppData\Local\Temp\packer_to_cdrom1399738888' : No such file or directory

the path seems very strange and directly associated to your env

i also quickly replicate your example on a linux packer machine and i had no issue

@benjamin-crill
Copy link
Author

On the ISO side of things with vSphere, traditionally have used floppy files to accomplish the same task and then it works without additional ISO management software.

I got it working on Linux, however it is crashing during the build. Log is showing and unexpected EOF error. What's odd is that the packer build continues to build the artifacts and leave them on the cluster rather than deleting them.

@tuxtof
Copy link
Contributor

tuxtof commented Feb 13, 2023

can you share log of the crash with PACKER_LOG=1 packer build ...

there is a PR open to improve error handling and for the moment in case of error artefact stay on cluster to analysis

@benjamin-crill
Copy link
Author

crash.log

Log attached

@tuxtof
Copy link
Contributor

tuxtof commented Feb 13, 2023

Thanks for the log

there is a lot of error management improvement in the actual master branch
are you able to test it with ?
if not i will release a version later this week

@benjamin-crill
Copy link
Author

This is non-prod lab so I can test

@tuxtof
Copy link
Contributor

tuxtof commented Feb 16, 2023

Hello @benjamin-crill v0.5.0 was released can you give a try and give me a PACKER_LOG=1 packer build .
it need to give us a better view

@benjamin-crill
Copy link
Author

crash.log

Crash log with updated plugin to .5

@tuxtof
Copy link
Contributor

tuxtof commented Feb 17, 2023

ok i have identified where is the error, now i need to understood why and try to reproduce to fix it in a futur version

can you send me an archive with the content of the packer project and also give me the following information

  • Nutanix PC/PE/AOS/AHV version
  • Account type used by packer to connect to PC
  • Subnet type (IPAM or not ) configured inside the VM

thanks

@benjamin-crill
Copy link
Author

PC 2022.6.0.1
AOS - 6.5.1.5
AHV - 20201105.30417
Active Directory account used to connect to PC
No IPAM on subnet

@tuxtof
Copy link
Contributor

tuxtof commented Feb 17, 2023

thanks

don't forgot to send me an archive with the content of the packer project

@benjamin-crill
Copy link
Author

OK so the EOF error is no longer happening. It was some syntax error I had in the packer file. The only issue I'm dealing with now is that WinRM is not connecting. Still investigating

@benjamin-crill
Copy link
Author

Is it possible to assign categories via the Packer plugin? Looks like there might be Flow policies based on category tags?

@tuxtof
Copy link
Contributor

tuxtof commented Feb 21, 2023

OK so the EOF error is no longer happening. It was some syntax error I had in the packer file. The only issue I'm dealing with now is that WinRM is not connecting. Still investigating

are you able to give me the exact syntax error, I would like to track it and protect against

@tuxtof
Copy link
Contributor

tuxtof commented Feb 21, 2023

Is it possible to assign categories via the Packer plugin? Looks like there might be Flow policies based on category tags?

yes I was fix with #97 and #99

@benjamin-crill
Copy link
Author

Is it possible to assign categories via the Packer plugin? Looks like there might be Flow policies based on category tags?

yes I was fix with #97 and #99

OK didn't see it on the doc page for the plugin at HC. I'll give that a try. Thanks!

@benjamin-crill
Copy link
Author

OK so the EOF error is no longer happening. It was some syntax error I had in the packer file. The only issue I'm dealing with now is that WinRM is not connecting. Still investigating

are you able to give me the exact syntax error, I would like to track it and protect against

I wish I could. I just started eliminating scripts to add to the CD files, then added them back in. Not sure which one it was as I'm back to what I started with and it is working now

@benjamin-crill
Copy link
Author

Is it possible to assign categories via the Packer plugin? Looks like there might be Flow policies based on category tags?

yes I was fix with #97 and #99

Clarification, does this put the category/key on the output image? It is not putting it on the build VM

@tuxtof
Copy link
Contributor

tuxtof commented Feb 22, 2023

sorry @benjamin-crill I misread your message and I was focusing on the image, you want category on the building VM correct ??

@benjamin-crill
Copy link
Author

Yeah, ultimately that's not my issue, it's something else in the network. However I do think it would be good to put categories onto the build VM so as to isolate it to only software repositories during build time among other possibilities.

@tuxtof
Copy link
Contributor

tuxtof commented Feb 22, 2023

Yeah, ultimately that's not my issue, it's something else in the network. However I do think it would be good to put categories onto the build VM so as to isolate it to only software repositories during build time among other possibilities.

ok in progress here #108

@tuxtof
Copy link
Contributor

tuxtof commented Feb 23, 2023

#108 was merged and I also reproduce the above EOF error

@benjamin-crill
Copy link
Author

Very nice and thanks for all the help. I'm going to make this issue as closed as I think we have sufficiently addressed the issues. Appreciate taking the feedback and enhancing. I'm going to keep testing

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