Struggling with VMware/ESXi Tools Install version:9349 (Current)
-
I'll preface this by saying I believe this is a config issue on my end and NOT a hardware issue. If any hardware is involved it's the hardware sitting between my eyeballs and my fingertips 8). If someone could please point out what I'm missing I'll owe you big!
Dedicated Lab/Play/Dev environment on three identical Dell Precision T5500 Machines:
Dell A16 BIOS
2x Xeon x5650 CPUs
72GB Samsung RAM
LSI 9260 i8 raid card with bbu & ~3TB RAID6 Storage
Various SS/Flash space (SATA & PCIe) equaling 1.3TB space
Headless (no video card)
Broadcom motherboard NIC
1x Intel Pro 1000 MT (64-bit PCI) quad NIC
1x Intel Pro 1000 PT dual NIC
1x Intel X540T2 dual 10GBE NIC
(plus various USB 2.0 & 3.0 smartcard & biometric devices but nothing to do with the pfSense VM)ESX/ESXi Version: VMware ESXi, 5.5.0, 1623387
Image Profile: (Updated) ESXi-5.5.0-20140302001-standard
VMware Tools - version:9349 (Current)VMware vSphere 5 Enterprise Plus (not free trial)
vCenter Server 5 Standard (not free trial)pfSense:
2.1.4-RELEASE (amd64)
built on Fri Jun 20 12:59:50 EDT 2014
FreeBSD 8.3-RELEASE-p16
ESXi 5.5 and later (Version 10)
Genuine Intel(R) CPU 000 @ 2.67GHz (engineering sample cpus)
8GB HDD, 3GB RAM, 3x vCPUsWAN = 1x e1000 vNIC
LAN = 1x e1000 vNIC
OPT1 = 1x VMXNET3Running PowerD, also RAM Disks - /tmp=80gb & /var=120GB
I have been taking snapshots each step and have done this build process 5-6 times today. I found the new link to the FreeBSD package archives (for perl & compat6x-amd64). Everything works perfectly as long as I do not reboot. I can build a pfSense VM out from scratch and get ESXi/vCenter Server Appliance to recognize that VMware Tools are installed and running perfectly - and the VM recognizes the VMXNET3 NIC I attached prior to the build - but as soon as I reboot it dies and doesn't load again.
Could this be because I have files in my /tmp or /var directories that get lost upon reboot because of the RAM disk? How and/or where do I need to put the files/directories or could anyone please tell me what I'm missing? I think I've been at it long enough that it's staring me in the face and I just can't see the obvious mistakes I'm making. I'm doing everything exactly as the pfSense docs tutorial states.
Why does VMware Tools fail when I reboot?
Thanks!
I don't know what I did but I am now able to show ESXi that VMware Tools have been installed after reboot however it says: Not running, version:9349 (Current) which cannot be good. It recognizes the VMXNET3 NICs but not consistently.
-
I am able to install VMware tools perfectly and ESXi will see it, etc. however upon reboot it is lost. When I try to re-install or check for software I am told perl is already installed as is VMware Tools. I have no idea about the library linkings of compat6x-amd64.
It appears that I have installed VMware Tools properly however the startup scripts are not working and/or linked properly.
Can anyone please offer advice?
-
Sadly, I've spent the last two weeks troubleshooting this - I got it working on 2.1.4, but not 2.1.5.
I started by following these two set of instructions:
http://www.v-front.de/2013/06/how-to-install-or-update-vmware-tools.html
https://doc.pfsense.org/index.php/VMware_ToolsIf you are having the same problem I have, I think you will find that there is a not_configured file in /etc/vmware-tools/ .
In the instructions on the second link, they have you create 000-ldconfig.sh, and I simply added
rm -f /etc/vmware-tools/not_configured
to the end of that script, and on 2.1.4, it worked. On 2.1.5, for whatever reason, the same method did NOT work for me. When the script that starts vmware tools runs at startup, it was creating the not_configured file before actually starting the tools, so I could not get it to come up at boot. I don't NEED the vmxnet3 nics, so I simply gave up and went back to the Open tools.I wish you luck, I'll watch the thread to see if someone smarter than me figures it out :)
-
So just updated to 2.1.5 few days back, and didn't have any problems with getting the tools working again
Via that first link - which have been using for quite a few paste versions. Just need to do step 4 again after an update, and then run
/usr/local/bin/vmware-config-tools.pl -d –clobber-kernel-modules=vmxnet3,pvscsi,vmmemctlAnd tools show running and current.
Im on esxi 5.5.0, 1746018, there is a couple of builds later but didn't see anything in them that required an update for me - but when I get a chance can update to current build and see if any issues.
-
When I had pfSense installed in ESXi (2.1), I just used the open-vm-tools package without any issues. Have you tried installing it or have you only used the official tools package?
-
From what I understand the generic open-vm-tools doesn't have any VMXNET drivers, and the E1000 driver can be CPU-heavy. They're better than nothing, but not as good as the real VMware Tools.
-
Well I grabbed the latest patch. And will update this weekend. But I don't expect any issues.. that link v-front.de link should work. But can bring up a new vm with 2.1.5 64bit as well for testing once on current patch. I have no need of 64bit so run 32bit, seems to have less issues all the way around ;)
But from here I show current version is
http://packages.vmware.com/tools/versions9350
-
Ok I just updated my esxi to latest patch, so on build 1892794
~ # vmware -vl
VMware ESXi 5.5.0 build-1892794
VMware ESXi 5.5.0 Update 1Had no problems updating the tools, just did step 5 in the v-front link above and bing bang zoom running and current, rebooted to validate autostart and yup up and running tools current
[2.1.5-RELEASE][root@pfsense.local.lan]/usr/local/bin(33): ps ax | grep vmware
80851 ?? S 0:02.08 /usr/local/lib/vmware-tools/sbin/vmtoolsdI will have to grab a copy of the 64bit version and see if any issues. But your version isn't current from what I show see my link to versions. I show 9.4.6 on pfsense, and all my other vms
Your number points to 9.4.5 - see my build link in previous post
9349 esx/5.5ep04 9.4.5 1881737
9349 esx/5.5ep03 9.4.5 1746974
9349 esx/5.5ep02 9.4.5 1750340
9349 esx/5.5u1 9.4.5 1623387edit: Ok just grabbed 2.1.5 64 iso, created new vm. booted, ran through the setup - hit the gui, let the wizard finish - click click click, set password - enable ssh, ssh in
Now they have moved the old 8.3 packages, so to get packages to install I did
setenv PACKAGESITE http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-8.3-release/Latest/
then just ran through the install instructions here http://www.v-front.de/2013/06/how-to-install-or-update-vmware-tools.html
pkg_add -rv perl
pkg_add -rv compat6x-amd64because nano is easier than vi ;)
pkg_add -rv nanonano /etc/rc
^W /sbin/ldconfig
add /usr/local/lib/compat to end of that line
run
/sbin/ldconfig -elf /usr/lib /usr/local/lib /lib /usr/local/lib/compatstart vmtools install, then
mkdir -p /mnt/cdrom
mount_cd9660 /dev/acd0 /mnt/cdrom
cd /tmp
tar xvzf /mnt/cdrom/vmware-freebsd-tools.tar.gz
cd vmware-tools-distrib
./vmware-install.pl -d –clobber-kernel-modules=vmxnet3,pvscsi,vmmemctlreboot
Then as you see current tools running without any issues
-
When I tired, I was running 64 bit. I could get ONE reboot in some cases, but on the second reboot, tools would not automatically start. In 2.1.4, removing the not_configured file was my solution to that. I have run through the instructions with a clean 2.1.5 64 bit build 3 times, all with the same result, but I can certainly try again :)
-
Well I can reboot my clean 64bit install a few times and check.. But in the tests I did I had no issues with it starting. Let me start it up and reboot it a few times.
-
When I tired, I was running 64 bit. I could get ONE reboot in some cases, but on the second reboot, tools would not automatically start. In 2.1.4, removing the not_configured file was my solution to that. I have run through the instructions with a clean 2.1.5 64 bit build 3 times, all with the same result, but I can certainly try again :)
I am having the same exact problem with ESXi 5.5 Update 2 | 09 SEP 2014 | Build 2068190. This is my first time trying to virtualize pfsense so not sure if it is build specific. Also using 2.1.5 64 bit. I can reboot twice and then I get the Not installed sign.
-
Well strange enough upon reboot of my 64bit test vm, I was running into this as well. Have not had chance to look into as of yet.
Why do you think you need to run 64bit? Your only giving the VM 3GB of ram, the 3vcpus total waste..
-
Was doing some google research on this issue and it doesn't look like it is a new one. If the following file /etc/vmware-tools/not_configured file exists, after the NEXT reboot , there will not be a running vmtools any more.
I found the following post from http://www.v-front.de/2013/06/how-to-install-or-update-vmware-tools.html
Andreas PeetzApril 30, 2014 at 2:32 PM Hi GarFin, I also looked into this issue and noticed that the not_configured file is created by the VMware Tools boot script /usr/local/etc/rc.d/vmware-tools.sh whenever it thinks that something went wrong. You can just uncomment the code there, but this change will be reverted on the next update or re-installation of the Tools. Andreas
Here is the code from /usr/local/etc/rc.d/vmware-tools.sh just not sure what to comment out.
# See how we were called. case "$1" in start) exitcode='0' if vmware_inVM; then if [ -e "$vmware_etc_dir"/not_configured ]; then echo "`vmware_product_name`"' is installed, but it has not been ' echo '(correctly) configured for the running kernel.' echo 'To (re-)configure it, invoke the following command: ' echo "$vmdb_answer_BINDIR"'/vmware-config-tools.pl.' echo exit 1 fi echo 'Starting VMware Tools services in the virtual machine:' vmware_exec 'Switching to guest configuration:' vmware_switch exitcode=`expr "$exitcode" + "$?"` if [ "`is_vmmemctl_needed`" = 'yes' ]; then vmware_exec 'Guest memory manager:' vmware_start_vmmemctl exitcode=`expr "$exitcode" + "$?"` fi if [ "`is_vmxnet_needed`" = 'yes' ]; then vmware_exec 'Guest vmxnet fast network device:' vmware_start_vmxnet exitcode=`expr "$exitcode" + "$?"` fi if [ "`is_vmblock_needed`" = 'yes' ]; then vmware_exec 'Blocking file system:' vmware_start_vmblock fi # Signal vmware-user to relaunch itself and maybe restore # contact with the blocking file system. if [ "`is_vmware_user_running`" = 'yes' ]; then vmware_exec 'VMware User Agent:' vmware_restart_vmware_user fi vmware_exec 'Guest operating system daemon:' vmware_start_vmtoolsd exitcode=`expr "$exitcode" + "$?"` else echo 'Starting VMware Tools services on the host:' vmware_exec 'Switching to host config:' vmware_switch exitcode=`expr "$exitcode" + "$?"` fi if [ "$exitcode" -gt 0 ]; then # Set the 'not configured' flag touch "$vmware_etc_dir"'/not_configured' chmod 644 "$vmware_etc_dir"'/not_configured' db_add_file "$vmware_db" "$vmware_etc_dir"'/not_configured' \ "$vmware_etc_dir"'/not_configured' exit 1 fi ;;
-
here is the section you want to get rid of, comment out
if [ "$exitcode" -gt 0 ]; then
# Set the 'not configured' flag
touch "$vmware_etc_dir"'/not_configured'
chmod 644 "$vmware_etc_dir"'/not_configured'
db_add_file "$vmware_db" "$vmware_etc_dir"'/not_configured'
"$vmware_etc_dir"'/not_configured'I bolded the part that creates the file.
-
# if [ "$exitcode" -gt 0 ]; then # Set the 'not configured' flag # touch "$vmware_etc_dir"'/not_configured' # chmod 644 "$vmware_etc_dir"'/not_configured' # db_add_file "$vmware_db" "$vmware_etc_dir"'/not_configured' \ # "$vmware_etc_dir"'/not_configured' # exit 1 # fi ;;
Thanks I'll try it
EDIT: The above commenting out worked for me. I can reboot and there is no longer a not_configured file created. Would still like to get to the bottom of why this is happening.
-
Bump for confirmation that the "fix" works.
-
I wouldn't call it a "fix" ;) I would look into why there is hit on that rule that says something went wrong don't start the toosl ;)
-
Agreed . Here is the entire script to see what is going on.
#!/bin/sh # # Copyright (c) 1998-2014 VMware, Inc. All rights reserved. # # This script manages the services needed to run VMware software # Basic support for IRIX style chkconfig # chkconfig: 3 90 08 # description: Manages the services needed to run VMware software # Basic support for the Linux Standard Base Specification 1.0.0 (to be used by # insserv for exemple) ### BEGIN INIT INFO # Provides: VMware_Tools # Required-Start: $network $syslog # Required-Stop: # Default-Start: 3 5 # Default-Stop: # Description: Manages the services needed to run VMware Tools ### END INIT INFO # BEGINNING_OF_UTIL_DOT_SH #!/bin/sh # # Copyright (c) 2005-2014 VMware, Inc. All rights reserved. # # A few utility functions used by our shell scripts. Some expect the settings # database to already be loaded and evaluated. vmblockmntpt="/proc/fs/vmblock/mountPoint" vmblockfusemntpt="/var/run/vmblock-fuse" vmware_failed() { if [ "`type -t 'echo_failure' 2>/dev/null`" = 'function' ]; then echo_failure else echo -n "$rc_failed" fi } vmware_success() { if [ "`type -t 'echo_success' 2>/dev/null`" = 'function' ]; then echo_success else echo -n "$rc_done" fi } # Execute a macro vmware_exec() { local msg="$1" # IN local func="$2" # IN shift 2 echo -n ' '"$msg" # On Caldera 2.2, SIGHUP is sent to all our children when this script exits # I wanted to use shopt -u huponexit instead but their bash version # 1.14.7(1) is too old # # Ksh does not recognize the SIG prefix in front of a signal name if [ "$VMWARE_DEBUG" = 'yes' ]; then (trap '' HUP; "$func" "$@") else (trap '' HUP; "$func" "$@") >/dev/null 2>&1 fi if [ "$?" -gt 0 ]; then vmware_failed echo return 1 fi vmware_success echo return 0 } # Execute a macro in the background vmware_bg_exec() { local msg="$1" # IN local func="$2" # IN shift 2 if [ "$VMWARE_DEBUG" = 'yes' ]; then # Force synchronism when debugging vmware_exec "$msg" "$func" "$@" else echo -n ' '"$msg"' (background)' # On Caldera 2.2, SIGHUP is sent to all our children when this script exits # I wanted to use shopt -u huponexit instead but their bash version # 1.14.7(1) is too old # # Ksh does not recognize the SIG prefix in front of a signal name (trap '' HUP; "$func" "$@") 2>&1 | logger -t 'VMware[init]' -p daemon.err & vmware_success echo return 0 fi } # This is a function in case a future product name contains language-specific # escape characters. vmware_product_name() { echo 'VMware Tools' exit 0 } # This is a function in case a future product contains language-specific # escape characters. vmware_product() { echo 'tools-for-freebsd' exit 0 } is_dsp() { # This is the current way of indicating it is part of a # distribution-specific install. Currently only applies to Tools. [ -e "$vmdb_answer_LIBDIR"/dsp ] } # They are a lot of small utility programs to create temporary files in a # secure way, but none of them is standard. So I wrote this make_tmp_dir() { local dirname="$1" # OUT local prefix="$2" # IN local tmp local serial local loop tmp="${TMPDIR:-/tmp}" # Don't overwrite existing user data # -> Create a directory with a name that didn't exist before # # This may never succeed (if we are racing with a malicious process), but at # least it is secure serial=0 loop='yes' while [ "$loop" = 'yes' ]; do # Check the validity of the temporary directory. We do this in the loop # because it can change over time if [ ! -d "$tmp" ]; then echo 'Error: "'"$tmp"'" is not a directory.' echo exit 1 fi if [ ! -w "$tmp" -o ! -x "$tmp" ]; then echo 'Error: "'"$tmp"'" should be writable and executable.' echo exit 1 fi # Be secure # -> Don't give write access to other users (so that they can not use this # directory to launch a symlink attack) if mkdir -m 0755 "$tmp"'/'"$prefix$serial" >/dev/null 2>&1; then loop='no' else serial=`expr $serial + 1` serial_mod=`expr $serial % 200` if [ "$serial_mod" = '0' ]; then echo 'Warning: The "'"$tmp"'" directory may be under attack.' echo fi fi done eval "$dirname"'="$tmp"'"'"'/'"'"'"$prefix$serial"' } # Removes "stale" device node # On udev-based systems, this is never needed. # On older systems, after an unclean shutdown, we might end up with # a stale device node while the kernel driver has a new major/minor. vmware_rm_stale_node() { local node="$1" # IN if [ -e "/dev/$node" -a "$node" != "" ]; then local node_major=`ls -l "/dev/$node" | awk '{print \$5}' | sed -e s/,//` local node_minor=`ls -l "/dev/$node" | awk '{print \$6}'` if [ "$node_major" = "10" ]; then local real_minor=`cat /proc/misc | grep "$node" | awk '{print \$1}'` if [ "$node_minor" != "$real_minor" ]; then rm -f "/dev/$node" fi else local node_name=`echo $node | sed -e s/[0-9]*$//` local real_major=`cat /proc/devices | grep "$node_name" | awk '{print \$1}'` if [ "$node_major" != "$real_major" ]; then rm -f "/dev/$node" fi fi fi } # Checks if the given pid represents a live process. # Returns 0 if the pid is a live process, 1 otherwise vmware_is_process_alive() { local pid="$1" # IN ps -p $pid | grep $pid > /dev/null 2>&1 } # Check if the process associated to a pidfile is running. # Return 0 if the pidfile exists and the process is running, 1 otherwise vmware_check_pidfile() { local pidfile="$1" # IN local pid pid=`cat "$pidfile" 2>/dev/null` if [ "$pid" = '' ]; then # The file probably does not exist or is empty. Failure return 1 fi # Keep only the first number we find, because some Samba pid files are really # trashy: they end with NUL characters # There is no double quote around $pid on purpose set -- $pid pid="$1" vmware_is_process_alive $pid } # Note: # . Each daemon must be started from its own directory to avoid busy devices # . Each PID file doesn't need to be added to the installer database, because # it is going to be automatically removed when it becomes stale (after a # reboot). It must go directly under /var/run, or some distributions # (RedHat 6.0) won't clean it # # Terminate a process synchronously vmware_synchrone_kill() { local pid="$1" # IN local signal="$2" # IN local second kill -"$signal" "$pid" # Wait a bit to see if the dirty job has really been done for second in 0 1 2 3 4 5 6 7 8 9 10; do vmware_is_process_alive "$pid" if [ "$?" -ne 0 ]; then # Success return 0 fi sleep 1 done # Timeout return 1 } # Kill the process associated to a pidfile vmware_stop_pidfile() { local pidfile="$1" # IN local pid pid=`cat "$pidfile" 2>/dev/null` if [ "$pid" = '' ]; then # The file probably does not exist or is empty. Success return 0 fi # Keep only the first number we find, because some Samba pid files are really # trashy: they end with NUL characters # There is no double quote around $pid on purpose set -- $pid pid="$1" # First try a nice SIGTERM if vmware_synchrone_kill "$pid" 15; then return 0 fi # Then send a strong SIGKILL if vmware_synchrone_kill "$pid" 9; then return 0 fi return 1 } # Determine if SELinux is enabled isSELinuxEnabled() { if [ "`cat /selinux/enforce 2> /dev/null`" = "1" ]; then echo "yes" else echo "no" fi } # Runs a command and retries under the provided SELinux context if it fails vmware_exec_selinux() { local command="$1" # XXX We should probably ask the user at install time what context to use # when we retry commands. unconfined_t is the correct choice for Red Hat. local context="unconfined_t" local retval $command retval=$? if [ $retval -ne 0 -a "`isSELinuxEnabled`" = 'yes' ]; then runcon -t $context -- $command retval=$? fi return $retval } # Start the blocking file system. This consists of loading the module and # mounting the file system. vmware_start_vmblock() { mkdir -p -m 1777 /tmp/VMwareDnD # Try FUSE first, fall back on in-kernel module. vmware_start_vmblock_fuse && return 0 vmware_exec 'Loading module' vmware_load_module $vmblock exitcode=`expr $exitcode + $?` # Check to see if the file system is already mounted. if grep -q " $vmblockmntpt vmblock " /etc/mtab; then # If it is mounted, do nothing true; else # If it's not mounted, mount it vmware_exec_selinux "mount -t vmblock none $vmblockmntpt" fi } # Stop the blocking file system vmware_stop_vmblock() { # Check if the file system is mounted and only unmount if so. # Start with FUSE-based version first, then legacy one. # # Vmblock-fuse dev path could be /var/run/vmblock-fuse, # or /run/vmblock-fuse. Bug 758526. if grep -q "/run/vmblock-fuse fuse\.vmware-vmblock " /etc/mtab; then # if it's mounted, then unmount it vmware_exec_selinux "umount $vmblockfusemntpt" fi if grep -q " $vmblockmntpt vmblock " /etc/mtab; then # if it's mounted, then unmount it vmware_exec_selinux "umount $vmblockmntpt" fi # Unload the kernel module vmware_unload_module $vmblock } # This is necessary to allow udev time to create a device node. If we don't # wait then udev will override the permissions we choose when it creates the # device node after us. vmware_delay_for_node() { local node="$1" local delay="$2" while [ ! -e $node -a ${delay} -gt 0 ]; do delay=`expr $delay - 1` sleep 1 done } vmware_real_modname() { # modprobe might be old and not understand the --resolve-alias option, or # there might not be an alias. In both cases we assume # that the module is not upstreamed. mod=$1 mod_alias=$2 modname=$(/sbin/modprobe --resolve-alias ${mod_alias} 2>/dev/null) if [ $? = 0 -a "$modname" != "" ] ; then echo $modname else echo $mod fi } # starts after vmci is loaded vmware_start_vsock() { real_vmci=$(vmware_real_modname $vmci $vmci_alias) if [ "`isLoaded "$real_vmci"`" = 'no' ]; then # vsock depends on vmci return 1 fi real_vsock=$(vmware_real_modname $vsock $vsock_alias) vmware_load_module $real_vsock vmware_rm_stale_node vsock # Give udev 5 seconds to create our node vmware_delay_for_node "/dev/vsock" 5 if [ ! -e /dev/vsock ]; then local minor=`cat /proc/misc | grep vsock | awk '{print $1}'` mknod --mode=666 /dev/vsock c 10 "$minor" else chmod 666 /dev/vsock fi return 0 } # unloads before vmci vmware_stop_vsock() { real_vsock=$(vmware_real_modname $vsock $vsock_alias) vmware_unload_module $real_vsock rm -f /dev/vsock } is_ESX_running() { if [ ! -f "$vmdb_answer_SBINDIR"/vmware-checkvm ] ; then echo no return fi if "$vmdb_answer_SBINDIR"/vmware-checkvm -p | grep -q ESX; then echo yes else echo no fi } # # Start vmblock only if ESX is not running and the config script # built/loaded it (kernel is >= 2.4.0 and product is tools-for-linux). # Also don't start when in open-vm compat mode # is_vmblock_needed() { if [ "`is_ESX_running`" = 'yes' -o "$vmdb_answer_OPEN_VM_COMPAT" = 'yes' ]; then echo no else if [ "$vmdb_answer_VMBLOCK_CONFED" = 'yes' ]; then echo yes else echo no fi fi } VMUSR_PATTERN="(vmtoolsd.*vmusr|vmware-user)" vmware_signal_vmware_user() { # Signal all running instances of the user daemon. # Our pattern ensures that we won't touch the system daemon. pkill -$1 -f "$VMUSR_PATTERN" return 0 } # A USR1 causes vmware-user to release any references to vmblock or # /proc/fs/vmblock/mountPoint, allowing vmblock to unload, but vmware-user # to continue running. This preserves the user context vmware-user is # running within. vmware_unblock_vmware_user() { vmware_signal_vmware_user 'USR1' } # A USR2 causes vmware-user to relaunch itself, picking up vmblock anew. # This preserves the user context vmware-user is running within. vmware_restart_vmware_user() { vmware_signal_vmware_user 'USR2' } # Checks if there an instance of vmware-user process exists in the system. is_vmware_user_running() { if pgrep -f "$VMUSR_PATTERN" > /dev/null 2>&1; then echo yes else echo no fi } wrap () { AMSG="$1" while [ `echo $AMSG | wc -c` -gt 75 ] ; do AMSG1=`echo $AMSG | sed -e 's/\(.\{1,75\} \).*/\1/' -e 's/ [ ]*/ /'` AMSG=`echo $AMSG | sed -e 's/.\{1,75\} //' -e 's/ [ ]*/ /'` echo " $AMSG1" done echo " $AMSG" echo " " } #--------------------------------------------------------------------------- # # load_settings # # Load VMware Installer Service settings # # Returns: # 0 on success, otherwise 1. # # Side Effects: # vmdb_* variables are set. #--------------------------------------------------------------------------- load_settings() { local settings=`$DATABASE/vmis-settings` if [ $? -eq 0 ]; then eval "$settings" return 0 else return 1 fi } #--------------------------------------------------------------------------- # # launch_binary # # Launch a binary with resolved dependencies. # # Returns: # None. # # Side Effects: # Process is replaced with the binary if successful, # otherwise returns 1. #--------------------------------------------------------------------------- launch_binary() { local component="$1" # IN: component name shift local binary="$2" # IN: binary name shift local args="$@" # IN: arguments shift # Convert -'s in component name to _ and lookup its libdir local component=`echo $component | tr '-' '_'` local libdir="vmdb_$component_libdir" exec "$libdir"'/bin/launcher.sh' \ "$libdir"'/lib' \ "$libdir"'/bin/'"$binary" \ "$libdir"'/libconf' "$args" return 1 } # END_OF_UTIL_DOT_SH vmware_etc_dir=/etc/vmware-tools # Since this script is installed, our main database should be installed too and # should contain the basic information vmware_db="$vmware_etc_dir"/locations if [ ! -r "$vmware_db" ]; then echo 'Warning: Unable to find '"`vmware_product_name`""'"'s main database '"$vmware_db"'.' echo exit 1 fi # BEGINNING_OF_DB_DOT_SH #!/bin/sh # # Manage an installer database # # Add an answer to a database in memory db_answer_add() { local dbvar="$1" # IN/OUT local id="$2" # IN local value="$3" # IN local answers local i eval "$dbvar"'_answer_'"$id"'="$value"' eval 'answers="$'"$dbvar"'_answers"' # There is no double quote around $answers on purpose for i in $answers; do if [ "$i" = "$id" ]; then return fi done answers="$answers"' '"$id" eval "$dbvar"'_answers="$answers"' } # Remove an answer from a database in memory db_answer_remove() { local dbvar="$1" # IN/OUT local id="$2" # IN local new_answers local answers local i eval 'unset '"$dbvar"'_answer_'"$id" new_answers='' eval 'answers="$'"$dbvar"'_answers"' # There is no double quote around $answers on purpose for i in $answers; do if [ "$i" != "$id" ]; then new_answers="$new_answers"' '"$i" fi done eval "$dbvar"'_answers="$new_answers"' } # Load all answers from a database on stdin to memory (<dbvar>_answer_* # variables) db_load_from_stdin() { local dbvar="$1" # OUT eval "$dbvar"'_answers=""' # read doesn't support -r on FreeBSD 3.x. For this reason, the following line # is patched to remove the -r in case of FreeBSD tools build. So don't make # changes to it. while read action p1 p2; do if [ "$action" = 'answer' ]; then db_answer_add "$dbvar" "$p1" "$p2" elif [ "$action" = 'remove_answer' ]; then db_answer_remove "$dbvar" "$p1" fi done } # Load all answers from a database on disk to memory (<dbvar>_answer_* # variables) db_load() { local dbvar="$1" # OUT local dbfile="$2" # IN db_load_from_stdin "$dbvar" < "$dbfile" } # Iterate through all answers in a database in memory, calling <func>with # id/value pairs and the remaining arguments to this function db_iterate() { local dbvar="$1" # IN local func="$2" # IN shift 2 local answers local i local value eval 'answers="/func>"$dbvar"'_answers"' # There is no double quote around $answers on purpose for i in $answers; do eval 'value="/func>"$dbvar"'_answer_'"$i"'"' "$func" "$i" "$value" "$@" done } # If it exists in memory, remove an answer from a database (disk and memory) db_remove_answer() { local dbvar="$1" # IN/OUT local dbfile="$2" # IN local id="$3" # IN local answers local i eval 'answers="/func>"$dbvar"'_answers"' # There is no double quote around $answers on purpose for i in $answers; do if [ "$i" = "$id" ]; then echo 'remove_answer '"$id" >> "$dbfile" db_answer_remove "$dbvar" "$id" return fi done } # Add an answer to a database (disk and memory) db_add_answer() { local dbvar="$1" # IN/OUT local dbfile="$2" # IN local id="$3" # IN local value="$4" # IN db_remove_answer "$dbvar" "$dbfile" "$id" echo 'answer '"$id"' '"$value" >> "$dbfile" db_answer_add "$dbvar" "$id" "$value" } # Add a file to a database on disk # 'file' is the file to put in the database (it may not exist on the disk) # 'tsfile' is the file to get the timestamp from, '' if no timestamp db_add_file() { local dbfile="$1" # IN local file="$2" # IN local tsfile="$3" # IN local date if [ "$tsfile" = '' ]; then echo 'file '"$file" >> "$dbfile" else # We cannot guarantee existence of GNU coreutils date on all platforms # (e.g. Solaris). Ignore timestamps in that case. date=`date -r "$tsfile" '+%s' 2> /dev/null` || true if [ "$date" != '' ]; then date=' '"$date" fi echo 'file '"$file$date" >> "$dbfile" fi } # Remove file from database db_remove_file() { local dbfile="$1" # IN local file="$2" # IN echo "remove_file $file" >> "$dbfile" } # Add a directory to a database on disk db_add_dir() { local dbfile="$1" # IN local dir="$2" # IN echo 'directory '"$dir" >> "$dbfile" } # END_OF_DB_DOT_SH db_load 'vmdb' "$vmware_db" # Make sure the ESC byte is literal: Ash does not support echo -e rc_done='[71G done' rc_failed='[71Gfailed' # # Global variables # vmblock="vmblock" vmmemctl="vmmemctl" vmxnet="vmxnet" vmblock_mnt="/var/run/vmblock" VMTOOLSD_PID_FILE='/var/run/vmtoolsd.pid' # # Utilities # # BEGINNING_OF_IPV4_DOT_SH #!/bin/sh # # IPv4 address functions # # Thanks to Owen DeLong <owen@delong.com>for pointing me at bash's arithmetic # expansion ability, which is a lot faster than using 'expr' # # Compute the subnet address associated to a couple IP/netmask ipv4_subnet() { local ip="$1" local netmask="$2" # Split quad-dotted addresses into bytes # There is no double quote around the back-quoted expression on purpose # There is no double quote around $ip and $netmask on purpose set -- `IFS='.'; echo $ip $netmask` echo $(($1 & $5)).$(($2 & $6)).$(($3 & $7)).$(($4 & $8)) } # Compute the broadcast address associated to a couple IP/netmask ipv4_broadcast() { local ip="$1" local netmask="$2" # Split quad-dotted addresses into bytes # There is no double quote around the back-quoted expression on purpose # There is no double quote around $ip and $netmask on purpose set -- `IFS='.'; echo $ip $netmask` echo $(($1 | (255 - $5))).$(($2 | (255 - $6))).$(($3 | (255 - $7))).$(($4 | (255 - $8))) } # END_OF_IPV4_DOT_SH # Are we running in a VM? vmware_inVM() { "$vmdb_answer_SBINDIR"/vmware-checkvm >/dev/null 2>&1 } # Is a given module loaded? isLoaded() { local module="$1" /sbin/kldstat | awk 'BEGIN {n = "no";} {if ($5 == "'"$module.ko"'") n = "yes";} END {print n;}' } # Is a given Network interface in use? isInUse() { local interface="$1" LANG=C ifconfig $interface | grep -Eq \ "inet +[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+" if [ "$?" -eq 0 ]; then echo 'yes' else echo 'no' fi } # # Macro definitions # vmware_switch() { "$vmdb_answer_BINDIR"/vmware-config-tools.pl --switch return 0 } # Start the guest virtual memory manager vmware_start_vmmemctl() { /sbin/kldload "$vmmemctl" >/dev/null 2>&1 || exit 1 return 0 } # Stop the guest virtual memory manager vmware_stop_vmmemctl() { if [ "`isLoaded "$vmmemctl"`" = 'yes' ]; then /sbin/kldunload "$vmmemctl" >/dev/null 2>&1 || exit 1 fi return 0 } # Start the virtual ethernet kernel service vmware_start_vmxnet() { if [ "`isLoaded "$vmxnet"`" = 'no' ]; then /sbin/kldload "$vmxnet" > /dev/null 2>&1 || exit 1 fi return 0 } # Stop the virtual ethernet kernel service vmware_stop_vmxnet() { if [ "`isInUse vxn0`" = 'no' ]; then /sbin/kldunload "$vmxnet" >/dev/null 2>&1 || exit 1 fi return 0 } # Identify whether there's a mount mounted on the default vmblock mountpoint is_vmblock_mounted() { if mount -t vmblock | grep -q "on $vmblock_mnt" > /dev/null 2>&1; then echo "yes" else echo "no" fi } # Mount vmblock filesystem vmware_mount_vmblock() { if [ "`is_vmblock_mounted`" = "no" ]; then mkdir -p -m 1777 /tmp/VMwareDnD mkdir -p "$vmblock_mnt" /sbin/mount_vmblock /tmp/VMwareDnD "$vmblock_mnt" || exit 1 fi return 0 } # Unmount vmblock filesystem vmware_unmount_vmblock() { if [ "`is_vmblock_mounted`" = "yes" ]; then # Tell vmware-user to let go of vmblock vmware_unblock_vmware_user # Now we should be able to unmount umount "$vmblock_mnt" fi } # Start the vmblock filesystem vmware_start_vmblock() { if [ "`isLoaded "$vmblock"`" = 'no' ]; then /sbin/kldload "$vmblock" >/dev/null 2>&1 || exit 1 fi vmware_mount_vmblock } # Stop the vmblock filesystem vmware_stop_vmblock() { vmware_unmount_vmblock if [ "`isLoaded "$vmblock"`" = 'yes' ]; then /sbin/kldunload "$vmblock" >/dev/null 2>&1 || exit 1 fi } # # Note: # . Each daemon must be started from its own directory to avoid busy devices # . Each PID file doesn't need to be added to the installer database, because # it is going to be automatically removed when it becomes stale (after a # reboot). It must go directly under /var/run, or some distributions # (RedHat 6.0) won't clean it # # Start the guest OS daemon vmware_start_vmtoolsd() { cd "$vmdb_answer_SBINDIR" && "$vmdb_answer_SBINDIR"/vmtoolsd \ --background "$VMTOOLSD_PID_FILE" } # Stop the guest OS daemon vmware_stop_vmtoolsd() { vmware_stop_pidfile "$VMTOOLSD_PID_FILE" } is_ESX_running() { if "$vmdb_answer_SBINDIR"/vmware-checkvm -p | grep -q ESX; then echo yes else echo no fi } is_vmmemctl_needed() { if [ "$vmdb_answer_VMMEMCTL_CONFED" = 'yes' ]; then echo yes else echo no fi } is_vmxnet_needed() { LANG=C pciconf -l 2>&1 | grep -q 'chip=0x072015ad' if [ "$?" -eq 0 -a "$vmdb_answer_VMXNET_CONFED" = 'yes' ]; then echo yes else echo no fi } # See how we were called. case "$1" in start) exitcode='0' if vmware_inVM; then if [ -e "$vmware_etc_dir"/not_configured ]; then echo "`vmware_product_name`"' is installed, but it has not been ' echo '(correctly) configured for the running kernel.' echo 'To (re-)configure it, invoke the following command: ' echo "$vmdb_answer_BINDIR"'/vmware-config-tools.pl.' echo exit 1 fi echo 'Starting VMware Tools services in the virtual machine:' vmware_exec 'Switching to guest configuration:' vmware_switch exitcode=`expr "$exitcode" + "$?"` if [ "`is_vmmemctl_needed`" = 'yes' ]; then vmware_exec 'Guest memory manager:' vmware_start_vmmemctl exitcode=`expr "$exitcode" + "$?"` fi if [ "`is_vmxnet_needed`" = 'yes' ]; then vmware_exec 'Guest vmxnet fast network device:' vmware_start_vmxnet exitcode=`expr "$exitcode" + "$?"` fi if [ "`is_vmblock_needed`" = 'yes' ]; then vmware_exec 'Blocking file system:' vmware_start_vmblock fi # Signal vmware-user to relaunch itself and maybe restore # contact with the blocking file system. if [ "`is_vmware_user_running`" = 'yes' ]; then vmware_exec 'VMware User Agent:' vmware_restart_vmware_user fi vmware_exec 'Guest operating system daemon:' vmware_start_vmtoolsd exitcode=`expr "$exitcode" + "$?"` else echo 'Starting VMware Tools services on the host:' vmware_exec 'Switching to host config:' vmware_switch exitcode=`expr "$exitcode" + "$?"` fi # if [ "$exitcode" -gt 0 ]; then # Set the 'not configured' flag # touch "$vmware_etc_dir"'/not_configured' # chmod 644 "$vmware_etc_dir"'/not_configured' # db_add_file "$vmware_db" "$vmware_etc_dir"'/not_configured' \ # "$vmware_etc_dir"'/not_configured' #exit 1 #fi ;; stop) exitcode='0' if vmware_inVM; then echo 'Stopping VMware Tools services in the virtual machine:' vmware_exec 'Guest operating system daemon:' vmware_stop_vmtoolsd exitcode=`expr "$exitcode" + "$?"` if [ "`is_vmblock_needed`" = 'yes' ]; then vmware_exec 'Blocking file system:' vmware_stop_vmblock exitcode=`expr "$exitcode" + "$?"` fi if [ "`is_vmmemctl_needed`" = 'yes' ]; then vmware_exec 'Guest memory manager:' vmware_stop_vmmemctl exitcode=`expr "$exitcode" + "$?"` fi if [ "`is_vmxnet_needed`" = 'yes' ]; then vmware_exec 'Guest vmxnet fast network device:' vmware_stop_vmxnet exitcode=`expr "$exitcode" + "$?"` fi else echo -n 'Skipping VMware Tools services shutdown on the host:' vmware_success echo fi ;; status) echo -n 'vmtoolsd ' if vmware_check_pidfile "$VMTOOLSD_PID_FILE"; then echo 'is running' exit 0; else echo 'is not running' exit 1; fi ;; restart) "$0" stop && "$0" start ;; *) echo "Usage: `basename "$0"` {start|stop|status|restart}" exit 1 esac exit 0</owen@delong.com></func></dbvar></dbvar>
-
I just tried this "fix" with pfSense:amd64 2.1.5 on ESXi 5.5.0 build: 1331820 and it isn't working. After restart vmware tools isn't running. Can anyone offer some insight?
-
And is there a not_configured file? If so you didn't comment out the .sh correctly.