Page 1 of 1

Segfault - delay to run multiple VM on boot

Posted: 2. Jan 2009, 13:35
by virtualpier
Hi all,

I've installed the latest VirtualBox (2.1.0) on Ubuntu 8.04.1 - AMD-64 with uname -a
Linux vm1 2.6.24-22-generic #1 SMP.
I use vboxcontrol script (http://farfewertoes.com/code/vboxcontrol/) to start my VM's on boot (2 Linux Ubuntu 64, let's say A and B).
I've removed the 'networking section' from the script.
When i start only 1 VM (eg. A OR B) on boot everything goes fine but, when i try to start my 2 VM on boot (eg. A AND B), i got the following error:
Dec 30 14:20:34 vm1 kernel: [ 34.954745] vboxdrv: TSC mode is 'synchronous', kernel timer mode is 'normal'.
Dec 30 14:32:31 vm1 kernel: [ 751.207455] VBoxSVC[6736]: segfault at 0 rip 4a796a rsp 41256e00 error 4
Dec 30 14:53:28 vm1 kernel: [ 2006.180719] VBoxSVC[6808]: segfault at 0 rip 4a796a rsp 40908e00 error 4
Dec 30 14:53:28 vm1 kernel: [ 2006.181453] VBoxHeadless[7517]: segfault at 0 rip 7fe093584edc rsp 7fff9cf60e40 error 4
Dec 30 15:35:16 vm1 kernel: [ 35.271881] VBoxDrv: dbg - g_abExecMemory=ffffffff88416640
Dec 30 15:35:16 vm1 kernel: [ 35.271945] vboxdrv: fAsync=0 offMin=0x546 offMax=0x2127
As you know, the /etc/init,d/vboxcontrol script start VM's in the following way:
# RUN
case "$1" in
start)
if [ -f /etc/virtualbox/machines_enabled ]; then

cat /etc/virtualbox/machines_enabled | while read VM; do
log_action_msg "Starting VM: $VM ..."
$SU "$VBOXHEADLESS -s \"$VM\" " &
# $SU "$VBOXMANAGE startvm \"$VM\" -type vrdp"
done
fi
;;
As workaround to fix this issue, i've introduced a "sleep 5". It seems it'is the only way to start more than one VM on boot for me :/
# RUN
case "$1" in
start)
if [ -f /etc/virtualbox/machines_enabled ]; then

cat /etc/virtualbox/machines_enabled | while read VM; do
log_action_msg "Starting VM: $VM ..."
$SU "$VBOXHEADLESS -s \"$VM\" " &
sleep 5
# $SU "$VBOXMANAGE startvm \"$VM\" -type vrdp"
done
fi
;;
Why? Is this a bug? Am i missing something?

Thanks for your attention

Posted: 3. Jan 2009, 01:04
by bb83
Its not a Bug

Code: Select all

$SU "$VBOXHEADLESS -s \"$VM\" " &
# $SU "$VBOXMANAGE startvm \"$VM\" -type vrdp" 
I think you should remove the "&"... Because with the & you may start more than one machine at the same time. Thats a bad idea ;)

Posted: 4. Jan 2009, 18:14
by Sasquatch
bb83 wrote:Its not a Bug

Code: Select all

$SU "$VBOXHEADLESS -s "$VM" " &
# $SU "$VBOXMANAGE startvm "$VM" -type vrdp" 
I think you should remove the "&"... Because with the & you may start more than one machine at the same time. Thats a bad idea ;)
No, on Linux, running something with & at the end means drop it to the background and give the CLI back. If you would run a program, lets say firefox, from a terminal, you won't be able to use the terminal any more. With the & after firefox, you can use it again.
However, if you use &&, it means you want to run another program after it.

Posted: 5. Jan 2009, 21:41
by bb83
No, on Linux, running something with & at the end means drop it to the background and give the CLI back.
You don't need to "daemonize" this command with &(VBoxManage "daemonizes" it self after succesfull execution). Because of this & you may start mulitple vm's at the same time! Thats why the sleep command helps...