Packer: Hyper-V "enable_dynamic_memory" property has no effect

Created on 12 May 2017  ยท  11Comments  ยท  Source: hashicorp/packer

On Windows 10, packer 1.0.0 building an Ubuntu 16.04.02 LTS box with hyperv-iso builder.

I have run into an issue where I get an error: "PCI: Fatal: No config space access function found". I read somewhere that turning off dynamic memory would fix this. I tried adding the appropriate property as ("enable_dynamic_memory": false,) , but the generated VM is always using dynamic memory.

Gist

bug buildehyperv

Most helpful comment

I confirm - I observed it today - Hyper-V on Windows 10.

If do you need help for PowerShell side of Hyper-V builder please let me know.

All 11 comments

Sorry about not having all the info there.

I confirm - I observed it today - Hyper-V on Windows 10.

If do you need help for PowerShell side of Hyper-V builder please let me know.

I think the code is in place to do it:
https://github.com/hashicorp/packer/blob/master/builder/hyperv/iso/builder.go#L80
https://github.com/hashicorp/packer/blob/master/builder/hyperv/common/step_create_vm.go#L55
https://github.com/hashicorp/packer/blob/master/builder/hyperv/common/driver_ps_4.go#L185
https://github.com/hashicorp/packer/blob/master/common/powershell/hyperv/hyperv.go#L247

The only thing I could think that is going wrong is that the powershell commandlet has not effect.

Please run this from powershell once a machine has been spun up (turn off the vm as well):

Set-VMMemory -VMName $vmName -DynamicMemoryEnabled $enableDynamicMemory

I will take a look at this soon, I've seen this also and found it strange.

I also wanted to point out that for dynamic memory we should consider exposing the Min/Max settings as config parameters for the user. For dynamic memory enabled VMs, StartupBytes is only used during boot up and/or if something goes wrong with the dynamic memory process. This parameter would continue to function as normal, we would just add dynamic_mem_min/max config parameters for the user to control.

@evancox10 can you confirm if Set-VMMemory -VMName $vmName -DynamicMemoryEnabled $enableDynamicMemory has any effect.

Ignore Packer all together.

I think we should be able to specify min and max

So, I created a new "empty" VM, (without using Packer) and the following:
set-vmmemory -vmname testdynamicmemory -dynamicmemoryenabled $true
and
set-vmmemory -vmname testdynamicmemory -dynamicmemoryenabled $false
have the expected effect.

I am on Windows 10 too, version 1703, build 15063.483. Not sure if this is relevant, but my Windows 10 host is itself a VM, a windows-Azure hosted one at that.

On further investigation, it seems this setting can't be changed once the VM is running:

set-vmmemory : Failed to modify device 'Memory'

The Problem is that false is not being set at all.
Code says:
https://github.com/hashicorp/packer/blob/634fd42b99cb2d7a4354739c6cd143ae48e3ccb9/builder/hyperv/common/step_create_vm.go#L54

The same for EnableMacSpoofing and EnableVirtualizationExtensions.
Those only get set if they are true.

Microsoft, in case of dynamic memory, seems to have change the default from false to true, so disabling this again with packer is currently impossible.

Should be fixed now. Can anyone confirm that this works?

@mwhooker: Just had this issue with latest vagrant,
bento/ubuntu image (for hyper-v) and hyper-v and Windows 10 Pro x64.
But it seems to continue booting ('Raise network interfaces').

This ticket's several releases old and is probably referencing a different issue. Can you please open a new issue with full steps to reproduce and debug logs?

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brettswift picture brettswift  ยท  3Comments

Tensho picture Tensho  ยท  3Comments

DanielBo picture DanielBo  ยท  3Comments

shashanksinha89 picture shashanksinha89  ยท  3Comments

wduncanfraser picture wduncanfraser  ยท  3Comments