Ubuntu 12.04 change priority/runlevel of Virtualbox on startup

Getting Virtualbox to automatically start seems to be a pretty big problem if you do a search for "virtualbox ubuntu autostart". Most of the issues seem to be stuck at the same part; Vbox runs just fine when running the "vboxautostart-service" but it just will not start when Ubuntu starts. The problem is the runlevels.

My problem was at most of my apps were starting at the same exact run level of 20. The problem with that is some should be started before others. For instance, my ZFS needed to load before Vbox, but they were loading at the same time causing Vbox to silently fail. I lowered ZFS to start on 19, and spread out how Vbox starts. They now look like this:

S19zfs-mount
S19zfs-share
S20vboxdrv
S21virtualbox
S22vboxautostart-service
S22vboxballoonctrl-service
S22vboxweb-service

Notice I have vboxdrv set to start before the rest of the Vbox services. It's pretty simple to change the order, just be careful. First you want to remove the service from update-rc.d, then add it back in with the new order. Here is an example.

$sudo update-rc.d -f virtualbox remove

$sudo update-rc.d virtualbox defaults 21

For more info on run levels in Ubuntu this site is what I used.

http://www.debuntu.org/how-to-managing-services-with-update-rc-d/

This is the site that pointed me in the correct direction.

http://lifeofageekadmin.com/how-to-set-your-virtualbox-vm-to-automatically-startup/

More reference sites:

https://www.virtualbox.org/manual/ch09.html#autostart

No comments:

Post a Comment