Start VirtualBox virtual machines on boot
Start VirtualBox virtual machines on boot
Hello Everyone,
If you're using linux and you're looking for a way to autmatically start your VMs with Host/NAT interfaces then here's the solution for you:
http://farfewertoes.com/stories/2008-03 ... s-on-boot/
PS. I think this solution should be mentioned in the VirtualBox user manual under the linux section.
__
xwisdom
http://xwisdomhtml.com
If you're using linux and you're looking for a way to autmatically start your VMs with Host/NAT interfaces then here's the solution for you:
http://farfewertoes.com/stories/2008-03 ... s-on-boot/
PS. I think this solution should be mentioned in the VirtualBox user manual under the linux section.
__
xwisdom
http://xwisdomhtml.com
-
- Volunteer
- Posts: 17798
- Joined: 17. Mar 2008, 13:41
- Primary OS: Debian other
- VBox Version: PUEL
- Guest OSses: Windows XP, Windows 7, Linux
- Location: /dev/random
And why should it be mentioned in the manual? You can just create a laucher for when you log on and turn on automatic logon. Same deal, different method. I don't see the advantage of it being in the manual. It's a users decision to auto start it, and it works just the same as any other program, like a web browser.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
-
- Volunteer
- Posts: 3572
- Joined: 28. May 2008, 08:40
- Primary OS: Ubuntu other
- VBox Version: PUEL
- Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
- Contact:
I agree that this is too detailed for the manual but the reference is of a quality that if we did maintain a Useful links and posts section for each forum, it is usefule enough to find a place.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Google your Q site:VirtualBox.org or search for the answer before posting.
-
- Volunteer
- Posts: 98
- Joined: 11. Jul 2008, 08:10
It's probably too detailed for the manual and could be linked to somewhere, but I take issue with the idea that some human has to logon and launch the VM from the launcher. VBox isn't software for running another OS only from the desktop. People do and will want virtualised services that automatically start at boot. Otherwise what was all work on VBoxHeadless for?Sasquatch wrote:And why should it be mentioned in the manual? You can just create a laucher for when you log on and turn on automatic logon.
-
- Volunteer
- Posts: 17798
- Joined: 17. Mar 2008, 13:41
- Primary OS: Debian other
- VBox Version: PUEL
- Guest OSses: Windows XP, Windows 7, Linux
- Location: /dev/random
Then you can search the forum to find the correct syntax to put in your rc.local file.greenpossum wrote:It's probably too detailed for the manual and could be linked to somewhere, but I take issue with the idea that some human has to logon and launch the VM from the launcher. VBox isn't software for running another OS only from the desktop. People do and will want virtualised services that automatically start at boot. Otherwise what was all work on VBoxHeadless for?Sasquatch wrote:And why should it be mentioned in the manual? You can just create a laucher for when you log on and turn on automatic logon.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
-
- Volunteer
- Posts: 98
- Joined: 11. Jul 2008, 08:10
What makes you think I don't know how to do it? I wrote an init script for Ubuntu for a VM I developed. I could easily write one for any distro you can name, including ones where rc.local is the wrong place to put it. I'm just commenting on your assumption that everyone should be satisfied to run VBox from the desktop.Sasquatch wrote: Then you can search the forum to find the correct syntax to put in your rc.local file.
-
- Volunteer
- Posts: 17798
- Joined: 17. Mar 2008, 13:41
- Primary OS: Debian other
- VBox Version: PUEL
- Guest OSses: Windows XP, Windows 7, Linux
- Location: /dev/random
I didn't mean to put it like that. My main assumption is that VB, by it's manual, expects the user to open it from the Desktop. There are other front ends, but not necessarily for the same purpose.greenpossum wrote:What makes you think I don't know how to do it? I wrote an init script for Ubuntu for a VM I developed. I could easily write one for any distro you can name, including ones where rc.local is the wrong place to put it. I'm just commenting on your assumption that everyone should be satisfied to run VBox from the desktop.Sasquatch wrote: Then you can search the forum to find the correct syntax to put in your rc.local file.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
-
- Volunteer
- Posts: 98
- Joined: 11. Jul 2008, 08:10
Re: opensuse
Do you mean the OP's package or the Ubuntu script I wrote?huijaa wrote:Can it work on OpenSuSE 10.3/11.0 ?
If the one I wrote, not without some massaging for which you have to understand how init scripts are constructed. For one thing, OpenSUSE uses startproc/killproc instead of Debian/Ubuntu's start-stop-daemon. For another thing, on OpenSUSE you have to fill in the metadata at the top of the init script so that SuSEconfig will put the script in the correct point in the boot sequence. Also I made no attempt to generalise it for any VM so bits of it are specific to my VM. They are not hard to discover though. But you're welcome to my script, it's part of my writeup on how to run IPCop in a VM here:
http://www.geocities.com/ken_yap_aus/ipcop-in-vbox.html
ALL of that is WAY overkill...
Under gentoo,
Simply create an install/setup under a seperate user account w/ VBoxManage (with all necessary settings for NAT, VRDP, shares...) and then add the following to
/etc/conf.d/local.start
(or create a script, add it to and call it instead)
vbox-startup.sh
This will start the headless setup w/ VRDP when linux boots.
Here's a simple shutdown script to stop it clean for reboot which I add
/etc/conf.d/local.stop
vbox-shutdown.sh
On a sidenote, VBoxHeadless is causing kernel panics on my server if left to run continuosly. Not sure if this is a problem with 'virtualbox-bin' or other, but I've set VBoxHeadless up to only run during the hours of 7am and 6pm, using cron. Next working on a script for nightly VM snapshots.
Under gentoo,
Simply create an install/setup under a seperate user account w/ VBoxManage (with all necessary settings for NAT, VRDP, shares...) and then add the following to
/etc/conf.d/local.start
(or create a script, add it to and call it instead)
vbox-startup.sh
Code: Select all
su - 'user' VBoxHeadless -s 'VM-name' &
Here's a simple shutdown script to stop it clean for reboot which I add
/etc/conf.d/local.stop
vbox-shutdown.sh
Code: Select all
#!/bin/bash
#run as user vbox
su - vbox VBoxManage controlvm WinXP acpipowerbutton
#sends shutdown to running VM
proc=1
while [ $proc -ne 0 ]
do
sleep 5
#waits 5 seconds cause windows is slow that way
proc=$(ps -fU vbox |grep VBoxHeadless | wc -l)
done
#runs until a 0 count is returned on 'VBoxHeadless' processes
-
- Volunteer
- Posts: 98
- Joined: 11. Jul 2008, 08:10
I think the OP wanted to generalise to start any number of VMs from init scripts.drone1 wrote:ALL of that is WAY overkill...
Incidentally your start and stop scripts are about the same number of lines as a start/stop init script would be. There are a certain amount of commands that have to be issued in any case.