Closed vlinx closed 5 years ago
You can override %TMP% to workaround this issue
λ set TMP=c:\scripts λ echo %TMP% c:\scripts
Hello there, thanks for reporting. Yes the docs states( for windows ) :
TMP TEMP USERPROFILE - The location of the directory used for temporary files ( defaults to [...] %USERPROFILE%\AppData\Local\Temp on Windows Vista and above )
Looking into it.
@vlinx On Windows, it uses GetTempPath, returning the first non-empty value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory.
Are you sure TMP was not set at the time ? In which case I think TMP will have precedence.
I have both of my %TMP% and %TEMP% set correctly. However I would like to use temp_path to override the value to "c:\scripts" while keeping %TMP% and %TEMP% as it is. What I am trying to accomplish here is to GetTempPath to return c:\scripts without manually modifing %TMP% and %TEMP%. Since modifing %TMP% and %TEMP% breaks other programs. https://www.packer.io/docs/builders/hyperv-iso.html#temp_path
temp_path
is The location under which Packer will create a directory to house all the VM files and folders during the build.
Looking at the code & tests, it looks like to me that everything is fine:
ioutil.TempDir
will use what's in temp_path
if set and tmp.Dir
uses GetTempPath
(env vars) when temp_path
is not set.
In your debug output something else fails even before we get to the step where temp_path
is used as we can't find the debug output: Created build directory
.
Your error is the following:
Failed creating Hyper-V driver: PowerShell error: CylancePROTECT Script Control has blocked access to this PowerShell script.
Looks like to me that CylancePROTECT
is blocking you the access to the hyperv driver.
I'm going to close this issue as it seems to me it is a question more than a bug, I think the discussion list is the place to go for you 🙂. https://www.packer.io/community.html
Cheers !
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.
Packer version v1.4.0
Host platform Windows 10 Enterprise Version 1809 OS Build 17763.475
Debug log output from
PACKER_LOG=1 packer build template.json
.2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 Setting cache directory: C:\gbstbsd\nebula\packer\centos-vb\packer_cache
2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 args: []string{"packer-builder-hyperv-iso"} 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 Plugin minimum port: 10000 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 Plugin maximum port: 25000 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 Plugin address: tcp 127.0.0.1:10000 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 Waiting for connection... 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 Serving a plugin connection... 2019/05/13 12:37:00 Build debug mode: false 2019/05/13 12:37:00 Force build: false 2019/05/13 12:37:00 On error: 2019/05/13 12:37:00 Preparing build: hyperv-iso 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 DiskSize: 25360 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 DiskBlockSize: 32 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 RamSize: 2048 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 VMName: packer-demo 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 Using switch internal_vSwitch 2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 SwitchName: internal_vSwitch
Warnings for build 'hyperv-iso': 2019/05/13 12:37:00 Waiting on builds to complete... 2019/05/13 12:37:00 Starting build run: hyperv-iso
2019/05/13 12:37:00 Running builder: hyperv-iso
2019/05/13 12:37:00 packer.exe: 2019/05/13 12:37:00 Enter method: verifyPSVersion
2019/05/13 12:37:00 [INFO] (telemetry) ending hyperv-iso 2019/05/13 12:37:00 ui error: Build 'hyperv-iso' errored: Failed creating Hyper-V driver: PowerShell error: CylancePROTECT Script Control has blocked access to this PowerShell script.Build 'hyperv-iso' errored: Failed creating Hyper-V driver: PowerShell error: CylancePROTECT Script Control has blocked access to this PowerShell script.
==> Some builds didn't complete successfully and had errors: 2019/05/13 12:37:00 Builds completed. Waiting on interrupt barrier... --> hyperv-iso: Failed creating Hyper-V driver: PowerShell error: CylancePROTECT Script Control has blocked access to this PowerShell script. 2019/05/13 12:37:00 machine readable: error-count []string{"1"}
2019/05/13 12:37:00 ui error: ==> Some builds didn't complete successfully and had errors: ==> Builds finished but no artifacts were created. 2019/05/13 12:37:00 machine readable: hyperv-iso,error []string{"Failed creating Hyper-V driver: PowerShell error: CylancePROTECT Script Control has blocked access to this PowerShell script."} 2019/05/13 12:37:00 ui error: --> hyperv-iso: Failed creating Hyper-V driver: PowerShell error: CylancePROTECT Script Control has blocked access to this PowerShell script. ==> Builds finished but no artifacts were created. 2019/05/13 12:37:00 [INFO] (telemetry) Finalizing. 2019/05/13 12:37:01 waiting for all plugin processes to complete... 2019/05/13 12:37:01 C:\Apps\Bin\packer.exe: plugin process exited