| Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
12-10-2010, 03:46 AM
|
#1
|
|
LQ Newbie
Registered: Nov 2004
Posts: 17
Rep:
|
Virtualbox: Howto start a new machine on boot and then stop it on halt
Hello all,
As an environmentally conscious programmer, I decided to retire my old development box and virtualize it instead. So now, I have a GUEST Debian instance running in VirtualBox on top of my linux HOST. I find the setup much better - saves energy, and it's easier to back up and administer.
So, I would like to do the following: I want my GUEST to start when the host boots up. This is not an issue. I will just VBoxHeadless -startvm Debian somewhere on boot.
However, I am a bit fuzzy on how to best go about shutting the GUEST down when the HOST halts. The problem here is that the script that does this must be blocking - i.e. HOST must not halt before the GUEST does shuts down.
Now, I'm not too familiar with writing init scripts, especially upstart scripts that my distribution now uses. I suppose they are blocking, but unless I have to deal with them, I'd rather take a less manual labor approach.
How would I go about this the easiest way? Any suggestions? Any ready-made scripts?
Thanks
|
|
|
|
12-10-2010, 12:40 PM
|
#2
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,357
|
My knowledge is of Slackware not ubuntu but nobody else has answered in more than 24 hours ...
VirtualBox installs a boot/shutdown script that has the VM shutdown capability you ask for. On Slackware it is rc.vboxdrv so it is probably vboxdrv within the upstart directories. rc.vboxdrv can be configured using /etc/default/virtualbox. This usage not described in the VirtualBox 3.2.8 User Manual but is mentioned in a comment in the rc.vboxdrv script. Unfortunately it does not work for me as described in this VirtualBox forum thread. It should be possible to script around this problem but it makes sense to explore the mechanism provided by VirtualBox first.
|
|
|
1 members found this post helpful.
|
12-10-2010, 12:57 PM
|
#3
|
|
LQ Newbie
Registered: Nov 2004
Posts: 17
Original Poster
Rep:
|
Quote:
Originally Posted by catkin
My knowledge is of Slackware not ubuntu but nobody else has answered in more than 24 hours ...
VirtualBox installs a boot/shutdown script that has the VM shutdown capability you ask for. On Slackware it is rc.vboxdrv so it is probably vboxdrv within the upstart directories. rc.vboxdrv can be configured using /etc/default/virtualbox. This usage not described in the VirtualBox 3.2.8 User Manual but is mentioned in a comment in the rc.vboxdrv script. Unfortunately it does not work for me as described in this VirtualBox forum thread. It should be possible to script around this problem but it makes sense to explore the mechanism provided by VirtualBox first.
|
Thanks! That seems to be the proper way to do it.
Thanks again, very helpful.
|
|
|
|
12-10-2010, 01:09 PM
|
#4
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,357
|
Quote:
Originally Posted by cabrilo
Thanks! That seems to be the proper way to do it.
Thanks again, very helpful.
|
Well, it will be helpful if it works! Please let us know how you get on.
|
|
|
|
12-10-2010, 01:36 PM
|
#5
|
|
LQ Newbie
Registered: Nov 2004
Posts: 17
Original Poster
Rep:
|
Quote:
Originally Posted by catkin
Well, it will be helpful if it works! Please let us know how you get on.
|
It works. However, a bit of funny business which may be related to your problem:
If there is a virtual machine running, it works perfectly fine.
However, when there are no virtual machines running, sometimes (and only sometimes!) it fails with this:
Code:
ERROR: failed to create the VirtualBox object!
ERROR: code NS_ERROR_FACTORY_NOT_REGISTERED (0x80040154) - Class not registered (extended info not available)
Most likely, the VirtualBox COM server is not running or failed to start.
Wrong owner (1000) of '/tmp/.vbox-cabrilo-ipc'.
I have no idea what exactly causes it - if I see a better pattern, I'll let you know.
|
|
|
|
12-10-2010, 01:42 PM
|
#6
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,357
|
Quote:
Originally Posted by cabrilo
I have no idea what exactly causes it - if I see a better pattern, I'll let you know.
|
Thanks for the update. Similar symptoms. AFAIK that message (actually I get many, followed by a 30 second sleep) happens when a VM has been started and shutdown before host shutdown. If a solution is not forthcoming I'll have a go at scripting a workaround.
|
|
|
1 members found this post helpful.
|
12-14-2010, 05:20 AM
|
#7
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,357
|
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:09 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|