Chocolatey Failing to deploy

Support and questions for using and managing Chocolatey NuGet inside of Labtech
bfrizie
Posts: 9
Joined: Mon Nov 05, 2018 2:38 pm
5

Chocolatey Failing to deploy

Post by bfrizie »

I just installed Chocolatey 3.0.0.39 and I am seeing about a 90% failure rate with the Chocatey.exe automatic deployment.

The script logs show the following:
cmd.exe!!! /c "@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\choc
Chocolatey EXE not found- Install failed

I created a custom script and can execute the batch script as admin and the installation works. Is there a fix for the automatic deployment of Chocolatey?

User avatar
Cubert
Posts: 2432
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Chocolatey Failing to deploy

Post by Cubert »

The Script executes the commands as shown, waits 30 seconds for completion then tests the 2 locations to see if it can see the Choco EXE.

So first we need to see what the return was from the install POSH command was in the agents script logs then see / verify if the choco EXE exists anywhere on agent. It may have placed it else where, which would cause failure from file check.


Capture.PNG
Capture.PNG (25.96 KiB) Viewed 6721 times

Post back here your script logs for the following shell command in step 5

bfrizie
Posts: 9
Joined: Mon Nov 05, 2018 2:38 pm
5

Re: Chocolatey Failing to deploy

Post by bfrizie »

Here are the command and script logs from the agent:

Command Logs -
cmd.exe!!! /c "@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\choc

0|C:\ProgramData\chocolatey\bin\choco.exe-File or Directory Does Not Exist

0|C:\Documents and Settings\All Users\Application Data\chocolatey\choco.exe-File or Directory Does Not Exist

Chocolatey EXE not found- Install failed

The Script(6375) was successful in the Then section.

User avatar
Cubert
Posts: 2432
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Chocolatey Failing to deploy

Post by Cubert »

I failed to mention it but can I also get the command log entry for the same time period?


Capture.PNG
Capture.PNG (25.83 KiB) Viewed 6688 times




The log I am most interested in is the Executing log entry for the powershell cmd being run to install Chocolatey.

It should look like this although in this example the command is to Chocolatey features scan but the log type is the same. We need to see what the agent returned when the install command was executed.

Capture1.PNG
Capture1.PNG (48.65 KiB) Viewed 6688 times

bfrizie
Posts: 9
Joined: Mon Nov 05, 2018 2:38 pm
5

Re: Chocolatey Failing to deploy

Post by bfrizie »

I can run this command from an elevated command prompt and it will work
powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

The script commands fail with the following error
ERROR: The system cannot find the file specified.
C:\WINDOWS\TEMP\chocolatey\chocInstall\chocolatey.zip



System ERROR:
The system cannot find the file specified.
Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install
again. Error: 7-Zip encountered a fatal error while extracting the files
At line:216 char:9
+ 2 { throw "$errorMessage 7-Zip encountered a fatal error while ex ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to unzip...cting the files:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompres
sion = 'true' and call install again. Error: 7-Zip encountered a fatal error while extracting the files

Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/c ... ey/0.10.15.
Downloading 7-Zip commandline tool prior to extraction.
Extracting C:\WINDOWS\TEMP\chocolatey\chocInstall\chocolatey.zip to C:\WINDOWS\TEMP\chocolatey\chocInstall...

bfrizie
Posts: 9
Joined: Mon Nov 05, 2018 2:38 pm
5

Re: Chocolatey Failing to deploy

Post by bfrizie »

Any updates on this?

User avatar
Cubert
Posts: 2432
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Chocolatey Failing to deploy

Post by Cubert »

Yes, I am reviewing this now..


Everything inside the Execute command is preformed by POSH being executed. Our command just sends POSH the URL to start the process.

Something is preventing the download of the choco zip file. It sees the URL and tries but fails to save file from what it looks like as when it tries to unzip it its not there.

So either AV is locking and removing the file or possible permissions issue with whom the agents LTsvc runs as or it truly could not get download from URL.

Can you send me the specs to the agent in question?

OS type, build number etc...

My next thought is to run installer and monitor the C:Windows\TEMP directory for file to appear. Does it ? Check the Windows logs for security failures.

Let us know what you find, meanwhile we will try to duplicate the issue here to see if we can explain it.

bfrizie
Posts: 9
Joined: Mon Nov 05, 2018 2:38 pm
5

Re: Chocolatey Failing to deploy

Post by bfrizie »

This appears to be related to a TLS and Windows update problem.

I tried running this command from Powershell:
powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\choc

And was receiving an error in Powershell - Could not create SSL/TLS secure channel

I eventually found this article: https://workconsultants.com/blog/powers ... e-channel/
After applying the registry key manually, I could run powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"

So my next question, is it okay for me to add the registry key to the function script?

On a related note, I am encountering this issue on machines running Windows 10 .0.19041 and Server 2016 10.0.14393

User avatar
Cubert
Posts: 2432
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Chocolatey Failing to deploy

Post by Cubert »

Hmmm...

What I can do is make a test for this error and if positive it adds the regkey and retries install commands again.

That way it only goes out to agents that show the issue and not blanket all agents with changes.

I should probably add a switch the "enables" this setting so you have an override to this feature incase you want to opt out.

User avatar
Cubert
Posts: 2432
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Chocolatey Failing to deploy

Post by Cubert »

Ok we are updating to 3.0.0.40

Inside is several little changes.


Under the global manager tool there is a new check box to allow override of the TLS/SSL fix.

Capture.PNG
Capture.PNG (47.76 KiB) Viewed 6506 times


Then if the script fails with file not found it will attempt a TLS correction in registry if the previous checkbox is selected.

Capture1.PNG
Capture1.PNG (36.33 KiB) Viewed 6506 times

After the fix is applied it will reattempt a chocolatey install one more time during script run.

This update will go out tonight as an auto update to the plugin and a link in your subscriptions manager on our website will be available for DLL downloads manually.

Post Reply

Return to “Chocolatey For Labtech”