Page 1 of 1
Ubuntu Jaunty 9.04 Startup Script
Posted: 1. May 2009, 11:02
by jonathanross
Hi all,
I'm banging my head against a wall with this one. All I need is to start a Vbox machine before login (as a service) as user "jonathan".
I have a script mounting two drives at boot as "root" perfectly:
Code: Select all
mount /dev/sdc1 "/media/VB"
mount /dev/sdb2 "/media/VIRTUAL"
and when I login as "jonathan" the line manually added to "Startup Applications" works fine too with:
vboxmanage startvm "XP Pro"
I just need a VM to start before anyone logs in as part of a "/etc/init.d" script (I used update-rc.d to add the mount script to all the runlevels correctly).
It's probably an enviroment issue. I've tried various combinations of "sudo" and "su -" like:
Code: Select all
su - jonathan -c vboxmanage startvm "XP Pro"
Please help save my sanity !
JR

Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 1. May 2009, 11:11
by baf
First impression:
It should be VBoxManage
Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 1. May 2009, 11:35
by jonathanross
Thanks for your help, but no joy
Looking at it running "VBoxManage startvm "XP Pro" as jonathan fails too, it just works when the "Startup Applications" entry is triggered ...
Code: Select all
VBoxManage startvm "XP Pro"
VirtualBox Command Line Management Interface Version 2.1.4_OSE
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
Waiting for the remote session to open...
[!] Full error info present: true , basic error info present: true
[!] Result Code = NS_ERROR_FAILURE (0x80004005) - Operation failed
[!] Text = Virtual machine 'XP Pro' has terminated unexpectedly during startup
[!] Component = Machine, Interface: IMachine, {ea6fb7ea-1993-4642-b113-f29eb39e0df0}
[!] Callee = <NULL>, {00000000-0000-0000-0000-000000000000}
Argh it must be very simple ! I've followed the other posts here without luck.
JR

Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 1. May 2009, 13:06
by jonathanross
Okay, scrap that. I can start it off the command line. I must have broken some environment variables during my tests.
JR

Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 2. May 2009, 11:21
by jonathanross
Well. I'm disappointed ...
No-one has a VM start as a service pre-login on virtualbox-ose ?
The other non-ose scripts on the forum don't work at all.
The lack of replies is destroying my faith in Virtual Box.

Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 7. May 2009, 08:16
by cataleptico
Hi,
i had the same problem you have, though i wasnt trying to start a vm at login. Basically if i started a vm with VBoxManage startvm from ssh/screen, i would get that same error, but if i did it with the VirtualBox main window (the list of vms) it worked. So i figured i needed to set the DISPLAY envvar:
export DISPLAY=:0
and it worked without the main window open. i hope this helps you.
Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 7. May 2009, 08:42
by jonathanross
THANK YOU !
That's great.
JR

Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 7. May 2009, 09:37
by jonathanross
It helps but I can't quite get it working
All I'm doing is:
Code: Select all
#!/bin/bash
export DISPLAY=":0"; su jonathan -c "/usr/bin/vboxmanage startvm XP"
This works as "root" not as "sudo -s" perfectly but then not during boot.
JR
Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 10. May 2009, 11:09
by markba
I'm investigating this also. As I'm the developer/author of vboxtool, capable of auto starting and stopping sessions, this particular error came up, *after* I upgraded to Jaunty. The vboxtool scripts worked fine until then. Thus, this might me a problem related to Jaunty.
See this bug report in vboxtool (which I created my self):
https://sourceforge.net/tracker/index.p ... id=1111629
My investigations so far: starting sessions with VBoxManage in a system context (e.g. rc.local or the init.d system, used by vboxtool), is showing this error (same as posted above):
Code: Select all
Waiting for the remote session to open...
ERROR: Virtual machine 'Ubuntu JeOS' has terminated unexpectedly during
startup
Details: code NS_ERROR_FAILURE (0x80004005), component Machine, interface
IMachine, callee <NULL>
VBox.log is not showing errors or warnings (see attached log file on the mentioned vboxtool bug), only this:
Code: Select all
00:00:15.545 Changing the VM state from 'DESTROYING' to 'TERMINATED'.
Using 'export DISPLAY=:0' is not helping.
Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 10. May 2009, 11:29
by jonathanross
Thanks, Mark.
If you wouldn't mind posting any findings here it'd be greatly appreciated !!
JR

Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 10. May 2009, 11:36
by markba
Of course,we should work this out together. After this is over, maybe you can use vboxtool also (see my sig), because it's doing exactly what you are doing, only in a more flexible way (by configuration). But first, let's see if we can break this bug.
Here, they seem to have the same problem:
http://bbs.archlinux.org/viewtopic.php?id=71267
Because this is on arch-linux, but quite recent, probably it's a kernel thing.
Also here:
http://ubuntuforums.org/showthread.php?p=7243302
I notified them.
Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 11. May 2009, 21:16
by markba
I've found a solution in this thread:
http://ubuntuforums.org/showthread.php?t=1144800
I preceded the command(s) in vboxtoolinit (which resides in /etc/init.d) with 'nohup' and it magically works!
But it is still a workaround, the real solution lies in solving the bug in the Ubuntu init system:
https://bugs.launchpad.net/ubuntu/+bug/372633
Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 11. May 2009, 22:32
by jonathanross
Thank you !
Will give it a shot !
JR
Re: Ubuntu Jaunty 9.04 Startup Script
Posted: 3. Sep 2009, 01:56
by dmgeurts
Am also on Ubuntu 9.0.4, headless server setup and after a reboot I have to manually start the VM's. my init script has the nohup in there as I installed vboxtools v0.4.
I think it broke last month. Built the server, all was fine. Went on holiday, and now it's busted...

No idea what info to provide or how to troubleshoot, sorry.