After provisioning a virtual machine, critical services are failing. The investigation reveals two primary symptoms:
MongoDB Service Failure: The MongoDB service fails to start with a fatal error in the system journal: Main process exited, code=dumped, status=4/ILL. This indicates an Illegal Instruction error.
APT Update Failure: The apt-get update command fails with TLS handshake errors, preventing package management.
The root cause for both issues is that the VM was not configured to expose the host CPU's Advanced Vector Extensions (AVX) instruction set to the guest operating system.
MongoDB 5.0+ has a hard dependency on AVX. Without it, the process attempts to execute unsupported instructions and crashes.
The GNUTLS library (used by apt) may also use AVX instructions. When unsupported, this causes TLS handshake failures.
The solution involves reconfiguring the VM's settings in vSphere to properly expose the host CPU's features (including AVX) to the guest OS.
Before modifying the VM, confirm that the physical host's CPU supports AVX and that it is enabled in the BIOS.
SSH into the ESXi host.
Run the command: esxcli hardware cpu list | grep -i avx
If AVX is listed: The host supports it, and you can proceed to configure the VM.
If AVX is NOT listed: It is likely disabled in the server BIOS. Contact your system administrator to enable the following settings:
IntelĀ® Virtualization Technology (VT-x)
AVX / Advanced Vector Extensions
AVX-512 (optional)
Hyper-Threading (optional but recommended)
AVX exposure requires a sufficiently recent virtual hardware version.
In the vSphere Client, power off the VM.
Right-click the VM and navigate to Compatibility > Upgrade VM Compatibility.
Select a compatibility level supported by your ESXi host (e.g., ESXi 7.0 U3 or later typically uses VM version 15 or higher).
Complete the upgrade process.
There are two methods to expose AVX. Option A (vSphere Client) is recommended.
Option A: Using the vSphere Client (Recommended)
Right-click the powered-off VM and select Edit Settings.
Expand the CPU section.
In Hardware Virtualization, check the box for Expose hardware-assisted virtualization to the guest OS.
Click Advanced Options.
In the CPU Identification Mask section, select the option labeled Expose the full CPU ID to guest (or similar wording like "Expose full hardware features to guest").
Click OK to save the settings.
Option B: Direct .vmx File Edit (Alternative)
If you cannot use the GUI, you can edit the VM's configuration file (.vmx).
Power off the VM.
Locate the VM's .vmx file in its datastore.
Add the following line to the file: cpuid.all = "host"
Save the file.
Power on the VM. Note: A full power cycle (off then on) is required, not a reboot.
Log into the guest operating system (e.g., Linux).
Run the following command to check for AVX support: grep -i avx /proc/cpuinfo
A successful configuration will show flags like avx, avx2, and possibly avx512f in the output.