Startup Script for Ubuntu 8.10

Discussions related to using VirtualBox on Linux hosts.
Post Reply
christr
Posts: 6
Joined: 28. Mar 2009, 20:21
Primary OS: Ubuntu 8.10
VBox Version: OSE Debian
Guest OSses: Solaris, WinXP

Startup Script for Ubuntu 8.10

Post by christr »

I've written the following script to start my Virtual Boxes in the background on my Ubuntu machine. One VM is Solaris 10, and the other is WinXP. Can anyone give me some ideas on what I might be doing wrong? I've pasted the info from my machine below. The problem is that these machines will not boot at startup. But, if I su to root after the machine has booted and kick off the script manually they startup just fine. It's probably something simple, but I must be too close to the problem.

Code: Select all

root@tabasco:~# ls -la /etc/rc3.d | grep S99vbox
lrwxrwxrwx   1 root root    16 2009-03-22 13:51 S99vbox -> /etc/init.d/vbox
root@tabasco:~# cat /etc/init.d/vbox
#!/bin/sh

# Startup Virtual Machines.

case $1 in
'start' )
su chris -c '/usr/bin/VBoxHeadless -v off -s tabasco01 &'
su chris -c '/usr/bin/VBoxHeadless -v off -s tabasco02 &' 

   ;;
'stop' )
su chris -c '/usr/bin/VBoxManage controlvm tabasco01 poweroff'
su chris -c '/usr/bin/VBoxManage controlvm tabasco02 poweroff'
   ;;
*)
   echo "usage: `basename $0` {start|stop}"
esac
root@tabasco:~#
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Startup Script for Ubuntu 8.10

Post by Sasquatch »

I created a code block for you, do that yourself next time.

Now the issue here, is that you have it only on one run-level. The point of start and stop scripts, is that you create an init.d script, then run update-rc.d. See http://www.debian-administration.org/articles/28 and http://www.annodex.net/cgi-bin/man/man2 ... ate-rc.d+8 for more information. Sxx scripts in the run-levels are for Shutdown. Kxx scripts are for boot.
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.
christr
Posts: 6
Joined: 28. Mar 2009, 20:21
Primary OS: Ubuntu 8.10
VBox Version: OSE Debian
Guest OSses: Solaris, WinXP

Re: Startup Script for Ubuntu 8.10

Post by christr »

Thank you very much! That fixed it. I'm used to manually creating soft links for my scripts in other Unix OS's, such as Solaris. That solved my problem. The VMs are now starting at bootup as expected. I've included what I did below.

Code: Select all

chris@tabasco:~$ sudo update-rc.d vbox start 99 2 3 4 5 . stop 99 0 1 6 .
[sudo] password for chris: 
 Adding system startup for /etc/init.d/vbox ...
   /etc/rc0.d/K99vbox -> ../init.d/vbox
   /etc/rc1.d/K99vbox -> ../init.d/vbox
   /etc/rc6.d/K99vbox -> ../init.d/vbox
   /etc/rc2.d/S99vbox -> ../init.d/vbox
   /etc/rc3.d/S99vbox -> ../init.d/vbox
   /etc/rc4.d/S99vbox -> ../init.d/vbox
   /etc/rc5.d/S99vbox -> ../init.d/vbox
chris@tabasco:~$ 
Also, just FYI --
Sxx scripts in the run-levels are for Shutdown. Kxx scripts are for boot.
--- it's actually the other way around (Sxx = startup, and Kxx = shutdown/kill).
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Startup Script for Ubuntu 8.10

Post by Sasquatch »

christr wrote:Also, just FYI --
Sxx scripts in the run-levels are for Shutdown. Kxx scripts are for boot.
--- it's actually the other way around (Sxx = startup, and Kxx = shutdown/kill).
Ah, my bad.

Glad it works. Do some homework, and you certainly don't want to do everything yourself, you will waste a lot of time with that. Why run Debian with pre-build packages when you can run Gentoo and compile everything from source ;).
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.
Post Reply