Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior while installing choco during docker build #3184

Closed
4 tasks done
ramdaspotale opened this issue Jun 1, 2023 · 6 comments
Closed
4 tasks done

Unexpected behavior while installing choco during docker build #3184

ramdaspotale opened this issue Jun 1, 2023 · 6 comments

Comments

@ramdaspotale
Copy link

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.

What You Are Seeing?

I am trying to install Chocolatey and then some packages with chocolatey during docker build on windows-2019 ltsc server code image. but i am facing below problem where chocolatey package is installing .NET 4.8 which subsequently asking for reboot which is not possible during docker build. Please help

`Step 7/26 : RUN set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); cmd /c choco install -y axel --params "'/InstallDir:C:\axel'"; cmd /c choco install -y prometheus-windows-exporter.install --version=0.16.0;
---> Running in 38af4cc4f032
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0 to C:\Users\CONTAI1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\CONTAI
1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\CONTAI1\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local machine
The registry key for .Net 4.8 was not found or this is forced
Downloading 'https://download.visualstudio.microsoft.com/download/pr/2d6bb6b2-226a-4baa-bdec-798822606ff1/8494001c276a4b96804cde7829c04d7f/ndp48-x86-x64-allos-enu.exe' to 'C:\Users\CONTAI
1\AppData\Local\Temp\ndp48-x86-x64-allos-enu.exe' - the installer is 100+ MBs, so this could take a while on a slow connection.
Installing 'C:\Users\CONTAI~1\AppData\Local\Temp\ndp48-x86-x64-allos-enu.exe' - this may take awhile with no output.
.NET Framework 4.8 was installed, but a reboot is required.
Please reboot the system and try to install/upgrade Chocolatey again.
At C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey\chocoInstall\t
ools\chocolateysetup.psm1:815 char:11

  •       throw ".NET Framework 4.8 was installed, but a reboot is re ...
    
  •       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (.NET Framework ...ocolatey ag
      ain.:String) [], RuntimeException
    • FullyQualifiedErrorId : .NET Framework 4.8 was installed, but a reboot i
      s required.
      Please reboot the system and try to install/upgrade Chocolatey again.
      `

What is Expected?

Docker build succeeds without any such issues during chocolatey install.

How Did You Get This To Happen?

Below is part of Dockerfile i am using where i get this error

`FROM fluent/fluentd:v1.14.5-windows-ltsc2019-1.0 as fluent-base

RUN ridk exec gem install fluent-plugin-windows-eventlog
&& ridk exec gem install nokogiri
&& ridk exec gem install fluent-plugin-multi-format-parser
&& ridk exec gem install fluent-plugin-rewrite-tag-filter
&& ridk exec gem install fluent-plugin-parser-winevt_xml

ltsc2019 'tag' is updated with latest security patches every 2nd Tuesday of the month https://hub.docker.com/_/microsoft-windows-servercore

FROM mcr.microsoft.com/windows/servercore:ltsc2019

COPY --from=fluent-base /ruby27 /ruby27
RUN setx /M PATH "%PATH%;C:\ruby27\bin"

SHELL ["powershell", "-command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
cmd /c choco install -y axel --params "'/InstallDir:C:\axel'";
cmd /c choco install -y prometheus-windows-exporter.install --version=0.16.0; `

System Details

  • Operating System: windows 2019 ltsc
  • Windows PowerShell version: not sure
  • Chocolatey CLI Version: not sure but i guess 2.0 from logs
  • Chocolatey Licensed Extension version: not sure but i guess 2.0 from logs
  • Chocolatey License type: not sure
  • Terminal/Emulator: powershell

Installed Packages

i can not see existing installed package on azure hosted build agents...but i have pasted Dockerfile i am using which should be enough i think

Output Log

---> Running in 43c92a37a2e0

SUCCESS: Specified value was saved.
Removing intermediate container 43c92a37a2e0
 ---> 19454acb2ac9
Step 6/26 : SHELL ["powershell", "-command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
 ---> Running in cb54b4b2be65
Removing intermediate container cb54b4b2be65
 ---> 196e575b0049
Step 7/26 : RUN set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));     cmd /c choco install -y axel --params "'/InstallDir:C:\axel'";     cmd /c choco install -y prometheus-windows-exporter.install --version=0.16.0;
 ---> Running in 38af4cc4f032
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0 to C:\Users\CONTAI~1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\CONTAI~1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\CONTAI~1\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local machine
The registry key for .Net 4.8 was not found or this is forced
Downloading 'https://download.visualstudio.microsoft.com/download/pr/2d6bb6b2-226a-4baa-bdec-798822606ff1/8494001c276a4b96804cde7829c04d7f/ndp48-x86-x64-allos-enu.exe' to 'C:\Users\CONTAI~1\AppData\Local\Temp\ndp48-x86-x64-allos-enu.exe' - the installer is 100+ MBs, so this could take a while on a slow connection.
Installing 'C:\Users\CONTAI~1\AppData\Local\Temp\ndp48-x86-x64-allos-enu.exe' - this may take awhile with no output.
.NET Framework 4.8 was installed, but a reboot is required. 
 Please reboot the system and try to install/upgrade Chocolatey again.
At C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey\chocoInstall\t
ools\chocolateysetup.psm1:815 char:11
+           throw ".NET Framework 4.8 was installed, but a reboot is re ...
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (.NET Framework ...ocolatey ag 
   ain.:String) [], RuntimeException
    + FullyQualifiedErrorId : .NET Framework 4.8 was installed, but a reboot i 
   s required. 
 Please reboot the system and try to install/upgrade Chocolatey again.
 
The command 'powershell -command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));     cmd /c choco install -y axel --params "'/InstallDir:C:\axel'";     cmd /c choco install -y prometheus-windows-exporter.install --version=0.16.0;' returned a non-zero code: 1
##[error]The process 'C:\Windows\system32\docker.exe' failed with exit code 1
Finishing: Build and push an image to container registry

Additional Context

No response

@ramdaspotale
Copy link
Author

Looks like this is happening because of #2738

@pauby
Copy link
Member

pauby commented Jun 1, 2023

Please see the upgrade guide, specifically for the .NET 4.8 requirement. If you are using Docker, please use a Container that has .NET 4.8 installed or use the official Chocolatey Docker image.

@pauby
Copy link
Member

pauby commented Jun 1, 2023

The documentation was updated earlier to specifically mention Docker. As there is nothing more for us to do here
I'm going to go ahead and close this, but we can reopen it if necessary.

@pauby pauby closed this as completed Jun 1, 2023
@slonopotamus
Copy link

slonopotamus commented Jun 1, 2023

At least for ue4-docker, using Chocolatey Docker image is not an option because we need multiple different base Windows Core images (ltsc2019, ltsc2022 and others).

I will later investigate the way official .NET 4.8 images install .NET so that it doesn't trigger this reboot exception. Possibly it can be integrated into Chocolatey.

For now, we're locking Chocolatey to 1.4.0: adamrehn/ue4-docker#323

slonopotamus added a commit to slonopotamus/ue4-docker that referenced this issue Jun 1, 2023
This is a workaround for chocolatey/choco#3184:
Chocolatey 2.0.0 switched to .NET 4.8, but it throws an exception requiring a rebbot.
@pauby pauby closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2023
slonopotamus added a commit to slonopotamus/ue4-docker that referenced this issue Jun 1, 2023
This is a workaround for chocolatey/choco#3184:
Chocolatey 2.0.0 switched to .NET 4.8, but it throws an exception requiring a rebbot.
slonopotamus added a commit to adamrehn/ue4-docker that referenced this issue Jun 1, 2023
This is a workaround for chocolatey/choco#3184:
Chocolatey 2.0.0 switched to .NET 4.8, but it throws an exception requiring a reboot.
@loganhang
Copy link

loganhang commented Jun 5, 2023

workaround method, Install the specified version, do not use the latest version:

- name: Install chocolatey
  chocolatey.chocolatey.win_chocolatey:
    name: chocolatey
    version: '0.10.11'

@pauby
Copy link
Member

pauby commented Jun 5, 2023

That is Ansible code and not applicable here.

Chocolatey CLI 0.10.11 was released in May 2018 and is not supported. We don't recommend to use it.

If you cannot use 2.0.0, use 1.4.0.

@chocolatey chocolatey locked and limited conversation to collaborators Jun 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants