Build guest vmware kernel modules: Difference between revisions

From VI-Toolkit
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 12: Line 12:
Copy the files to your home folder
Copy the files to your home folder
     cd ~   
     cd ~   
     cp /cdrom/VMwareTools-*.tar.gz .   
     cp /mnt/cdrom/VMwareTools-*.tar.gz .   
unzip
unzip
     tar xfz VMwareTools-*.tar.gz   
     tar xfz VMwareTools-*.tar.gz   
Line 47: Line 47:


====Troubleshooting====
====Troubleshooting====
===== available kernel modules =====
After the manual compile, you can run the lsmod command to see what modules it was able to load:
After the manual compile, you can run the lsmod command to see what modules it was able to load:
  $ lsmod | grep -i vm
  $ lsmod | grep -i vm
Line 53: Line 55:
* vmhgfs - shared folders
* vmhgfs - shared folders
* vmxnet3 - virtual network adapter
* vmxnet3 - virtual network adapter
* vmmemctl - memory
* vmw_balloon - balloon memory driver
* vmw_balloon - balloon memory driver
* vmw_pvscsi - paravirtual scsi
* vmw_pvscsi - paravirtual scsi
* vmwgfx - accelerated graphics
* [[vmwgfx]] - accelerated graphics
* vmblock - enable drag & drop between guest and host OS (desktop feature)
* vmblock - enable drag & drop between guest and host OS (desktop feature)
* vmsync -
* vgauth - Guest Authentication
* vgauth - Guest Authentication
* vmw_vmci - inter-VM and host interface
* vmw_vmci - inter-VM and host interface
* vmw_vsock_vmci_transport -  
* vmw_vsock_vmci_transport -  
* vsock - virtual sockets
* vsock - virtual sockets
Interesting tidbit, the reason that there's a "vmw_" prefix means it is VMware only and if there's no prefix, like vsock, then it is because it is a hypervisor-independent interface. See [https://communities.vmware.com/thread/497086 (1)] for details


There's also a number of additional commands/scripts to enable other features
There's also a number of additional commands/scripts to enable other features
* /usr/bin/vmware-toolbox-cmd - shrink, upgrade, statistics, version, timesync, run scripts on power operations, power operations, control devices
* /usr/bin/vmware-toolbox-cmd - shrink, upgrade, statistics, version, timesync, run scripts on power operations, power operations, control devices
* /usr/bin/vmware-user - advanced X features, guest resolution fit, drag and drop, file and text copy & paste
* /usr/bin/vmware-user - advanced X features, guest resolution fit, drag and drop, file and text copy & paste. Running this will start the vmtoolsd daemon in /usr/lib/vmware-tools/sbin64
* /usr/lib/vmware-tools/sbin64/vmware-checkvm - prints VMware software version
* /usr/lib/vmware-tools/sbin64/vmware-modconfig-console - module helper for acquiring status, kernel headers version, is a link to /usr/lib/vmware-tools/bin64/appLoader option --install-all will actually build all of your modules as well.
* vmware-tools-thinprint - printing integration with the host using a virtual printing daemon
* vmware-tools-thinprint - printing integration with the host using a virtual printing daemon
===== unable to start services for VMware Tools =====
Creating a new initrd boot image for the kernel.
NOTE: both /etc/vmware-tools/GuestProxyData/server/key.pem and
      /etc/vmware-tools/GuestProxyData/server/cert.pem already exist.
      They are not generated again. To regenerate them by force,
      use the "vmware-guestproxycerttool -g -f" command.
initctl: Job failed to start
Unable to start services for VMware Tools
Execution aborted.
If you get the above error then you can probably do as is sugggested above. I simply nuked the folder /etc/vmware-tools/GuestProxyData (rm -rf ) and completely reran the installer, after that it worked.
===== vgauth what? =====
Nowadays VMware Tools asks if you want to enable the CAF agent (Common Agent Framework agent).
If you are like me then you are probably wondering what this is.
At the forums there's an answer ( https://communities.vmware.com/message/2604183#2604183 by VMware employee ykzang)
I'm quoting that here for ease of reading.
''Multiple VMware management solutions (e.g. vCM, Hyperic, Log Insight) require  installation of in-guest agents.The Common Agent Framework attempts to provide a common framework to unify and simplify the management of various types of agents, and these agents would be referred to as Common Agent.''
''Those VMware solutions are working on distinct administrative domains from the guest. VGAuth provides a way to authorize those solutions users' behaviors(install agent for example) within guest.''


====Alternative solution====
====Alternative solution====

Latest revision as of 10:30, 2 November 2021

Pre built modules are sometimes not enough

When you select "install VMware Tools" then your VMware product will try to install the available vmware modules. If you run linux then sometimes the kernel will not match up with the prebuilt modules as are supplied with your vmware product. You can unzip the vmware tools .tar.gz bundle from the attached virtual CDrom and run the perl script, but if you just supply defaults you might still miss out on some modules as it will fail silently.

eg running:

./vmware-install.pl --default

is great as long as you have provided the VM with the right prerequisites.

The solution

Present the linux vmware tools virtual cd-rom to the VM and mount as a CDRom.

   mount /dev/sr0 /mnt/cdrom  

Copy the files to your home folder

   cd ~  
   cp /mnt/cdrom/VMwareTools-*.tar.gz .  

unzip

   tar xfz VMwareTools-*.tar.gz  

go into sub folder to build the tools

   cd vmware-tools-distrib/  

check and run pre-requisites from next paragraph if needed and then run:

   sudo ./vmware-install.pl  

Press <enter> on any questions asked.

After you are done you can remove the vmware-tool-distrib folder as it is only needed before the install.

After installing VMware Tools you now have the possibility to run

vmware-config-tools.pl

to configure how vmware tools is supposed to work.

Please note that on linux kernels 3.3 and higher, the original vmxnet module is no longer recommended. You are advised to use a newer virtual NIC such as vmxnet3 or e1000e.

Preconditions for the script to work

If you try to run the vmware-install.pl script and you need to build new kernel modules, then the script might give you the following error:

Before you can compile modules, you need to have the following installed...

make
gcc
kernel headers of the running kernel

You will have to get your kernel-headers and a compiler and build system before hand. On Ubuntu or debian based systems execute this:

sudo apt-get install build-essential linux-headers-$(uname -r)

On fedora / Red Hat based systems:

su -c "yum install kernel-devel"

On SUSE / openSUSE use YaST to fetch the latest linux-kernel-headers

Troubleshooting

available kernel modules

After the manual compile, you can run the lsmod command to see what modules it was able to load:

$ lsmod | grep -i vm

The following kernel modules are currently available:

  • vmhgfs - shared folders
  • vmxnet3 - virtual network adapter
  • vmmemctl - memory
  • vmw_balloon - balloon memory driver
  • vmw_pvscsi - paravirtual scsi
  • vmwgfx - accelerated graphics
  • vmblock - enable drag & drop between guest and host OS (desktop feature)
  • vmsync -
  • vgauth - Guest Authentication
  • vmw_vmci - inter-VM and host interface
  • vmw_vsock_vmci_transport -
  • vsock - virtual sockets

Interesting tidbit, the reason that there's a "vmw_" prefix means it is VMware only and if there's no prefix, like vsock, then it is because it is a hypervisor-independent interface. See (1) for details

There's also a number of additional commands/scripts to enable other features

  • /usr/bin/vmware-toolbox-cmd - shrink, upgrade, statistics, version, timesync, run scripts on power operations, power operations, control devices
  • /usr/bin/vmware-user - advanced X features, guest resolution fit, drag and drop, file and text copy & paste. Running this will start the vmtoolsd daemon in /usr/lib/vmware-tools/sbin64
  • /usr/lib/vmware-tools/sbin64/vmware-checkvm - prints VMware software version
  • /usr/lib/vmware-tools/sbin64/vmware-modconfig-console - module helper for acquiring status, kernel headers version, is a link to /usr/lib/vmware-tools/bin64/appLoader option --install-all will actually build all of your modules as well.
  • vmware-tools-thinprint - printing integration with the host using a virtual printing daemon
unable to start services for VMware Tools
Creating a new initrd boot image for the kernel.

NOTE: both /etc/vmware-tools/GuestProxyData/server/key.pem and
      /etc/vmware-tools/GuestProxyData/server/cert.pem already exist.
      They are not generated again. To regenerate them by force,
      use the "vmware-guestproxycerttool -g -f" command.

initctl: Job failed to start
Unable to start services for VMware Tools

Execution aborted.

If you get the above error then you can probably do as is sugggested above. I simply nuked the folder /etc/vmware-tools/GuestProxyData (rm -rf ) and completely reran the installer, after that it worked.

vgauth what?

Nowadays VMware Tools asks if you want to enable the CAF agent (Common Agent Framework agent).

If you are like me then you are probably wondering what this is.

At the forums there's an answer ( https://communities.vmware.com/message/2604183#2604183 by VMware employee ykzang)

I'm quoting that here for ease of reading.


Multiple VMware management solutions (e.g. vCM, Hyperic, Log Insight) require installation of in-guest agents.The Common Agent Framework attempts to provide a common framework to unify and simplify the management of various types of agents, and these agents would be referred to as Common Agent.


Those VMware solutions are working on distinct administrative domains from the guest. VGAuth provides a way to authorize those solutions users' behaviors(install agent for example) within guest.

Alternative solution

Many Linux distributions now come with a package called open-vm-tools and while that does give you a good bases, there are still things missing. Most notable is the host guest file system integration that is provided by the vmhgfs kernel module.