Skip to content

v9.1.0.0p1-Beta scp behaviour change breaks packer #2018

Closed
@rgl

Description

@rgl

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

  1. use packer to provision a windows machine that has Win32-OpenSSH v9.1.0.0p1-Beta installed.
  2. configure the packer template to use scp, e.g.:
  communicator             = "ssh"
  ssh_username             = "vagrant"
  ssh_password             = "vagrant"
  ssh_timeout              = "4h"
  ssh_file_transfer_method = "scp" # NB scp is the default.
  1. run packer to provision the windows machine

FWIW, we can workaround this in our packer template with ssh_file_transfer_method = "sftp", but that does not seem to be the correct way of handling this.

Expected behavior

Expected scp to work in packer.

Actual behavior

The packer output shows:

==> qemu.windows-2022-amd64: Waiting for SSH to become available...
==> qemu.windows-2022-amd64: Connected to SSH!
==> qemu.windows-2022-amd64: Provisioning with Powershell...
==> qemu.windows-2022-amd64: Provisioning with powershell script: disable-windows-updates.ps1
==> qemu.windows-2022-amd64: Error processing command: Error uploading ps script containing env vars: Process exited with status 1
==> qemu.windows-2022-amd64: Step "StepProvision" failed, aborting...
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "StepConnect"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepWaitGuestAddress"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepTypeBootCommand"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepConfigureQMP"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepRun"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepPrepareEfivars"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepConfigureVNC"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepPortForward"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "StepHTTPServer"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepHTTPIPDiscover"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepResizeDisk"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepCopyDisk"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepCreateDisk"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "StepCreateCD"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "StepCreateFloppy"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepCreatevTPM"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "stepPrepareOutputDir"
==> qemu.windows-2022-amd64: aborted: skipping cleanup of step "StepDownload"
Build 'qemu.windows-2022-amd64' errored after 10 minutes 59 seconds: Error processing command: Error uploading ps script containing env vars: Process exited with status 1

The packer logs show:

2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] Opening new ssh session
2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] Starting remote scp process:  scp -vt c:/Windows/Temp
2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] Started SCP session, beginning transfers...
2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] Copying input data into temporary file so we can read the length
2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] scp: Uploading packer-ps-env-vars-639e4af1-37d0-609c-2d47-6651b5f3cd0f.ps1: perms=C0644 size=0
2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] SCP session complete, closing stdin pipe.
2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] Waiting for SSH session to complete.
2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] scp stderr (length 118): Sink: C0644 0 packer-ps-env-vars-639e4af1-37d0-609c-2d47-6651b5f3cd0f.ps1
2022/12/17 23:04:29 packer-builder-qemu plugin: scp.exe: debug1: fd 0 clearing O_NONBLOCK
2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] non-zero exit status: 1, Process exited with status 1
2022/12/17 23:04:29 packer-builder-qemu plugin: [DEBUG] scp output: �scp: c:/Windows/Temp/packer-ps-env-vars-639e4af1-37d0-609c-2d47-6651b5f3cd0f.ps1: add_mark_of_web failed
2022/12/17 23:04:29 packer-builder-qemu plugin: 
2022/12/17 23:04:29 packer-provisioner-powershell plugin: Retryable error: Error uploading ps script containing env vars: Process exited with status 1
2022/12/17 23:04:31 packer-provisioner-powershell plugin: [INFO] 0 bytes written for 'uploadData'
2022/12/17 23:04:31 [INFO] 0 bytes written for 'uploadData'

I think this is due to extraneous output now being returned by sshd:

scp output: �scp: c:/Windows/Temp/packer-ps-env-vars-639e4af1-37d0-609c-2d47-6651b5f3cd0f.ps1: add_mark_of_web failed

This seems related to:

Is there a way to disable the add_mark_of_web feature?

Error details

No response

Environment data

v9.1.0.0p1-Beta

Version

v9.1.0.0p1-Beta

Visuals

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions