Skip to content

Bug: Chocolatey 2.0.0 requires .NET Framework 4.8 or higher

When building the win2019-server-x64 template, with the windows.install_additional_tools directive, I was presented with the following error:

TASK [Gathering Facts] *********************************************************
ok: [GOAD-SRV02]

TASK [Add additional tools to Windows VMs] *************************************
included: /opt/ludus/ansible/range-management/tasks/windows/add-additional-windows-tools.yml for GOAD-SRV02

TASK [Test for a chocolatey cache] *********************************************
fatal: [GOAD-SRV02 -> localhost]: FAILED! => {"changed": false, "elapsed": 3, "msg": "Timeout when waiting for 192.0.2.2:8081"}
...ignoring

TASK [Set chocolatey source] ***************************************************
skipping: [GOAD-SRV02]

TASK [Bootstrap chocolatey by hand] ********************************************
skipping: [GOAD-SRV02]

TASK [Install Additional Tools] ************************************************
fatal: [GOAD-SRV02]: FAILED! => {"changed": false, "command": "", "msg": "Chocolatey 2.0.0 requires .NET Framework 4.8 or higher to be installed. Please install .NET Framework 4.8 or higher and try again, or specify a 1.x version of Chocolatey to install.", "rc": 0}

I then attempted removing the template from ludus, pulling updates (commit e06f9d38), rebuilding, and redeploying. This resulted in the same error. Installing .NET Framework 4.8 on the affected system manually solved the issue. Based on discussions in discord, it sounds like the solution will be to either

  • Upgrade .NET to >= 4.8 when using Chocolatey
  • Downgrade Chocolatey to 1.x when encountering .NET < 4.8

Additional details

ludus version

[INFO]  Ludus client v1.6.1+139c252
[INFO]  Ludus Server v1.6.1+139c252

config.yml

ludus:
  - vm_name: "{{ range_id }}-DC01"
    hostname: "{{ range_id }}-DC01"
    template: win2019-server-x64-template
    vlan: 10
    ip_last_octet: 10
    ram_gb: 4
    cpus: 2
    windows:
      sysprep: true
    roles:
      - aleemladha.ludus_wazuh_agent
  - vm_name: "{{ range_id }}-DC02"
    hostname: "{{ range_id }}-DC02"
    template: win2019-server-x64-template
    vlan: 10
    ip_last_octet: 11
    ram_gb: 4
    cpus: 2
    windows:
      sysprep: true
    roles:
      - aleemladha.ludus_wazuh_agent
  - vm_name: "{{ range_id }}-DC03"
    hostname: "{{ range_id }}-DC03"
    template: win2016-server-x64-template
    vlan: 10
    ip_last_octet: 12
    ram_gb: 4
    cpus: 2
    windows:
      sysprep: true
    roles:
      - aleemladha.ludus_wazuh_agent
  - vm_name: "{{ range_id }}-SRV02"
    hostname: "{{ range_id }}-SRV02"
    template: win2019-server-x64-template
    vlan: 10
    ip_last_octet: 22
    ram_gb: 4
    cpus: 2
    windows:
      sysprep: true
      install_additional_tools: true
      visual_studio_version: 2019
    roles:
      - aleemladha.ludus_wazuh_agent
  - vm_name: "{{ range_id }}-SRV03"
    hostname: "{{ range_id }}-SRV03"
    template: win2019-server-x64-template
    vlan: 10
    ip_last_octet: 23
    ram_gb: 4
    cpus: 2
    windows:
      sysprep: true
    roles:
      - aleemladha.ludus_wazuh_agent
  - vm_name: "{{ range_id }}-kali"
    hostname: "{{ range_id }}-kali"
    template: kali-x64-desktop-template
    vlan: 10
    ip_last_octet: 99
    ram_gb: 4
    cpus: 2
    linux: true
    testing:
      snapshot: false
      block_internet: false
  - vm_name: "{{ range_id }}-wazuh"
    hostname: "{{ range_id }}-wazuh"
    template: ubuntu-22.04-x64-server-template
    vlan: 10
    ip_last_octet: 100
    ram_gb: 4
    cpus: 2
    linux: true
    testing:
      snapshot: true
      block_internet: true
    roles:
      - aleemladha.wazuh_server_install
    role_vars:
      wazuh_admin_password: Wazuh-123
Edited by Adam