Ubuntu Jaunty 9.04 Startup Script

Discussions related to using VirtualBox on Linux hosts.
Post Reply
jonathanross
Posts: 8
Joined: 1. May 2009, 10:50
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Ubuntu Jaunty 9.04 Startup Script

Post 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 :oops:
baf
Volunteer
Posts: 829
Joined: 27. Sep 2008, 06:18
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,xp,win7
Location: Luleå or Skellefteå, Sweden

Re: Ubuntu Jaunty 9.04 Startup Script

Post by baf »

First impression:
It should be VBoxManage
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
jonathanross
Posts: 8
Joined: 1. May 2009, 10:50
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Ubuntu Jaunty 9.04 Startup Script

Post by jonathanross »

Thanks for your help, but no joy :cry:

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 :oops:
jonathanross
Posts: 8
Joined: 1. May 2009, 10:50
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Ubuntu Jaunty 9.04 Startup Script

Post by jonathanross »

Okay, scrap that. I can start it off the command line. I must have broken some environment variables during my tests.

JR :oops:
jonathanross
Posts: 8
Joined: 1. May 2009, 10:50
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Ubuntu Jaunty 9.04 Startup Script

Post 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.

:(
cataleptico
Posts: 1
Joined: 7. May 2009, 08:11
Primary OS: Ubuntu 8.04
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: xp, debian

Re: Ubuntu Jaunty 9.04 Startup Script

Post 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.
jonathanross
Posts: 8
Joined: 1. May 2009, 10:50
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Ubuntu Jaunty 9.04 Startup Script

Post by jonathanross »

THANK YOU !

That's great.

JR :D
jonathanross
Posts: 8
Joined: 1. May 2009, 10:50
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Ubuntu Jaunty 9.04 Startup Script

Post 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
markba
Posts: 99
Joined: 1. Oct 2007, 23:50
Location: The Netherlands

Re: Ubuntu Jaunty 9.04 Startup Script

Post 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.
VBoxTool: VirtualBox automation tools http://vboxtool.sourceforge.net/
jonathanross
Posts: 8
Joined: 1. May 2009, 10:50
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Ubuntu Jaunty 9.04 Startup Script

Post by jonathanross »

Thanks, Mark.

If you wouldn't mind posting any findings here it'd be greatly appreciated !!

JR :)
markba
Posts: 99
Joined: 1. Oct 2007, 23:50
Location: The Netherlands

Re: Ubuntu Jaunty 9.04 Startup Script

Post 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.
VBoxTool: VirtualBox automation tools http://vboxtool.sourceforge.net/
markba
Posts: 99
Joined: 1. Oct 2007, 23:50
Location: The Netherlands

Re: Ubuntu Jaunty 9.04 Startup Script

Post 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
jonathanross
Posts: 8
Joined: 1. May 2009, 10:50
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: XP

Re: Ubuntu Jaunty 9.04 Startup Script

Post by jonathanross »

Thank you !

Will give it a shot !

JR
dmgeurts
Posts: 3
Joined: 3. Sep 2009, 01:52
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: w2003, Debian, Ubuntu

Re: Ubuntu Jaunty 9.04 Startup Script

Post 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.
Post Reply