Re: Re: HowTo: vmware-tools in ZeroShell

Home Page Forums Network Management ZeroShell HowTo: vmware-tools in ZeroShell Re: Re: HowTo: vmware-tools in ZeroShell

#50106

donsaulio
Member

Any success on Version 2 RC2 ? — I can’t get /lib/modules to unlink since is a read only file system, if I copy /lib to /Database/rootfs/lib after removing /lib I can link the new /lib to /Database/rootfs/lib anymore since /lib is missing.

Thanks,

@xmas79 wrote:

Brief history: I was disappointed I couldn’t properly shutdown my ZeroShell VM during (occasional) main server maintenance. So I decided to dig into this adventure… Successfully! Maybe it’s not the cleanest way to do it, but it simply works…

Works on: VMware Server 2.0.0, ZeroShell-1.0.beta12-VMWARE.zip, others not tried.
Tools required: a brain.
Time required: about 15min. (if you know what you’re doing).
Hope: there’s nothing wrong here.

ZeroShell for VMware essentially is a Live distro. It keeps Databases and configurations into a persistent device, but the system itself is set up on a ReadOnly filesystem. Unfortunately, vmware-tools installation needs to create some symbolic link and to copy files into this ReadOnly file system. That means we need to transform it in a ReadWrite one (and persistent! I remember you / is in RAM!). Let’s see what we can do…

Step 1: ReadWrite filesystem setup and vmware-tools installation files copy:
1. Shutdown your VM and install a supplementary CD device mounting vmware-tools disk image. The file is called “linux.iso” and can be found in the VMware installation directory.
2. Start ZeroShell and gain root access in the console (not SSH because vmware-tools installation will reset your network device)
3. Type “loadkeys it” to load Italian keyboard (if you’re Italian of course), because we need to type a lot!
4. Mount the secondary cd with the vmware-tools on a temporary directory


a. mkdir /mnt/hdd
b. mount -t auto /dev/hdd /mnt/hdd

5. Copy tar.gz installation file to the /Database directory and uncompress it

cp /mnt/hdd/VMxxxxxx.tar.gz /Database
cd /Database
tar -xvzf VMxxxxxx.tar.gz

The second CD/DVD has done all his job. We can safely delete this hardware on next reboot.
Now you should have a directory called “vmware-tools-distrib” which contains installation files. What we need now is a ReadWrite copy of the /sbin and /usr:

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

We also need a copy of the current modules directory that is inside /lib:

mkdir modules
cp -a /lib/modules/* /Database/rootfs/modules

Now we are ready to switch to a RW filesystem:

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

Now RW filesystem is ready.

Step 2: Prepararing for vmware-tools installation:

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 rc6.d

Step 3: vmware-tools installation:

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

At this point, vmware installation should ask where we want to install and which folder contains rc0.d, rc1.d etc. folders. Of course you will answer:

/Database/vmware-tools/TheFolderItAsksFor/

So if it asks you “/usr/bin” you’ll answer “/Database/vmware-tools/usr/bin/” and so on… (note the trailing / at the end of the path). It will complaint about non-existing folders. Just accept to create them. Everything that goes to /Database/vmware-tools/xxx is OK.

The installation will terminate properly. Now you only need to “configure” vmware tools:

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

It should complaint that some modules have not been properly configured for your system and asks you to compile. Just tell “NO” to all questions and… Voilà! “vmware-guestd” process should be now running and perfectly working.

Step 4: Post installation.
Vmware-tools sadly creates a “vmware-tools” folder inside /etc… Which is in in RAM!!!! That means if we do not backup this folder, on the next reboot we’ll lose our configuration.

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

Now we only need to restore that folder (and links to vmware files) on every startup. Save the following script “run.sh” in “/Database/vmware-tools/startup”:

#!/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

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

/Database/vmware-tools/etc/init.d/vmware-tools start

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
Save and reboot and enjoy your vmware-tools!

Credits go to Fulvio for this excellent product!
Natale Galioto.

Disclaimer: This information is provided “as is”. The author of this information disclaim any loss or liability, either directly or indirectly as a consequence of applying the information presented herein, or in regard to the use and application of said information. No guarantee is given, either expressed or implied, in regard to the merchantability, accuracy, or acceptability of the information.