1

I am using Ubuntu 14.04.2. I have Virtual Box 4.3.26 installed running a headless CentOS VM. I use the vboxautostart-service to start and save the virtual box at startup and shutdown as described here.

In general this works well, however suspending the virtual machine during shutdown takes some time. Unfortunately, the Ubuntu shutdown process does not wait long enough, so that the virtual machine is killed before it is completely saved.

How can I increase the timeout, so that the virtual machine has a chance to suspend?

  • Just make the service return only after the VM is down (remove & or add sleep loop) show us cat /etc/init.d/vbox* for a more specific answer. – user1133275 Apr 23 '15 at 1:31
0

I added simple sleep command to the stop section of the init script as suggested by @user1133275. This works well. Of course this could be optimized, but it is good enough for the time being.

`stop() { [ -z "$VBOXAUTOSTART_DB" ] && exit 0 [ -z "$VBOXAUTOSTART_CONFIG" ] && exit 0

PARAMS="--stop --config $VBOXAUTOSTART_CONFIG"
# prevent inheriting this setting to VBoxSVC
unset VBOX_RELEASE_LOG_DEST

for user in `ls $VBOXAUTOSTART_DB/*.stop`
do
    start_daemon `basename $user | sed -ne "s/\(.*\).stop/\1/p"` $binary $PARAMS
done
sleep 40
return $RETVAL

} `

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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