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

Provisioner file fails to upload #11748

Closed
andhag opened this issue May 4, 2022 · 2 comments
Closed

Provisioner file fails to upload #11748

andhag opened this issue May 4, 2022 · 2 comments

Comments

@andhag
Copy link

andhag commented May 4, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Overview of the Issue

Sometimes, the provisioner file fails to upload.

Reproduction Steps

We run packer in a CentOS 8 Stream host in OpenStack and use provisioners file and ansible to craft Windows qcow2-images to use in OpenStack. The Windows ISO is downloaded from Microsoft.

This fails every second or third run on average, and I have tried to run with destination both with the file name and without it in the path, as the error message states that this might occur without trailing slashes. However this error occur with both variants.

Versions

packer 1.8.0
qemu-img 6.2.0

Simplified Packer Template

[centos@packer-win10_1809 ~]$ cat /var/opt/win-images/build/target/packer.json
{
"builders": [
{
"accelerator": "kvm",
"cd_files": [
"/var/opt/win-images/build/target/Autounattend.xml",
"/var/opt/win-images/build/files/cdrom/",
"/var/opt/win-images/build/files/scripts/redhat.pem",
"/var/opt/win-images/build/files/bin/CloudbaseInitSetup_1_1_2_x64.msi",
"/var/opt/win-images/build/files/bin/sdelete_2.04.zip",
"/var/opt/win-images/build/files/scripts/PackerShutdown.bat"
],
"communicator": "winrm",
"cpus": 4,
"disk_compression": true,
"disk_interface": "virtio",
"disk_size": "20480",
"headless": true,
"host_port_max": 5985,
"host_port_min": 5985,
"iso_checksum": "sha1:17cdbc9382eda742e2a5b5d6d8753e1ae0e5d0c5",
"iso_urls": [
"/var/opt/win-images/build/files/bin/windows-10-1809-ent.iso"
],
"machine_type": "q35",
"memory": 8192,
"net_device": "virtio-net",
"output_directory": "/var/opt/win-images/build/output-windows-10-1809-ent",
"qemu_binary": "/usr/libexec/qemu-kvm",
"qemuargs": [
[
"-global",
"virtio-pci.disable-modern=on"
]
],
"shutdown_command": "E:/PackerShutdown.bat",
"type": "qemu",
"vm_name": "windows-10-1809-ent",
"vnc_bind_address": "0.0.0.0",
"vnc_port_max": 5900,
"vnc_port_min": 5900,
"winrm_password": "P@ssw0rd",
"winrm_timeout": "2h",
"winrm_username": "Administrator"
}
],
"provisioners": [
{
"destination": "C:/Windows/Setup/Scripts/",
"source": "/var/opt/win-images/build/files/scripts/SetupComplete.cmd",
"type": "file"
},
{
"destination": "C:/Program Files/Cloudbase Solutions/Cloudbase-Init/LocalScripts/",
"source": "/var/opt/win-images/build/files/scripts/SetupComplete.cmd",
"type": "file"
},
{
"extra_arguments": [
"--extra-vars",
"ansible_winrm_scheme=http",
"--extra-vars",
"ansible_winrm_operation_timeout_sec=200",
"--extra-vars",
"ansible_winrm_read_timeout_sec=300"
],
"playbook_file": "/var/opt/win-images/build/image-converge.yml",
"type": "ansible",
"use_proxy": false,
"user": "Administrator"
}
]

Operating system and Environment details

Packer-machine: CentOS 8 Stream
PACKER_LOG_PATH=~/packer.log
PACKER_LOG=1

Target machines Windows 10 1809 and 21h2

Log Fragments and crash.log files

2022/05/04 08:48:31 ui: qemu: WinRM connected.
2022/05/04 08:48:31 packer-builder-qemu plugin: Connected to machine
2022/05/04 08:48:31 ui: ==> qemu: Connected to WinRM!
2022/05/04 08:48:31 packer-builder-qemu plugin: Running the provision hook
2022/05/04 08:48:31 [INFO] (telemetry) Starting provisioner file
2022/05/04 08:48:31 ui: ==> qemu: Uploading /var/opt/win-images/build/files/scripts/SetupComplete.cmd => C:/Windows/Setup/Scripts/
2022/05/04 08:48:31 packer-builder-qemu plugin: Uploading file to 'C:/Windows/Setup/Scripts/SetupComplete.cmd'
2022/05/04 08:48:31 packer-provisioner-file plugin: [INFO] 85 bytes written for 'uploadData'
2022/05/04 08:48:31 [INFO] 85 bytes written for 'uploadData'
2022/05/04 08:48:44 ui error: ==> qemu: Upload failed: Error restoring file from $env:TEMP\winrmcp-4126ffd0-7102-4df0-5764-aecbf12ec60c.tmp to C:\Windows\Setup\Scripts\SetupComplete.cmd: restore operation returned code=16001; this can occur when your file destination is a folder without a trailing slash.
2022/05/04 08:48:44 ui error: ==> qemu: Upload failed: Error restoring file from $env:TEMP\winrmcp-4126ffd0-7102-4df0-5764-aecbf12ec60c.tmp to C:\Windows\Setup\Scripts\SetupComplete.cmd: restore operation returned code=16001
2022/05/04 08:48:44 packer-provisioner-file plugin: closing
2022/05/04 08:48:44 closing
2022/05/04 08:48:44 packer-builder-qemu plugin: closing
2022/05/04 08:48:44 [INFO] (telemetry) ending file
2022/05/04 08:48:44 ui: ==> qemu: Provisioning step had errors: Running the cleanup provisioner, if present...
2022/05/04 08:48:44 packer-builder-qemu plugin: failed to unlock port lockfile: close tcp [::]:5900: use of closed network connection
2022/05/04 08:48:44 packer-builder-qemu plugin: failed to unlock port lockfile: close tcp [::]:5985: use of closed network connection
2022/05/04 08:48:44 packer-builder-qemu plugin: Deleting CD disk: /tmp/packer3987120516.iso
2022/05/04 08:48:44 ui: ==> qemu: Deleting output directory...
2022/05/04 08:48:44 [INFO] (telemetry) ending qemu
2022/05/04 08:48:44 ui error: Build 'qemu' errored after 11 minutes 5 seconds: Error restoring file from $env:TEMP\winrmcp-4126ffd0-7102-4df0-5764-aecbf12ec60c.tmp to C:\Windows\Setup\Scripts\SetupComplete.cmd: restore operation returned code=16001
2022/05/04 08:48:44 ui:
==> Wait completed after 11 minutes 5 seconds
2022/05/04 08:48:44 machine readable: error-count []string{"1"}
2022/05/04 08:48:44 ui error:
==> Some builds didn't complete successfully and had errors:
2022/05/04 08:48:44 machine readable: qemu,error []string{"Error restoring file from $env:TEMP\winrmcp-4126ffd0-7102-4df0-5764-aecbf12ec60c.tmp to C:\Windows\Setup\Scripts\SetupComplete.cmd: restore operation returned code=16001"}
2022/05/04 08:48:44 ui error: --> qemu: Error restoring file from $env:TEMP\winrmcp-4126ffd0-7102-4df0-5764-aecbf12ec60c.tmp to C:\Windows\Setup\Scripts\SetupComplete.cmd: restore operation returned code=16001
2022/05/04 08:48:44 ui:
==> Builds finished but no artifacts were created.
2022/05/04 08:48:44 [INFO] (telemetry) Finalizing.
2022/05/04 08:48:45 waiting for all plugin processes to complete...
2022/05/04 08:48:45 /usr/bin/packer: plugin process exited
2022/05/04 08:48:45 /usr/bin/packer: plugin process exited
2022/05/04 08:48:45 /usr/bin/packer: plugin process exited
2022/05/04 08:48:45 /usr/bin/packer: plugin process exited

@github-actions
Copy link

github-actions bot commented Nov 4, 2022

This issue has been migrated to hashicorp/packer-plugin-qemu#106 due to the Packer Plugin split.

Please follow the new issue for updates.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants