Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 348931 - app-emulation/vmware-server-2.0.2.203138-r1 fail to suspend manually started VMs on OS shutdown
Summary: app-emulation/vmware-server-2.0.2.203138-r1 fail to suspend manually started ...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo VMWare Bug Squashers [disabled]
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-17 10:10 UTC by Norman Back
Modified: 2011-12-17 14:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Norman Back 2010-12-17 10:10:44 UTC
app-emulation/vmware-server-2.0.2.203138-r1 fail to suspend manually started VMs on OS shutdown

This due a dependency of the vmware supplied init script.
I fixed it by updating the /etc/init.d/vmware script to call the vmware supplied script in the expected way:
start() {
        test -x /etc/vmware/init.d/vmware || \
                eend 1 "vmware init script not found. Aborting" || return 1

        /etc/vmware/init.d/rc3.d/S90vmware start | vmware_prettify start
        return $?
}

stop() {
        /etc/vmware/init.d/rc6.d/K08vmware stop | vmware_prettify stop
        return $?
}
Comment 1 Norman Back 2010-12-17 10:16:07 UTC
The fix is included in the description.

Also some of the vmware supplied scripts appear to expect root to in the vmware Administrator role. I added root to the wmware Administrator role before updating the init script and so might also be a requirement for correct shutdown of manually started VMs. 
Comment 2 Norman Back 2010-12-18 11:07:05 UTC
Just for completeness, here is the diff.


*** vmware-server-2.rc  2009-05-09 22:55:17.000000000 +0100
--- /etc/init.d/vmware  2010-12-11 22:20:36.323070485 +0000
***************
*** 59,69 ****
        test -x /etc/vmware/init.d/vmware || \
                eend 1 "vmware init script not found. Aborting" || return 1
  
!       /etc/vmware/init.d/vmware start | vmware_prettify start
        return $?
  }
  
  stop() {
!       /etc/vmware/init.d/vmware stop | vmware_prettify stop
        return $?
  }
--- 59,69 ----
        test -x /etc/vmware/init.d/vmware || \
                eend 1 "vmware init script not found. Aborting" || return 1
  
!       /etc/vmware/init.d/rc3.d/S90vmware start | vmware_prettify start
        return $?
  }
  
  stop() {
!       /etc/vmware/init.d/rc6.d/K08vmware stop | vmware_prettify stop
        return $?
  }
Comment 3 Vadim Kuznetsov (RETIRED) gentoo-dev 2010-12-18 13:44:21 UTC
Thanks. I won't fix. 1.) there are no such folders rc3.d/ or files S* and K*
2.) In systems with rcX.d S* and K* files a just a symlinks. 3) Well, "manual" means manual starts and stop. 
Comment 4 Norman Back 2010-12-18 14:50:05 UTC
You are incorrect.

On my Gentoo system with vmware-server2 installed:
blue ~ # ls -l /etc/vmware/init.d/rc3.d/
total 0
lrwxrwxrwx 1 root vmware 25 Nov 28 00:53 K08vmware -> /etc/vmware/init.d/vmware
lrwxrwxrwx 1 root vmware 25 Nov 28 00:53 S90vmware -> /etc/vmware/init.d/vmware
blue ~ # ls -l /etc/vmware/init.d/rc6.d/
total 0
lrwxrwxrwx 1 root vmware 25 Nov 28 00:53 K08vmware -> /etc/vmware/init.d/vmware

The script /etc/vmware/init.d/vmware check $0 to see how it was called at line 1059 and suspends manually stared VMs if $0 starts with K.

Please fix this in the ebuild for the benefit of other gentoo users.


The script 


Comment 5 Norman Back 2010-12-18 17:05:41 UTC
(In reply to comment #3)
> Thanks. I won't fix. 1.) there are no such folders rc3.d/ or files S* and K*
> 2.) In systems with rcX.d S* and K* files a just a symlinks. 3) Well, "manual"
> means manual starts and stop. 
> 


Hi Vadim

Sorry, I meant to reply not comment

You are incorrect on counts 1, 2 & 3.

1. The app-emulation/vmware-server-2.0.2.203138-r1 build installs /etc/vmware/init.d/rc3.d/ and /etc/vmware/init.d/rc6.d/
2. In systems with rcX.d S* and K* symlinks, these are not 'just' symlinks but are used to start and stop services.
3. On vmware-server2 'manual' means start and stop but on system shutdown, provided it is called via the K08vmware symlink,
   the vmware provided /etc/vmware/init.d/vmware script suspends all running VMs.

On my Gentoo system with vmware-server2 installed:
blue ~ # ls -l /etc/vmware/init.d/rc3.d/
total 0
lrwxrwxrwx 1 root vmware 25 Nov 28 00:53 K08vmware -> /etc/vmware/init.d/vmware
lrwxrwxrwx 1 root vmware 25 Nov 28 00:53 S90vmware -> /etc/vmware/init.d/vmware
blue ~ # ls -l /etc/vmware/init.d/rc6.d/
total 0
lrwxrwxrwx 1 root vmware 25 Nov 28 00:53 K08vmware -> /etc/vmware/init.d/vmware

The script /etc/vmware/init.d/vmware checks the basename of $0 to see how it was called at line
1059 and suspends manually stared VMs if $0 starts with K.

i.e.
#line 1245
SCRIPTNAME="$0"
BASENAME=`basename "$SCRIPTNAME"`
....
#line 1055
         # If the 'K' version of this script is running, the system is
         # stoping services not because the user is running vmware-config.pl
         # or running the initscript directly but because the user wants to
         # shutdown.  Suspend all VMs.
         if [ "`echo $BASENAME | sed -ne '/^K[0-9].vmware/p'`" ] ; then
            if [ -x "$vmdb_answer_BINDIR"/vmrun ] ; then
               for i in `pidof vmware-vmx` ; do
                  "$vmdb_answer_BINDIR"/vmrun suspend `ps -p $i -f | \
                       sed -ne '/vmware/s/.* \(\/.*\.vmx\)/\1/p'` 2> /dev/null
               done
            fi

         fi
....


Please use my supplied diff to fix this ebuild for the benefit of other gentoo users.

Regards
Norman
Comment 6 Vadim Kuznetsov (RETIRED) gentoo-dev 2011-12-17 14:06:45 UTC
(In reply to comment #5)
> 2. In systems with rcX.d S* and K* symlinks, these are not 'just' symlinks but
There is nothing in gentoo that will install that. I mean K*, S*

vmware server was removed from the tree. Bug 374599.