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

Error on Windows Server build during chocolatey installation #585

Closed
1 task done
Kennochas opened this issue Jun 15, 2023 · 8 comments · Fixed by #586
Closed
1 task done

Error on Windows Server build during chocolatey installation #585

Kennochas opened this issue Jun 15, 2023 · 8 comments · Fixed by #586
Labels
Milestone

Comments

@Kennochas
Copy link

Code of Conduct

  • I have read and agree to the project's Code of Conduct.

Project Version

main

VMware vSphere

7

HashiCorp Packer

1.8.2

HashiCorp Packer Plugin for VMware vSphere

1.0.6

Guest Operating System

Windows Server

Environment Details

No response

Description

It seems like something happened upstream with chocolatey, where .NET Framework 4.8 is required now, and breaks the current method the install uses

Chocolatey installs it in chocolateysetup.psm1 via the function Install-DotNet48IfMissing, then returns that a reboot is required.

Expected Behavior

Image built

Actual Behavior

==> vsphere-iso.windows-server-standard-core: Provisioning with powershell script: /tmp/powershell-provisioner1242506124
vsphere-iso.windows-server-standard-core: Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
vsphere-iso.windows-server-standard-core: Getting latest version of the Chocolatey package for download.
vsphere-iso.windows-server-standard-core: Not using proxy.
vsphere-iso.windows-server-standard-core: Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0.
vsphere-iso.windows-server-standard-core: Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0 to C:\Users\admin1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
vsphere-iso.windows-server-standard-core: Not using proxy.
vsphere-iso.windows-server-standard-core: Extracting C:\Users\admin
1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\admin1\AppData\Local\Temp\chocolatey\chocoInstall
vsphere-iso.windows-server-standard-core: Installing Chocolatey on the local machine
vsphere-iso.windows-server-standard-core: The registry key for .Net 4.8 was not found or this is forced
vsphere-iso.windows-server-standard-core: Downloading 'https://download.visualstudio.microsoft.com/download/pr/2d6bb6b2-226a-4baa-bdec-798822606ff1/8494001c276a4b96804cde7829c04d7f/ndp48-x86-x64-allos-enu.exe' to 'C:\Users\admin
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.
vsphere-iso.windows-server-standard-core: Installing 'C:\Users\admin~1\AppData\Local\Temp\ndp48-x86-x64-allos-enu.exe' - this may take awhile with no output.
vsphere-iso.windows-server-standard-core: .NET Framework 4.8 was installed, but a reboot is required.
vsphere-iso.windows-server-standard-core: Please reboot the system and try to install/upgrade Chocolatey again.
vsphere-iso.windows-server-standard-core: At C:\Users<sensitive>\AppData\Local\Temp\chocolatey\chocoInstall\tools\chocolateysetup.psm1:815 char:11
vsphere-iso.windows-server-standard-core: + throw ".NET Framework 4.8 was installed, but a reboot is re ...
vsphere-iso.windows-server-standard-core: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vsphere-iso.windows-server-standard-core: + CategoryInfo : OperationStopped: (.NET Framework ...ocolatey again.:String) [], RuntimeException
vsphere-iso.windows-server-standard-core: + FullyQualifiedErrorId : .NET Framework 4.8 was installed, but a reboot is required.
vsphere-iso.windows-server-standard-core: Please reboot the system and try to install/upgrade Chocolatey again.
vsphere-iso.windows-server-standard-core:
==> vsphere-iso.windows-server-standard-core: Provisioning step had errors: Running the cleanup provisioner, if present...
==> vsphere-iso.windows-server-standard-core: Power off VM...
==> vsphere-iso.windows-server-standard-core: Destroying VM...
==> vsphere-iso.windows-server-standard-core: Deleting cd_files image from remote datastore ...
Build 'vsphere-iso.windows-server-standard-core' errored after 12 minutes 57 seconds: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

Steps to Reproduce

Try to build server 2019 or if you still have 2016, it fails too.

Log Fragments and Files

==> vsphere-iso.windows-server-standard-core: Provisioning with powershell script: /tmp/powershell-provisioner1242506124
    vsphere-iso.windows-server-standard-core: Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
    vsphere-iso.windows-server-standard-core: Getting latest version of the Chocolatey package for download.
    vsphere-iso.windows-server-standard-core: Not using proxy.
    vsphere-iso.windows-server-standard-core: Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0.
    vsphere-iso.windows-server-standard-core: Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0 to C:\Users\admin~1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
    vsphere-iso.windows-server-standard-core: Not using proxy.
    vsphere-iso.windows-server-standard-core: Extracting C:\Users\admin~1\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\admin~1\AppData\Local\Temp\chocolatey\chocoInstall
    vsphere-iso.windows-server-standard-core: Installing Chocolatey on the local machine
    vsphere-iso.windows-server-standard-core: The registry key for .Net 4.8 was not found or this is forced
    vsphere-iso.windows-server-standard-core: Downloading 'https://download.visualstudio.microsoft.com/download/pr/2d6bb6b2-226a-4baa-bdec-798822606ff1/8494001c276a4b96804cde7829c04d7f/ndp48-x86-x64-allos-enu.exe' to 'C:\Users\admin~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.
    vsphere-iso.windows-server-standard-core: Installing 'C:\Users\admin~1\AppData\Local\Temp\ndp48-x86-x64-allos-enu.exe' - this may take awhile with no output.
    vsphere-iso.windows-server-standard-core: .NET Framework 4.8 was installed, but a reboot is required.
    vsphere-iso.windows-server-standard-core:  Please reboot the system and try to install/upgrade Chocolatey again.
    vsphere-iso.windows-server-standard-core: At C:\Users\<sensitive>\AppData\Local\Temp\chocolatey\chocoInstall\tools\chocolateysetup.psm1:815 char:11
    vsphere-iso.windows-server-standard-core: +           throw ".NET Framework 4.8 was installed, but a reboot is re ...
    vsphere-iso.windows-server-standard-core: +           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    vsphere-iso.windows-server-standard-core:     + CategoryInfo          : OperationStopped: (.NET Framework ...ocolatey again.:String) [], RuntimeException
    vsphere-iso.windows-server-standard-core:     + FullyQualifiedErrorId : .NET Framework 4.8 was installed, but a reboot is required.
    vsphere-iso.windows-server-standard-core:  Please reboot the system and try to install/upgrade Chocolatey again.
    vsphere-iso.windows-server-standard-core:
==> vsphere-iso.windows-server-standard-core: Provisioning step had errors: Running the cleanup provisioner, if present...
==> vsphere-iso.windows-server-standard-core: Power off VM...
==> vsphere-iso.windows-server-standard-core: Destroying VM...
==> vsphere-iso.windows-server-standard-core: Deleting cd_files image from remote datastore ...
Build 'vsphere-iso.windows-server-standard-core' errored after 12 minutes 57 seconds: Script exited with non-zero exit status: 1. Allowed exit codes are: [0]

Screenshots

No response

Additional Context

No response

@github-actions
Copy link

Hello, Kennochas! 🖐

Thank you for your submitting an issue for the project. We will respond soon.

If you want to contribute to this project, please review the contributing guidelines.

@tenthirtyam
Copy link
Collaborator

I looks like chocolatey changed the install source...

From: https://chocolatey.org/install.ps1

To: https://community.chocolatey.org/install.ps1

Mind testing that?

@tenthirtyam tenthirtyam removed the status/needs-triage Needs Triage label Jun 15, 2023
@tenthirtyam tenthirtyam added this to the .Next milestone Jun 15, 2023
@tenthirtyam tenthirtyam changed the title Windows Server Issues w/chocolatey Error on Windows Server build during chocolatey installation Jun 15, 2023
@tenthirtyam
Copy link
Collaborator

tenthirtyam commented Jun 15, 2023

Please note that the main branch has higher requirements than those provided.

@Kennochas
Copy link
Author

Both of those URL's work, and actually go to the same file.

@tenthirtyam tenthirtyam added the status/needs-triage Needs Triage label Jun 15, 2023
@Kennochas
Copy link
Author

You can see it more, if you open https://community.chocolatey.org/api/v2/package/chocolatey and dig into the package for the chocolateysetup.psm1 file.

https://docs.chocolatey.org/en-us/choco/release-notes

under breaking changes: Upgrade to target version 4.8 of the .NET Framework - see #2738.

@tenthirtyam
Copy link
Collaborator

Thanks for the issue. I'll take a look but may remove chocolatey from main for the next release.

One option might be to test flipping the following so that updates occur first - not sure if that will resolve the issue however.

  provisioner "windows-update" {
    pause_before    = "30s"
    search_criteria = "IsInstalled=0"
    filters = [
      "exclude:$_.Title -like '*VMware*'",
      "exclude:$_.Title -like '*Preview*'",
      "exclude:$_.Title -like '*Defender*'",
      "exclude:$_.InstallationBehavior.CanRequestUserInput",
      "include:$true"
    ]
    restart_timeout = "120m"
  }

  provisioner "powershell" {
    elevated_user     = var.build_username
    elevated_password = var.build_password
    inline            = var.inline
  }

@Kennochas
Copy link
Author

Yea, I personally just commented out Chocolatey.

Another way that I know for sure you could do, is use ansible to provision the .net 4.8 and reboot if required, and then install chocolatey.

tenthirtyam pushed a commit that referenced this issue Jun 15, 2023
Removes the installation of Chocolatey from the Microsoft Windows guest operating system builds. .Net 4.8 is required before installation. This can be managed by the user instead of this project.

Ref: #585

Signed-off-by: Ryan Johnson <[email protected]>
tenthirtyam pushed a commit that referenced this issue Jun 15, 2023
Removes the installation of Chocolatey from the Microsoft Windows guest operating system builds. .Net 4.8 is required before installation. This can be managed by the user instead of this project.

Ref: #585

Signed-off-by: Ryan Johnson <[email protected]>
tenthirtyam pushed a commit that referenced this issue Jun 15, 2023
Removes the installation of Chocolatey from the Microsoft Windows guest operating system builds. .Net 4.8 is required before installation. This can be managed by the user instead of this project.

Ref: #585

Signed-off-by: Ryan Johnson <[email protected]>
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants