How to install MS VirtualServer/MS VirtualPC Addons on Gentoo Linux

Download Virtual Machine Additions for linux from [1] and install it on VirtualServer/VirtualPC host.

Inside your Gentoo Linux guest machine install rpm2targz for convert rpm additions package.

emerge --ask rpm2targz

Convert rpm additions package

rpm2targz vmadd-kernel-module-RHEL-2.0-1.i386.rpm
rpm2targz vmadd-heartbeat-2.0-1.i386.rpm
rpm2targz vmadd-shutdown-2.0-1.i386.rpm
rpm2targz vmadd-timesync-2.0-1.i386.rpm

Install packages

tar zxvf /root/vmadd-kernel-module-RHEL-2.0-1.i386.tar.gz
tar zxvf /root/vmadd-heartbeat-2.0-1.i386.tar.gz
tar zxvf /root/vmadd-shutdown-2.0-1.i386.tar.gz
tar zxvf /root/vmadd-timesync-2.0-1.i386.tar.gz

and build modules

./vmadd-build.sh

Now you need to modify runscript for Gentoo

Edit /etc/init.d/vmadd as follows.

!/sbin/runscript 
# @file 
# Microsoft Virtual Machine Additions for Linux 
# Provides:       vmadd 
# Description:    VM additions kernel module 
 

kdir=/lib/modules/`uname -r` 
dev=/dev/vmadd 
modname=vmadd 
module=$kdir/misc/$modname 
prepapp=/usr/sbin/vmadd-prepare-module 
dll=/usr/sbin/vmadd.dll 
file="" 
test -f $module.o  && file=$module.o 
test -f $module.ko && file=$module.ko 

test -z "$file" && { eerror "kernel module not found" exit 1 } running() { lsmod | grep -q vmadd[^_-] } start() { ebegin "Starting VM additions " running || { rm -f $dev || { eerror "cannot remove $dev" exit 1 } modprobe $modname || { eerror "modprobe $modname failed" exit 1 } } if [ ! -c $dev ]; then maj=`sed -n 's;([0-9]+) VMAdditions;1;p' /proc/devices` test -z $maj && { rmmod $modname eerror "cannot locate device major" exit 1 } mknod $dev c $maj 0 || { rmmod $modname eerror "cannot create device $dev with major $maj" exit 1 } fi test -x $prepapp && { $prepapp $dll || { rmmod $modname eerror "cannot prepare module" exit 1 } } return 0 } stop() { ebegin "Stopping VM additions " if running; then rmmod $modname || eerror "cannot unload module $modname" rm -f $dev || eerror "cannot unlink $dev" fi return 0 }

Edit /etc/init.d/vmadd-heartbeat as follows.

#!/sbin/runscript 
# Microsoft Virtual Machine Additions for Linux 
# Provides:       vmadd-heartbeat 
# Required-Start: vmadd 
# Required-Stop:  vmadd 
# Description:    VM additions service heartbeat 

PIDFILE="/var/run/heartbeat" 

BINARY=/usr/sbin/vmadd-heartbeatd 

running() { 
   lsmod | grep -q vmadd[^_-] 
} 

start() { 
       ebegin "Starting VM additions service heartbeat" 
       start-stop-daemon --start --exec $BINARY  
         --pidfile $PIDFILE 
       RETVAL=$? 
       test $RETVAL -eq 0 && touch $PIDFILE 
       eend $?
} 

stop() { 
       ebegin "Stopping VM additions service heartbeat" 
       start-stop-daemon --stop --exec $BINARY  
         pidfile $PIDFILE 
       eend $? 
}

Edit /etc/init.d/vmadd-shutdown as follows.

#!/sbin/runscript 
# Microsoft Virtual Machine Additions for Linux 
# Provides:       vmadd-shutdown 
# Required-Start: vmadd 
# Required-Stop:  vmadd 
# Description:    VM additions service shutdown 
 
PIDFILE="/var/run/shutdown" 
BINARY=/usr/sbin/vmadd-shutdownd 

running() { 
   lsmod | grep -q vmadd[^_-] 
} 

start() { 
       ebegin "Starting VM additions service shutdown" 
       start-stop-daemon --start --exec $BINARY  
         --pidfile $PIDFILE 
       RETVAL=$? 
       test $RETVAL -eq 0 && touch $PIDFILE 
       eend $? 
} 

stop() { 
       ebegin "Stopping VM additions service shutdown" 
       start-stop-daemon --stop --exec $BINARY  
         --pidfile $PIDFILE 
       eend $? 
}

Edit /etc/init.d/vmadd-timesync as follows.

#!/sbin/runscript 
# Microsoft Virtual Machine Additions for Linux 
# Provides:       vmadd-timesync 
# Required-Start: vmadd 
# Required-Stop:  vmadd 
# Description:    VM additions service timesync 
 
PIDFILE="/var/run/timesync" 
BINARY=/usr/sbin/vmadd-timesyncd 

running() { 
   lsmod | grep -q vmadd[^_-] 
} 

start() { 
       ebegin "Starting VM additions service timesync " 
       start-stop-daemon --start --exec $BINARY  
         --pidfile $PIDFILE 
       RETVAL=$? 
       test $RETVAL -eq 0 && touch $PIDFILE 
       eend $? 
} 

stop() { 
       ebegin "Stopping VM additions service timesync" 
       start-stop-daemon --stop --exec $BINARY  
         --pidfile $PIDFILE 
       eend $? 
}

Now you are ready for start Linux Additions

rc-update add vmadd-heartbeat default
rc-update add vmadd-shutdown default

If you are running on VirtualServer You may also want this (do not use it on VirtualPC)

rc-update add vmadd-heartbeat default
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s