chocolatey-community / chocolatey-test-environment

A testing setup related to how the Chocolatey Package Verifier runs testing. Used for manual testing or prior to submission
Apache License 2.0
118 stars 186 forks source link

Support dotnet3.5 and other server features #12

Open AnthonyMastrean opened 8 years ago

AnthonyMastrean commented 8 years ago

I have a package that depends on the dotnet3.5 package, which uses DISM, as it's a "feature" of most Windows versions now. However, it fails dramatically on this box. I'll snip around the nasty XML output that's dumped to the console.

> choco install -y dotnet3.5
...

Deployment Image Servicing and Management tool
Version: 6.3.9600.16384

Image Version: 6.3.9600.16384

Enabling feature(s)

Error: 0x800f0906

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 informa
tion on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.
...

ERROR: Running ["C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" cmd.exe /c DISM /Online /NoRestart /Enable-
Feature /FeatureName:NetFx3] was not successful. Exit code was '1'. See log for possible error messages.
The install of dotnet3.5 was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\DotNet3.5\Tools\ChocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 0/1 package(s). 1 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures:
 - dotnet3.5 (exit code 1)

When I log onto the box and try to enable the feature manually, I get a similar nasty error.

image

And

[127.0.0.1]: PS C:\Users\Administrator\Documents> Add-WindowsFeature Net-Framework-Core
Add-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
    + 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         {}

Looks like it was specifically removed from the box? Maybe it's removed by default.

[127.0.0.1]: PS C:\Users\Administrator\Documents> Get-WindowsFeature Net-Framework-Core

Display Name                                            Name                       Install State
------------                                            ----                       -------------
    [ ] .NET Framework 3.5 (includes .NET 2.0 and 3.0)  NET-Framework-Core               Removed

I can set a source manually if I have the install media (I don't, I guess I could download it). I don't know if the dotnet3.5 package supports alternate sources.

Should we install this feature by default or leave the sources on the local disk or something?

ferventcoder commented 8 years ago

This is a known issue related to this source. The .NET 3.5 package should not use DISM if possible.

dazinator commented 6 years ago

I am attempting to install the dotnet3.5 choco package within a latest-windowsservercore docker container.

It fails with:

The install of dotnet3.5 was NOT successful. Error while running 'c:\choco\lib\DotNet3.5\Tools\ChocolateyInstall.ps1'. See log for details. Chocolatey installed 0/1 packages. 1 packages failed. See the log for details (c:\choco\logs\chocolatey.log).

And more info from the logs

2018-05-11 17:29:55,598 3068 [DEBUG] - Running Start-ChocolateyProcessAsAdmin -minimized 'True' -noSleep 'True' -validExitCodes '0' -statements 'cmd.exe /c DISM /Online /NoRestart /Enable-Feature /FeatureName:NetFx3' 2018-05-11 17:29:55,598 3068 [DEBUG] - Test-ProcessAdminRights: returning True 2018-05-11 17:29:55,598 3068 [DEBUG] - Elevating permissions and running powershell block: $noSleep = $True

$env:ChocolateyEnvironmentDebug='false'

$env:ChocolateyEnvironmentVerbose='false'

& import-module -name 'C:\choco\helpers\chocolateyInstaller.psm1' -Verbose:$false | Out-Null; try{ $progressPreference="SilentlyContinue" cmd.exe /c DISM /Online /NoRestart /Enable-Feature /FeatureName:NetFx3 if(!$noSleep){start-sleep 6} } catch{ if(!$noSleep){start-sleep 8} throw } This may take a while, depending on the statements. 2018-05-11 17:29:57,617 3068 [ERROR] - #< CLIXML 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: Deployment Image Servicing and Management tool 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: Version: 10.0.14393.0 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: Image Version: 10.0.14393.0 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: Enabling feature(s) 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: [ 0.1% ] 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: [ 1.1% ] 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: [==========================100.0%==========================] 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: Error: 0x800f081f 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: The source files could not be found. 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 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. 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: 2018-05-11 17:29:57,617 3068 [INFO ] - VERBOSE: The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

I am wondering - is there an alternative approach to accomplishing this, or is mounting the sources the only option?

dazinator commented 6 years ago

I tried extarcting C:\Sources\sxs from the windows ISO, and then mounting it to d:\sources\sxs on the container. This results in the following:

he 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 found. 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: 0x800f081f

  • CategoryInfo : InvalidOperation: (@{Vhd=; Credent...Name=localh ost}:) [], CimException
  • FullyQualifiedErrorId : DISMAPI_Error__Failed_To_Enable_Updates,Microsof t.Windows.ServerManager.Commands.AddWindowsFeatureCommand
  • PSComputerName : localhost
dazinator commented 6 years ago

In the end I managed to get it to install by bypassing the choco package. It seems the choco package expects the sources to be located at D:/Sources/sxs however I wasn't able to mount a volume to that location in the container for some reason. In the end I managed to get it installed by bypassing the choco package and doing the following:

  1. Extract the cab file from the windows server 2016 iso at: c:/sources/sxs/ and add it to the docker image at the same location,
  2. DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:C:\sources\sxs