Vmx hacks: Difference between revisions

From VI-Toolkit
Jump to navigation Jump to search
Player - disable mitigations
 
(5 intermediate revisions by the same user not shown)
Line 185: Line 185:


==== Linux Host - switch back from Vulkan to X11 ====
==== Linux Host - switch back from Vulkan to X11 ====
Workstation 16.x and higher
Workstation 16.2.0 and higher


Add to .vmx if changing for one VM, or ~/.vmware/config if you want to change this systemwide:
Add to .vmx if changing for one VM, or ~/.vmware/config if you want to change this systemwide:
Line 199: Line 199:
Has a great explanation on the difference by banackm
Has a great explanation on the difference by banackm


=== Dark Mode ===
Beware that if you have this issue -and your host has more than one GPU- that it also might be because the wrong GPU was selected for Vulkan.
 
There's another switch to use the openGL renderer instead of Vulkan:
 
mks.enableVulkanRenderer = "FALSE"
mks.enableGLRenderer = "TRUE"
 
and a switch to allow the Vulkan rendered use unsupported devices:
 
mks.vk.allowUnsupportedDevices = "TRUE"
 
There's even a way to force your VM to use a specific GPU, such as the discrete GPU instead of the integrated GPU.. if your host has both.
 
mks.forceDiscreteGPU = "TRUE"
 
See the tips from BlueFireStorm here: [https://communities.vmware.com/t5/VMware-Workstation-Pro/VMware-Workstation-cannot-connect-to-the-virtual-machine-Vmware/m-p/2899481/highlight/true#M174703 VMware Workstation cannot connect to the virtual machine]
 
==== Dark Mode ====


In Workstation 16.2 Dark Mode had disappeared by accident, it was discovered that adding the following setting to the preferences.ini file makes it re-appear.
In Workstation 16.2 Dark Mode had disappeared by accident, it was discovered that adding the following setting to the preferences.ini file makes it re-appear.
Line 206: Line 223:


from: [https://communities.vmware.com/t5/VMware-Workstation-Pro/Vmware-Workstation-16-2-dark-mode/m-p/2874723/highlight/true#M172025 forum user mrdow2000]
from: [https://communities.vmware.com/t5/VMware-Workstation-Pro/Vmware-Workstation-16-2-dark-mode/m-p/2874723/highlight/true#M172025 forum user mrdow2000]
==== All USB devices are disabled ====
Check your .vmx file for the following line:
usb.restrictions.defaultAllow = "FALSE"
If it has this then remove that line and try again.
It seems that this line is automatically added for Workstation/Player 16.2.x when using "Easy Setup".
More details here: [https://communities.vmware.com/t5/VMware-Workstation-Player/All-USB-devices-are-greyed-out/m-p/2878067#M37999 All USB devices are greyed out]
=== VMware Player ===
==== Disable mitigations ====
A message about disabling side channel mitigations shows up only when the ULM is used instead of the ring 0 VMM as the hypervisor monitor.
That means the Windows host has been detected to have Hyper-V enabled.
https://blogs.vmware.com/workstation/2020/05/vmware-workstation-now-supports-hyper-v-mode.html
There is no advanced options in VMware Workstation Player.
To disable the side channel mitigation, shut down the VM and add the following to the VM vmx configuration file.
ulm.disableMitigations = "TRUE"
from: [https://communities.vmware.com/t5/VMware-Workstation-Player/Poor-performance-after-update-with-message-about-side-channel/m-p/2811455/highlight/true#M35855 Poor performance after update with message about side channel mitigation]


=== Fusion ===
=== Fusion ===
Line 412: Line 459:


=== Any platform ===
=== Any platform ===
==== Disable scoreboard files ====
In VMware Fusion 12.2 and Workstation 16.2 new files have been introduced for keeping some sort of statistics.
These are called scoreboard files.
You can disable that feature.
vmx.scoreboard.enabled = "FALSE"
See: [https://communities.vmware.com/t5/VMware-Workstation-Pro/VMware-Workstation-16-2-0-and-scoreboard-files-What-it-is/m-p/2881784/highlight/true#M172906 Suggestion by DaveP on VMware Workstation 16.2.0 and .scoreboard files. What is it?]


==== Slow down time in guest ====
==== Slow down time in guest ====

Latest revision as of 11:10, 18 July 2022

VMX hacks

Here's my internal list of the .vmx hacks that I collected over time.

Beware that editing a .vmx file manually and adding any of these options is unsupported.

If you end up breaking your VM by editing the .vmx ... then restore the backup! (If you had no backups before hacking on your config, you are doing something wrong)

Also note that some options might no longer be active as they might be for an earlier version of a VMware product.

Wait 5 seconds on booting

Wait 5 seconds on booting:

bios.bootDelay = "5000"

Time is in milliseconds, change it accordingly.

Open BIOS settings on next boot

Open BIOS settings on next boot:

bios.forceSetupOnce = "TRUE"

In VMware Server 2, this setting is also in the web management interface, choose "Configure VM", power tabdialog, near the bottom.

Automatically Connecting USB Devices at Virtual Machine Power On

Disable all Power menu and keyboard shortcuts

gui.restricted="true" 

This disables all power menu and keyboard shortcuts. It also disables suspend button

Fix repeating keys

To reduce these effects, increase the time threshold necessary for auto-repeat in the remote console.

   Power off the virtual machine.
   Add a line, similar to this, at the end of your virtual machine's configuration (.vmx) file:
   keyboard.typematicMinDelay = "2000000"
   The delay is specified in micro-seconds, so the line in the example above increases the repeat time to 2 seconds. This should ensure that you never get auto-repeat unless you intend it. 

Repeated characters when typing in remote console

Disables suspend option

suspend.disabled = "TRUE"

This disables the suspend option in a virtual machine.

Fix Caps Lock synchronisation issues

This tip fixes the caps lock sync issue in Fusion 2.0.x and Tech Preview. I found it to be invaluable, add this to your VM's configuration file (.vmx):

mks.keyboard.syncLEDs = "TRUE"

Run a VM without a suspend file

isn't there an option to run a VM without a suspend file (which is a file named like abcdef01-abcd-abcd-abcd-abcdef012345.vmem) you mean

mainmem.useNamedFile = "false"

only works in windows

Use FT in a VM under Workstation

To use FT in a nested VM, you will still have to supply the entirely unsupported option (for the inner VM):

replay.allowBTOnly = "TRUE"

VMTN Anyone had sucess setting up a ESX40 Lab on Workstation 7.0?

Disable VIX

An interesting tidbit if you’re super security cautious you can disable VIX by adding

“Guest.Command.Enabled”=”False”

to either the VM or the host. Be aware that this WILL break upgrading of VMware tools, and Guest customization as they both use vix as the underlying technology!

Optimize performance linux VM

mainmem.useNamedFile is no longer longer used on Linux hosts that run VMplayer 3 or Workstation 7.

New parameters are :

mainmem.backing = "swap"
mainmem.backing = "named"
mainmem.backing = "unnamed"

see http://sanbarrow.com/vmx/vmx-advanced.html#mainmem

Optimize troubleshooting

Please power off your VM and add the following configuration option to your .vmx file:

vmx.buildType = stats

Boot the VM and run your benchmark. Shut down the VM and send me the contents of the stats directory that will be created in the same folder as the VM.

from: https://communities.vmware.com/message/2408159#2408159

Hardening your vmx file for security

http://virtualfoundry.blogspot.com/2009/04/hardening-vmx-file.html

Spurious APIC interrupt on CPU#1, should never happen

These messages are the result of an optimization Workstation 11 uses for inter-processor interrupts between virtual CPUs. The interrupt vector used for this purpose is 0xff, which is the Linux spurious APIC interrupt vector. In some cases, an inter-processor interrupt may arrive on a physical processor after Workstation has relinquished the processor to the host OS. Linux will discard the interrupt and print this message.

Unless these messages occur with high frequency, they should be innocuous.

The following configuration option should disable the optimization and make the messages stop:

monitor_control.disable_hostedIPI = TRUE

You can add this setting to /etc/vmware/config, and it will take effect for all VMs the next time they are powered on

from: Spurious APIC interrupt on CPU#1, should never happen

CPU Masking

Yes, it is possible to mask the CPUID values in a VM (except for user mode code when using binary translation). However, masking only changes what CPUID reports; it doesn't change the way the processor behaves. Thus, masking may cause unexpected guest behavior.


The general format for CPUID masking is:


cpuid.<leaf>.<register> = xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx


The right hand side is a binary representation of the desired value, most significant bit first. Aside from '0' and '1,' two other important symbols are 'h,' which means to pass through the bit from the host CPUID and '-,' which means not to override the normal handling for this bit.

Specifying a different CPU vendor is not recommended.

from thread masking Mr JMattson


In any event, the first thing to do is to pretend to be an AMD CPU. These settings should accomplish that:

cpuid.0.ebx = "0110:1000:0111:0100:0111:0101:0100:0001"
cpuid.0.ecx = "0100:0100:0100:1101:0100:0001:0110:0011"
cpuid.0.edx = "0110:1001:0111:0100:0110:1110:0110:0101"

Then you want to claim the family, model, and stepping of an actual AMD CPU. This setting should do that (claiming to be an early 64-bit Opteron):

cpuid.1.eax="----:0000:0000:0000:----:1111:0100:0110"

Even with these settings, some guests may still be unhappy.

Workstation

USB debugging

from Conversion from Workstation 10 to 11 breaks USB connections

usb.quirks.device0 = "0x04e8:0x685b skip-reset"

USB Passthrough on Linux Host

'Passthrough' mode was disabled on Linux host as it conflicted with shared mode provided via pcscd

from Gemalto Smart Card Reader only appears as "Shared" not "Passthrough"

  • 1) Go to the VM's installation directory. Typically C:\Users\<username>\Documents\Virtual Machines\
  • 2) Open <virtual-machine-name>.vmx file
  • 3) Append the following lines:
 usb.generic.allowCCID = "TRUE"
 usb.ccid.disable = "TRUE"
  • 4) Kill the process corresponding to the PCSC daemon on the Linux host

Do a # ps -ef | grep -i pcsc on your Linux host

sudo kill -9 <pid of the process that corresponds to pcscd>

Notes:

  • 1) The first line in step 3 enables the passthrough mode
  • 2) The second line in step 3 disables shared mode
  • 3) Since you are killing the pcscd on your host, you wont be able to use the smart card on the host. You can passthrough the smart card now and use it in the VM

Change thumbnail speed

From Workstation 14 including 15, the thumbnail views are not in real time any more and the default refresh interval value is 3000 ms.

You can add

pref.thumbnailRefreshIntervalMs = 1000

(or other values) in the preference file %appdata%/vmware/preferences.ini to change the refesh rate. But keep in mind that this way may cause high CPU usage.


If you really need the previous real time thumbnail, you can use

pref.closeInactiveMKSWindows =  "false"

But this way may cause mouse/keyboard functions under multi tabs not working well.

Both these settings are not documented or tested, so I cannot guarantee they working normally.

Note that you should make changes to the preferences.ini file with VMware Workstation shut down.

from: https://communities.vmware.com/message/2807350#2807350

Linux Host - switch back from Vulkan to X11

Workstation 16.2.0 and higher

Add to .vmx if changing for one VM, or ~/.vmware/config if you want to change this systemwide:

mks.enableX11Presentation=TRUE
mks.enableVulkanPresentation=FALSE

That will force us to draw the window using X11 instead of Vulkan, which is normally less performant, but might work better on some setups?


from: VMware 16.2.1 Display 3D acceleration not working Windows 10

Has a great explanation on the difference by banackm

Beware that if you have this issue -and your host has more than one GPU- that it also might be because the wrong GPU was selected for Vulkan.

There's another switch to use the openGL renderer instead of Vulkan:

mks.enableVulkanRenderer = "FALSE"
mks.enableGLRenderer = "TRUE"

and a switch to allow the Vulkan rendered use unsupported devices:

mks.vk.allowUnsupportedDevices = "TRUE"

There's even a way to force your VM to use a specific GPU, such as the discrete GPU instead of the integrated GPU.. if your host has both.

mks.forceDiscreteGPU = "TRUE"

See the tips from BlueFireStorm here: VMware Workstation cannot connect to the virtual machine

Dark Mode

In Workstation 16.2 Dark Mode had disappeared by accident, it was discovered that adding the following setting to the preferences.ini file makes it re-appear.

wsFeatureDarkModeSupported = "TRUE"

from: forum user mrdow2000

All USB devices are disabled

Check your .vmx file for the following line:

usb.restrictions.defaultAllow = "FALSE"

If it has this then remove that line and try again.

It seems that this line is automatically added for Workstation/Player 16.2.x when using "Easy Setup".

More details here: All USB devices are greyed out

VMware Player

Disable mitigations

A message about disabling side channel mitigations shows up only when the ULM is used instead of the ring 0 VMM as the hypervisor monitor.

That means the Windows host has been detected to have Hyper-V enabled.

https://blogs.vmware.com/workstation/2020/05/vmware-workstation-now-supports-hyper-v-mode.html

There is no advanced options in VMware Workstation Player.

To disable the side channel mitigation, shut down the VM and add the following to the VM vmx configuration file.

ulm.disableMitigations = "TRUE"

from: Poor performance after update with message about side channel mitigation

Fusion

Applying a setting over all VMs

Instead of editing each .vmx file manually, you can also apply config options to all VMs, by creating/editing the user global config file that can be found at: ~/Library/Preferences/VMware\ Fusion/config

There's already a 'preferences' file in the same directory, but normally the config file has to be created.

If an individual .vmx file contains the same config options as the global file, the .vmx file will take precedence.

Hide the Full Screen application menu

It's unsupported, but try editing /Users/$USER/Library/Preferences/VMware Fusion/preferences and add the line:

fusion.showFullScreenTitleBar = "FALSE"

See also: http://communities.vmware.com/message/1348663#1348663

Delay drop down Full Screen application menu

Edit /Users/$USER/Library/Preferences/VMware Fusion/preferences and add the line:

fusion.fullScreenMenuDelay = "2"

The delay is in seconds and the default is 1.5 seconds, added since Fusion 4.1 A value of "0" removes the delay.

See also: http://communities.vmware.com/message/2273022

On VMware Workstation you would add the following lines to the preferences.ini file.

pref.fullscreen.showDelay = "5000" 

to delay the showing of the toolbar 5000ms (5 seconds)

pref.fullscreen.hideDelay = "1000"

to hide the toolbar after 1000ms (1 second)

For Win7 the preferences.ini file is located under:

C:\Users\<username>\AppData\Roaming\VMware

debug menu

fusion.enableDebugMenu

(never tried)

Turn off full screen autofit to host

Here's another way to stop the guest from automagically being resized at each swipe:

  • Open Finder, select the "Go" menu then select "Go To Folder..." and type in: ~/Library/Preferences/VMware Fusion/
  • Open the preferences file in a text editor and add/append the following lines at the end of the file:
pref.autoFitGuestToWindow = "FALSE"
pref.autoFitFullScreen = "stretchGuestToHost"

Taken from: https://communities.vmware.com/message/2293562

Pass through host model

It's unsupported, but try editing /Users/$USER/Library/Preferences/VMware Fusion/preferences and add the line:

hw.model.reflectHost = "TRUE"

This will cause the VM to see the same model ID as the host. The default for this option is FALSE. Be aware that using this option may cause VM portability issues since the guest may now depend on this behavior and the type of the underlying Mac.

See also: http://communities.vmware.com/thread/336922

VM power options always display "Force"

If the Virtual Machine was not originally created in VMware Fusion then you will notice that the Fusion Virtual Machine menu has the word "Force" inserted before any power option. For example copying a VM from a Windows systems to Mac it displays the "Force ..." commands by default. In other words, pressing the Option Key is backwards of what it is supposed to be. This is because the following options are missing from the Virtual Machine's .vmx configuration file.

powerType.powerOff = "soft"  
powerType.powerOn = "soft"  
powerType.suspend = "soft"  
powerType.reset = "soft"  

By default, VMware Fusion creates these options in the Virtual Machine's .vmx configuration file while VMware Player/Workstation does not. So, add the above options to the Virtual Machine's .vmx configuration file and the "Force ..." commands will then exhibit VMware Fusion normal behavior. Meaning in order to access the "Force ..." commands one will need to press the Option Key.

See also: http://communities.vmware.com/thread/402281

kernel debugging

You can attach a remote debugger such as gdb to your vm to do kernel debugging.

DebugStub knows nothing at all about the guest OS. Think of debugStub as an In-Circuit Debugger for the virtual CPU(s).

debugStub.listen.guest64 = "TRUE"
debugStub.listen.guest64.remote = "TRUE"
debugStub.hideBreakpoints=1

specify a custom port with:

debugStub.port.guest64 = "8865"

other options:

debugStub.listen.guest32 = "TRUE"                          # Enable listener for 32 bit guest
debugStub.listen.guest32.remote = "TRUE"              # Allow remote connection
debugStub.port.guest32 = "32001"                          # Listen on specified port NNN

see also: Using debugStub to debug a guest linux kernel

Additional logging

For troubleshooting boot issues etcetera you can increase the log level in vmware.log

monitor_control.log_vmsample = "TRUE"

Fusion 6.0.2 / OS X 10.9.2 Host / OS X 10.9 Guest VM running >100% CPU no matter what

memory hole

At 3.2 GB there's a 1024kB memory hole.

You can use the pciHole.start option to adjust the start of the memory hole, measured in megabytes from address 0x00000000. The default is

  pciHole.start = 3072

which corresponds to 0xC0000000.

from Memory hole at 3.2GB

Disable Shared Folder event notification

isolation.tools.hgfs.notify.enable = "FALSE"

See also: http://kb.vmware.com/kb/2011360


Shared folder size check

The other workaround is to stop the VM, edit the VM's .vmx file and add the following setting:

tools.hgfs.volumeInfoType = "max"


Then start the VM again, and this time you will not need to disable the other shares which are on smaller sized volumes.


The default setting causes the shares to be aggregated to the smallest volume size that a share resides on when our file system is queried for size and free space.

The above setting overrides this to pick the largest volume size. The downside is that you can start a copy to a share on volume with a smaller amount of free space and it will only fail when it actually fails to write when the free space is exhausted.

If you know you are not going to run into that type of scenario yourself or you verify prior to starting the copy operation then you will be fine.


Note, the above can only be set to "min" or "max" and if not set at all, then "min" is the default.

from: Folder copy on Windows 7 vm fails for "not enough space", but there is.

Disable location services

sensor.location = "disable" 

to vmx.

how-to disable location services

Disable automatic USB connect to guest feature

1. Suspend or shut down any running VMs and quit Fusion.

2. Ensure that the vmware-usbarbitrator process is no longer running.

3. Create/edit the host-global configuration file, with root privileges: (this example uses nano, but feel free to use any other editor)

   sudo nano /Library/Preferences/VMware\ Fusion/config

4. Add the following line to disable the automatic claiming of USB devices:

   usbarb.autoconnect.claimAll = "FALSE"

5. Save the file and quit the editor.


With this change, all USB devices should automatically connect to the host even when VMs are running. Note that it will completely disable the USB connection prompt, and will prevent devices from automatically connecting to VMs (even if the option is selected in settings). However it should still be possible to manually connect USB devices to a running VM (except possibly in cases where the reset command is not correctly issued via the hub).

from: 2014 Preview still has USB 3 hub issue

Open file with host OS application

When a file is located on a shared folder (VMware HGFS) then you can choose to be able to open this file with the host OS default application. For example. Your png file can open in macOS Preview.

 proxyApps.publishToGuest = "TRUE"

See also: Has there ever been a solution to opening a host application from a guest OS?

Pass OS X host serial number

If you want an OS X guest to use the host's serial number, you'll need to add this option to the VM's configuration:

 serialNumber.reflectHost = "TRUE"

Pass OS X host hardware model

To pass hardware model to the guest (not even sure this works, as it does not seem to do anything for me, but ... Fusion does not error on starting the VM )

 hw.model.reflectHost = "TRUE"

Pass OS X host hardware model ID

If you want an OS X guest to use the host's hardware model ID (i.e. "MacPro5,1"), board ID (i.e. "Mac-12345678") and serial number all together:

 smbios.reflectHost = "TRUE"

Any platform

Disable scoreboard files

In VMware Fusion 12.2 and Workstation 16.2 new files have been introduced for keeping some sort of statistics.

These are called scoreboard files.

You can disable that feature.

vmx.scoreboard.enabled = "FALSE"

See: Suggestion by DaveP on VMware Workstation 16.2.0 and .scoreboard files. What is it?

Slow down time in guest

You can't quite stop time, but you can make it go extremely slowly. Set the following in your system-wide configuration file (/etc/vmware/config on Linux; C:\ProgramData\VMware\VMware Workstation\config.ini on Windows):

host.cpukHz = 1000

This is probably not all that useful in practice, unless the guest OS has no reliance on any time sources.

from System time


Set max number of snapshots

snapshot.maxSnapshots = 100

Enable DX11 or OpenGL Host Renderer

Courtesy @bluefirestorm at setting *.vmx

mks.enableDX11Renderer

When 3D accelerated graphics is enabled in Workstation 12/14/15 the default value is "TRUE" (i.e. the line does not have to be present in the vmx file), VMware Workstation uses DX11 of the Windows host to deliver the DX10/OpenGL 3.3 core profile capability inside the VMs. For Linux hosts, the equivalent is mks.enableGLRenderer = "TRUE"

Enable D3D Renderer

Courtesy @bluefirestorm at setting *.vmx


mks.enableD3DRenderer

Default is "FALSE" from Workstation 12.x and later. This is only useful in version 12.x if the host graphics card does not have DX11 capability and setting this to TRUE and enableDX11Renderer to FALSE let the VM have some limited 3D accelerated graphics capability. This looks like is already ineffective in version 14/15.

Select host Graphics card to use

Courtesy @bluefirestorm at setting *.vmx


mks.dx11.vendorID

valid values are the vendor ID of the graphic card, 0x8086 for Intel, 0x10DE for Nvidia, 0x1002 for AMD.

If this line is not present, VMware Workstation will use the default graphic card of the Windows host system. This line is useful if the system has two graphic cards from two different vendors that are simultaneously active on the host machine (example: Intel integrated graphics in the CPU and a discrete graphics card from Nvidia or AMD).

ReflectHost

Courtesy @bluefirestorm at setting *.vmx

SMBIOS.reflectHost

Default is "FALSE". If set to "TRUE" some of the DMI info will use the host values (example: manufacturer will change from VMware to the host value). You can see this difference by using msinfo32 in Windows VM or dmidecode in Linux VM. This is not so useful anymore to hide the fact that the VM is a VM.

vmx.buildType

Courtesy @bluefirestorm at setting *.vmx

vmx.buildType

Valid values are "release" and "debug". The "debug" is the default for the beta versions (aka Tech Preview). When set to "debug", vmware-vmx-debug.exe will be used instead of vmware-vmx.exe and the vmware.log file will be larger.

External sites

There's only one .vmx site that has most .vmx options and that's Ulli's reference over at sanbarrow:

http://sanbarrow.com/vmx/vmx-advanced.html