Muffinresearch Labs by Stuart Colville

Ubuntu Hardy: Setting up VMWare-tools from the CLI | 22 Comments

Posted in Code, Linux/Unix on 13th July 2008, 5:41 pm by

First you need the vmware tools tar from the cd image. This is found at /media/cdrom once you’ve run “install vmware tools” from the server console. When I did this the CD didn’t seem to be available even though it looked like it had mounted correctly. To get past this I simply grabbed a copy of /usr/lib/vmware/isoimages/linux.iso and extracted the vmware-tools tar file from there.

Note it’s not totally necessary but I ran this after upgrading the system to the latest kernel – these optional steps are as follows:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade # if there’s a new kernel available
sudo shutdown -r now # if you’ve updated the kernel

After unpacking the VMware tools package when simply trying to install the vmware tools from the tar file I got the following error:

tar -xzf VMwareTools-1.0.5-80187.tar.gz
cd vmware-tools-distrib/
sudo ./vmware-install.pl

…Snip…

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmhgfs-only'
make -C /lib/modules/2.6.24-19-server/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-19-server'
  CC [M]  /tmp/vmware-config0/vmhgfs-only/cpName.o
In file included from include/linux/string.h:11,
                 from /tmp/vmware-config0/vmhgfs-only/cpName.h:18,
                 from /tmp/vmware-config0/vmhgfs-only/cpName.c:18:
include/linux/types.h:40: error: conflicting types for ‘uintptr_t’
/tmp/vmware-config0/vmhgfs-only/vm_basic_types.h:161: error: previous declaration of ‘uintptr_t’ was here
make[2]: *** [/tmp/vmware-config0/vmhgfs-only/cpName.o] Error 1
make[1]: *** [_module_/tmp/vmware-config0/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-19-server'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/vmware-config0/vmhgfs-only'
Unable to build the vmhgfs module.

To fix this you need to use the open-vmware-tools to create the kernel modules and then install the vmware tools as normal. The problem was solved on the vmware forum: and this fix was then neatly wrapped up on the “Et Cetera” blog.

Installing VMWare-tools on Ubuntu Hardy Heron from the Command Line

Note: These instructions were carried out on kernel 2.6.24-19-server.

First install the headers for your kernel these are needed for compilation:

sudo apt-get install linux-headers-`uname -r`

Now install the following dependency requirements and install the open-vmware-tools:

sudo apt-get install libproc-dev libdumbnet-dev libicu-dev

wget http://mesh.dl.sourceforge.net/sourceforge/open-vm-tools/open-vm-tools-2008.07.01-102166.tar.gz
tar -xzf open-vm-tools-*.tar.gz
cd open-vm-tools-*

./configure --without-x
 make

cd modules/linux

for i in *; do mv ${i} ${i}-only; tar -cf ${i}.tar ${i}-only; done
cd ../../../
mv -f open-vm-tools-*/modules/linux/*.tar vmware-tools-distrib/lib/modules/source/

Finally install the vmware tools as required.

cd vmware-tools-distrib/
sudo ./vmware-install.pl

All being well this should look like this (it’s pretty much a case of saying yes to every default)

Creating a new installer database using the tar3 format.

Installing the content of the package.

In which directory do you want to install the binary files?
[/usr/bin] 	

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc] 

What is the directory that contains the init scripts?
[/etc/init.d] 

In which directory do you want to install the daemon files?
[/usr/sbin] 

In which directory do you want to install the library files?
[/usr/lib/vmware-tools] 

The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes] 

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools] 

The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes] 

The installation of VMware Tools 1.0.5 build-80187 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes] 

Stopping VMware Tools services in the virtual machine:
   Guest operating system daemon:-ne                                   done

Trying to find a suitable vmhgfs module for your running kernel.

None of the pre-built vmhgfs modules for VMware Tools is suitable for your
running kernel.  Do you want this program to try to build the vmhgfs module for
your system (you need to have a C compiler installed on your system)? [yes] 

Using compiler "/usr/bin/gcc". Use environment variable CC to override.

What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.24-19-server/build/include] 

Extracting the sources of the vmhgfs module.

Building the vmhgfs module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmhgfs-only'
make -C /lib/modules/2.6.24-19-server/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-19-server'
  CC [M]  /tmp/vmware-config0/vmhgfs-only/backdoor.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/backdoorGcc32.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/bdhandler.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/cpName.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/cpNameLinux.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/cpNameLite.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/dentry.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/dir.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/file.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/filesystem.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/fsutil.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/hgfsBd.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/hgfsEscapeLinux.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/hgfsUtil.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/inode.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/kernelStubsLinux.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/link.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/messageBackdoor.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/message.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/module.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/page.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/request.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/rpcout.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/staticEscape.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/stubs.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/super.o
  CC [M]  /tmp/vmware-config0/vmhgfs-only/vmhgfs.mod.o
  LD [M]  /tmp/vmware-config0/vmhgfs-only/vmhgfs.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /tmp/vmware-config0/vmhgfs-only/vmhgfs.mod.o
  LD [M]  /tmp/vmware-config0/vmhgfs-only/vmhgfs.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-19-server'
cp -f vmhgfs.ko ./../vmhgfs.o
make: Leaving directory `/tmp/vmware-config0/vmhgfs-only'
The module loads perfectly in the running kernel.

pcnet32                35460  0
Unloading pcnet32 module

Extracting the sources of the vmxnet module.

Building the vmxnet module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmxnet-only'
make -C /lib/modules/2.6.24-19-server/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-19-server'
  CC [M]  /tmp/vmware-config0/vmxnet-only/vmxnet.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /tmp/vmware-config0/vmxnet-only/vmxnet.mod.o
  LD [M]  /tmp/vmware-config0/vmxnet-only/vmxnet.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-19-server'
cp -f vmxnet.ko ./../vmxnet.o
make: Leaving directory `/tmp/vmware-config0/vmxnet-only'
The module loads perfectly in the running kernel.

No X install found.

Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:-ne                                done

   Guest filesystem driver:-ne                                         done

   Guest vmxnet fast network device:-ne                                done

   DMA setup:-ne                                                       done

   Guest operating system daemon:-ne                                   done

The configuration of VMware Tools 1.0.5 build-80187 for Linux for this running
kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking the following command:
"/usr/bin/vmware-toolbox" during an X session.

To make use of the vmxnet driver you will need to rebooot.
Enjoy,

--the VMware team

Post Tools

  • http://cixar.com/~ryan/ onecreativenerd

    The open-vm-tools download link puts me into an infinite redirect loop. This one works better for me:

    http://downloads.sourceforge.net/open-vm-tools/open-vm-tools-2008.07.01-102166.tar.gz

  • Alex

    Thanks for the Hardy VMware Tools how to…works great! -Alex

  • http://cixar.com/~ryan/ onecreativenerd

    Also, I found that when compiling the open-vm-tools, I could not make in the project root as described. I had to cd to modules/linux and make each module directly before tarring them up and placing them in the vmware folder. Hope this helps!

  • John Adriaan

    I followed these instructions on a newly-created Ubuntu 8.04 image, but I didn’t have all the packages I needed to recompile the Open VMware Tools, even after installing the list given. I referenced the Et Cetera blog, and found that a few more packages were suggested: libgtk2.0-dev, xorg-dev, libxinerama-dev, libxrandr-dev, and libxtst-dev. Also, there was no mention of the –without-x option in the ./configure line.
    Anyway, I added all these packages (not caring which one would fix the problem), re-performed the ./configure –without-x line, and then the make worked.

  • http://muffinresearch.co.uk Stuart Colville

    @John: These instructions are very much geared towards building the vmware tools from the CLI without building it to work with X. This is because I’m running VMs that are headless servers so I don’t need the X dependencies. If you’re running this VM with a UI you’ll want to omit the “–without-x” flag.

  • Darrell

    I tried to build the open-vm-tools with the option –without-x but the make would fail. I had to install libx11-dev. Then it would compile. I guess maybe a bug on the configure script.

  • dave

    for Ubuntu Hardy – start to finish in one c&p for the lazy :)

    #--vmware tools--
    ##-SELECT "VM-> install vmware-tools" from vmware server console-##
    cd /root
    mount /media/cdrom
    cp /media/cdrom/VMwareTools-1.0.4-56528.tar.gz /root/
    wget http://transact.dl.sourceforge.net/sourceforge/open-vm-tools/open-vm-tools-2008.07.01-102166.tar.gz
    tar -xzvf open-vm-tools-2008.07.01-102166.tar.gz
    tar -xzvf VMwareTools-1.0.4-56528.tar.gz
    apt-get update
    apt-get install linux-headers-`uname -r`
    apt-get install libproc-dev libdumbnet-dev libicu-dev
    apt-get install libx11-dev

    cd /root/open-vm-tools-2008.07.01-102166
    make
    cd modules/linux
    for i in *; do mv ${i} ${i}-only; tar -cf ${i}.tar ${i}-only; done
    cd ../../../
    mv -f open-vm-tools-*/modules/linux/*.tar vmware-tools-distrib/lib/modules/source/
    cd vmware-tools-distrib/
    ./vmware-install.pl
    #####--make sure you type "no" at "It looks like you are trying to run this program in a remote session." if you are sshing... it reconnects pretty quickly and you normally won't loose your ssh connection unless something goes horribly wrong.. so maybe this isn't a good idea. ah well works for me.

  • https://bugs.launchpad.net/hardy-backports/+bug/252663 jibeddari

    Please join forces with me and try to get a hardy backport of open-vm-tools :-)

    This would solve having to maintain these tools manually, which is a pain .. when you have more than a few VMs on ESX.

    https://bugs.launchpad.net/hardy-backports/+bug/252663

  • ed

    I have found 100′s of Google entries for “patching” VMTools to work with Hardy-Heron. This must represent 1,000s of hours of work documenting the fixes. (btw, each one is slightly different!)

    This may be a silly noob question but would it not be easier if someone would just make an APT package out of fix?

  • SunnySeattle

    This was incredibly helpful to me. Thanks for taking the time to document this.

  • Fitz

    Great work and article. Worked great and sorted out my compilation issues.

  • http://aryo.info Aryo

    Thanks, this document works great for me.
    I’m using Ubuntu 7.10 – Gutsy Gibon.
    And I’m using updated open-vm-tools-2008.08.08-109361 than this document does.

  • http://www.teamxmm.com Russ

    So… the instructions worked beautifully and all’s well… except, I just noticed that lsmod on my Guest OS shows:

    :~$ sudo lsmod | grep net
    vmxnet 19456 0
    pcnet32 35460 0
    mii 6400 1 pcnet32

    so… I followed the rmmod/depmod routine to leave only vmxnet in place, but when I reboot pcnet32 comes right back up…

    any suggestions on avoiding that?

  • Ralf

    Thank you very much!

    This worked for me on Debian Etch with 2.6.26 kernel. I had to download the latest open-vm-tools though but it worked!!

  • http://adumont.serveblog.net/ adumont

    Thanks, it worked very well!

  • mcdermott

    This didn’t fix my problems, looks similar but did work for me.

  • firestorm_v1

    Unfortunately, this did not work for me. make didn’t proceed as it was trying to compile guestAppPosixX11 despite having used the –without-x option.

  • Pingback: VMWare on Ubuntu 8.10 (Intrepid) - New HowTo « In Search of Equilibrium

  • http://www.brokenhomeboy.co.uk/pierow/ Pierow

    You are a lifesaver. Worked like a champ!

  • tom

    only issue with this is you will have to do this each time a new kernel gets installed -> wonder why ubuntu does not come with a apt package like debian does (open-vm-tools, tools and components for VMware guest system)

  • Paul

    I started this as root in /root and got to the step of:

    mv -f open-vm-tools-*/modules/linux/*.tar vmware-tools-distrib/lib/modules/source/

    My question is do I create this directory? vmware-tools-distrib/lib/modules/source/

    If not where is it and where is the perl vmware-install.pl?

  • fulvio

    J cannot generate the tar file for my installation’s tools-vmware.
    Can you give me the output tar file already generated ?
    Do you think that the tar file is ok for my ubuntu 8.04 ?
    The hw is a 32 bit guest.

    Sorry for my bad english.

    Bye
    Fulvio ( Turin, Italy)

GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(3)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.535s.