mwrock / packer-templates

Templates for creating vagrant boxes
Other
535 stars 250 forks source link

mwrock/Windows2012R2 box: "The source files could not be downloaded." #102

Closed techraf closed 6 years ago

techraf commented 6 years ago

I'm lost with mwrock/Windows2012R2 and mwrock/Windows2016 Vagrant boxes.

When I try to Install-WindowsFeature AD-Domain-Services (or with GUI) immediately after vagrant up, I get an error about source files not available. I tried pointing to an ISO image with OS installation to no avail.

Do you mind suggesting how to add the feature?

(I know there was mwrock/Windows2012R2Full, but it's pointing to a wrong address now, so couldn't try).

This is how it looks:

PS C:\Windows\system32> Install-WindowsFeature AD-Domain-Services
Install-WindowsFeature : The request to add or remove features on the specified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be downloaded.
Use the "source" option to specify the location of the files that are required to restore the feature. For more
information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f0906
At line:1 char:1
+ Install-WindowsFeature AD-Domain-Services
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (@{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature],
    Exception
    + FullyQualifiedErrorId : DISMAPI_Error__Cbs_Download_Failure,Microsoft.Windows.ServerManager.Commands.AddWindowsF
   eatureCommand

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
False   No             Failed         {}
mwrock commented 6 years ago

These packer builds explicitly remove all unused features from disk to optimize for a small box file. This can indeed be problematic for some features that cannot install themselves via windows update. The best way way to mitigate this problem if you intend to use some features after image install is to change the removal script to leave the features you want or to completely remove that part of the script to keep all features.