VirtualBox

Ticket #5413 (closed defect: worksforme)

Opened 4 years ago

Last modified 4 years ago

VBoxHeadless $? returns 0 on error

Reported by: ToddAndMargo Owned by:
Priority: major Component: other
Version: VirtualBox 3.0.10 Keywords:
Cc: Guest type: Windows
Host type: Linux

Description

Hi All,

Please fix this for me.

I run a script that essentially runs:

/usr/bin/VBoxHeadless --startvm VB-W7

If I set (deliberately or by accident) /dev/fd0 to root.root and 0400 and tell setup to mount the floppy, I get:

VirtualBox Headless Interface 3.0.10 (C) 2008-2009 Sun Microsystems, Inc. All rights reserved.

Listening on port 5014 Error: failed to start machine. Error message: Cannot open host device '/dev/fd0' for read/write access. Check the permissions of that device ('/bin/ls -l /dev/fd0'): Most probably you need to be member of the device group. Make sure that you logout/login after changing the group settings of the current user (VERR_ACCESS_DENIED). Unknown error creating VM (VERR_ACCESS_DENIED)

Which is what it is suppose to do.

Problem: VBoxHeadless returns 0 in $?, which means it ran successfully. This fools my scripts into thinking VBoxHeadless started the VM Successfully.

You can reproduce this with /dev/scd0 and telling setup to mount the DVD drive as well.

Many thanks, -T

p.s. the exact line in my script:

su $DefaultUser -c "/usr/bin/VBoxHeadless --startvm $VM_Name &" > /var/log/VM-Utils.log 2>&1 Status=$?

Change History

comment:1 follow-up: ↓ 2 Changed 4 years ago by frank

Can't reproduce the bug. The exit code is 5 here if such a condition is detected. I guess the problem is su $defaultUser. Try without su.

comment:2 in reply to: ↑ 1 Changed 4 years ago by ToddAndMargo

Replying to frank:

Can't reproduce the bug. The exit code is 5 here if such a condition is detected. I guess the problem is su $defaultUser. Try without su.

Oh poop. You are correct. I am reading the status of "su" and not VBoxHeadless. Sorry for the false report.

-T

Revised command:

Status="su $DefaultUser -c "/usr/bin/VBoxHeadless --startvm $VM_Name &" > $Log 2>&1; echo $?"

comment:3 Changed 4 years ago by frank

  • Status changed from new to closed
  • Resolution set to worksforme
Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use