Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Situation

I'm using the 2.0 RC2 iso from http://www.zeroshell.org in a VMware ESXi 5.1 virtual machine and am trying to adapt the instructions on HowTo: vmware-tools in ZeroShell for v2.0 as the file layout is a little different.

Initial Deviation from Instructions

The instructions work successfully up to the line to unlink /cdrom/modules and re-link to /Database/rootfs/modules. If you try and work around that by doing the same to the entire /lib folder it won't run any more programs.

Among other things, I believe vmtools needs to modify the content of the /lib/modules directory but in zeroshell, by default, this is stored and run from the CD. I can't change the link for /lib/modules yet because the entire /lib is a symbolic link to /cdrom/lib and is read only. So I'm trying to move /lib to the hdd by running the following but it has errors when running the ln command after unlinking /lib. This breaks everything and I restore from a snapshot to try again.

mkdir /Database/rootfs/lib
cp -a /lib/* /Database/rootfs/lib
unlink /lib && ln -s /Database/rootfs/lib /lib

To get ln work to work on that last line I tried changing it to be "ln -sfn /Database/rootfs/lib /lib"

any ideas on how to install vmware-tools in this VM? I've tried the .img.gz file from their download page and it just has a /dev/sda1 = /boot and /dev/sda2 = an iso9660 CD image and /dev/sda3 has profile storage, which results in the same problem of having to move /lib.

Extra System Info

After extracting the vmtools tar.gz file and before running the rest of the procedure, the system looks like

cat /etc/fstab
tmpfs      /            tmpfs      defaults        1     1
/dev/cdrom              /cdrom              iso9660 ro,remount 0 0
proc          /proc        proc     defaults        0     0
none          /sys         sysfs     remount        0     0
devpts        /dev/pts     devpts   gid=4,mode=620  0     0
shm           /dev/shm     tmpfs    defaults        0     0
usbfs       /proc/bus/usb  usbfs    defaults    0     0

cat /etc/mtab
tmpfs / tmpfs rw 0 0
proc /proc proc rw 0 0
/dev/sr0 /cdrom iso9660 ro 0 0
none /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=4,mode=620 0 0
shm /dev/shm tmpfs rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/sda1 /DB ext4 rw,noatime 0 0
/DB/_DB.001 /Database none rw,bind,noatime 0 0

ls -al / | grep ">"
lrwxrwxrwx    1 root     root           10 Nov 21  2012 bin -> /cdrom/bin
lrwxrwxrwx    1 root     root           10 Nov 21  2012 lib -> /cdrom/lib
lrwxrwxrwx    1 root     root           21 Jul  4 02:57 sbin -> /cdrom/sbin
lrwxrwxrwx    1 root     root           20 Jul  4 02:57 usr -> /cdrom/usr

ls -l /lib/modules
lr-xr-xr-x    1 root     root           14 Nov 21  2012 /lib/modules -> /cdrom/modules

Current Problems

When running "./vmware-install.pl" it complains that it cannot find gcc or the kernel headers, and hence cannot compile modules. I'm particularly after the VMCI module and the memory module would be handy aswell. The distro already comes with a vmxnet3 driver and paravirtual disk controller driver so I don't need to compile those.

With the below instructions it looks like it is running fine, but if I try and use the viClient to shutdown or restart the VM it gives me the error: "The request to Reset this virtual machine failed because the corresponding VMware Tools script did not run successfully. If you have configured a custom reset script in this virtual machine, make sure that it contains no errors."

when I go to the shell and try and run what I think is the command to shutdown it says

/etc/vmware-tools/poweroff-vm-default poweroff-vm /etc/vmware-tools
Thu Jul 4 09:29:44 CEST 2013 : Executing '/etc/vmware-tools/poweroff-vm-default'
Thu Jul 4 09:29:44 CEST 2013 : Executing '/etc/vmware-tools/scripts/vmware/network'

Jul 04 09:29:44 network: ifup not in search path.

Current Method to Install VMtools

Ensure that the linux.iso file is connected to cd2 and then paste the following code in to the console

mkdir /mnt/cd2
chmod 555 /mnt/cd2
mount -t auto /dev/sr1 /mnt/cd2
cp /mnt/cd2/VMwareTools*.tar.gz /Database
cd /Database
tar -xvzf VMwareTools*.tar.gz
rm -f VMwareTools*.tar.gz
umount /dev/sr1


cd /Database
mkdir rootfs 
cd rootfs 
mkdir sbin
mkdir usr
cp -a /sbin/* /Database/rootfs/sbin
cp -a /usr/* /Database/rootfs/usr

mount -o remount,rw /
unlink /sbin && ln -s /Database/rootfs/sbin /sbin
unlink /usr && /cdrom/usr/bin/ln -s /Database/rootfs/usr /usr


mkdir /Database/rootfs/lib
cp -a /lib/* /Database/rootfs/lib
rm -f /Database/rootfs/lib/modules
cp -a /cdrom/modules /Database/rootfs/lib/modules
cd /Database/rootfs/lib

ln -sfn /Database/rootfs/lib /lib

mkdir /Database/vmware-tools
cd /Database/vmware-tools
mkdir etc
cd etc
mkdir init.d
mkdir rc.d
cd rc.d
mkdir rc0.d
mkdir rc1.d
mkdir rc2.d
mkdir rc3.d
mkdir rc4.d
mkdir rc5.d
mkdir rc6.d

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

ensure the paths all start with ''/Database/vmware-tools/'' and when manually typing ensure that they end with a trailing /

Then you're ready to configure. Say no to everything, it complains about not being able to find gcc or kernel headers and hence cannot compile modules like the vmci module to allow communication with the host for commands like shutdown guest. <---- This is a problem

cd /Database/vmware-tools/usr/bin
./vmware-config-tools.pl

VMtools will currently be running, but to ensure that it starts with the machine paste in the below

cd /Database/vmware-tools
mkdir startup 
mkdir startup/etc 
mkdir startup/etc/vmware-tools 
cp -a /etc/vmware-tools/* /Database/vmware-tools/startup/etc/vmware-tools

cat <<EOF > /Database/vmware-tools/startup/run.sh
#!/bin/bash 
mount -o remount,rw / 

unlink /usr && /cdrom/usr/bin/ln -s /Database/rootfs/usr /usr 
unlink /sbin && ln -s /Database/rootfs/sbin /sbin 
ln -sfn /Database/rootfs/lib /lib

cp -a /Database/vmware-tools/startup/etc/* /etc 

/Database/vmware-tools/etc/rc.d/vmware-tools start
EOF
chmod 766 /Database/vmware-tools/startup/run.sh

Now WebLogin into ZeroShell. Go to the panel “Startup/Cron”, select “post boot”, enable status, and add the following line: ''/Database/vmware-tools/startup/run.sh''

share|improve this question
add comment

1 Answer

I would suggest trying bind mounts (like /Database already is) rather than the unlink/relink games that page has you play.

Try something like /Database/rootfs/lib/modules /lib/modules none rw,bind 0 0 in /etc/fstab for /lib/modules.

Alternatively, I assume your problem replacing the /lib symlink was that commands started to fail immediately after the /lib symlink was removed. That's likely because the replacement was not atomic. You might have better luck with ln -sfT /Database/rootfs/lib /lib as that should be more atomic if not, in fact, actually atomic (I don't know offhand).

share|improve this answer
    
except /etc is in RAM on a tmpfs and is lost on reboot and I don't know if I can change its contents before it has already mounted the file systems. Zeroshell's ln doesn't support the T option so I tried the "ln -sfn /Database/rootfs/lib /lib" and that did the trick. Now to see if I can get through the rest... –  BeowulfNode42 Jul 4 '13 at 4:14
    
You don't need to make the change before things get mounted normally. You can always remount them later by calling mount appropriately. Though not having those mounts available on boot is certainly going to make starting the vmware tools at boot a bit tougher. (Though that's the case for the unlink/relink stuff you were already doing too, no?) –  Etan Reisner Jul 4 '13 at 4:17
    
yes, so it has to run an extra script when it boots. I've updated my question with the current method of install that includes this script. –  BeowulfNode42 Jul 4 '13 at 7:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.