How to start VirtualBox automatically? No "boot.local&q

Discussions related to using VirtualBox on Linux hosts.
Post Reply
ShellyCat
Posts: 34
Joined: 10. Feb 2008, 15:52

How to start VirtualBox automatically? No "boot.local&q

Post by ShellyCat »

I read in another post that this is the way to get VirtualBox to start at boot...
adding /etc/init.d/vboxdrv setup to /etc/init.d/boot.local starts vboxdrv during boot
...however, I don't have any "boot.local" anywhere (I've tried find and slocate to no avail). I don't see a solution in the manual.

Is "boot.local" supposed to be a plain-text file?
If so, should I create it (and where)?
Or should I put the command in another file?

I am using Slackware 12 with the kernel 2.6.21.5-smp and I have these:

* "/etc/init.d" -- only has a link to the new location, "/etc/rc.d/init.d
* "/etc/rc.d/init.d" -- only has the README file and the 3 VBox scripts (functions, vboxdrv, vboxnet)
* "/etc/rc.d" -- only has files that start with "rc."
me
Posts: 9
Joined: 16. Feb 2008, 17:48

Post by me »

You only need to auto load the vboxdrv module and issue "/usr/bin/VBoxManage startvm VM -type vrdp" from an init script.

So just do whatever is need for this on Slackware. That is basic system administration and should be covered in Slackware's documentation.

As a Gentoo user I just did:

echo 'vboxdrv' >> /etc/modules.autoload.d/kernel-2.6

and wrote a dead simple init script like:

depend() {
need net
}

start() {
ebegin "Starting Virtual Machines"
su vbox -c "/usr/bin/VBoxManage startvm WinXP -type vrdp"
eend $? "Failed to start Virtual Machines"
}

stop() {
ebegin "Stopping Virtual Machines"
su vbox -c "/usr/bin/VBoxManage controlvm WinXP acpipowerbutton && sleep 10"
eend $? "Failed to stop Virtual Machines"
}

Just translate that to however Slackware does its stuff :)
ShellyCat
Posts: 34
Joined: 10. Feb 2008, 15:52

Post by ShellyCat »

Well, Slackware likes to have init scripts in all different files...but I will research this and see what I come up with.

BTW, thanks for your example script...seems to do even a little more than I was looking for. Once I know I can auto-start VirtualBox I will try something more like you did.
Post Reply