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

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

# prevent inheriting this setting to VBoxSVC

for user in `ls $VBOXAUTOSTART_DB/*.stop`
    start_daemon `basename $user | sed -ne "s/\(.*\).stop/\1/p"` $binary $PARAMS
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.