VirtualBox

Ticket #13773 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

VBoxManage startvm exits with success when there are errors

Reported by: Blrfl Owned by:
Priority: major Component: VM control
Version: VirtualBox 4.3.20 Keywords:
Cc: Guest type: other
Host type: other

Description

This is similar to closed ticket 9642 but has more-specific circumstances.

When starting a guest using VBoxManage, the program exits with success even if an error was encountered and the guest failed to start:

% VBoxManage --version
4.3.20r96996

% VBoxManage import vboxbug.ova --vsys 0 --vmname vboxbug
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting /local/home/xxx/var/hole/vboxbug.ova...
OK.
Disks:  vmdisk1 42949672960     -1      http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized       generic-picos-disk1.vmdk -1       -1
Virtual system 0:
 0: Suggested OS type: "Other"
    (change with "--vsys 0 --ostype <type>"; use "list ostypes" to list all possible values)
 1: VM name specified with --vmname: "vboxbug"
 2: Number of CPUs: 2
    (change with "--vsys 0 --cpus <n>")
 3: Guest memory: 2048 MB
    (change with "--vsys 0 --memory <MB>")
 4: Network adapter: orig Internal, config 3, extra slot=0;type=Internal
 5: Network adapter: orig NAT, config 3, extra slot=1;type=NAT
 6: CD-ROM
    (disable with "--vsys 0 --unit 6 --ignore")
 7: IDE controller, type PIIX4
    (disable with "--vsys 0 --unit 7 --ignore")
 8: IDE controller, type PIIX4
    (disable with "--vsys 0 --unit 8 --ignore")
 9: SATA controller, type AHCI
    (disable with "--vsys 0 --unit 9 --ignore")
10: Hard disk image: source image=generic-picos-disk1.vmdk, target path=/home/xxx/VirtualBox VMs/vboxbug/vboxbug-disk1.vmdk, controller=9;channel=0
    (change target path with "--vsys 0 --unit 10 --disk path";
    disable with "--vsys 0 --unit 10 --ignore")
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully imported the appliance.

# Remove the disk image to force an error condition
% rm /home/xxx/VirtualBox VMs/vboxbug/vboxbug-disk1.vmdk

% VBoxManage startvm vboxbug --type headless
Waiting for VM "vboxbug" to power on...
VBoxManage: error: Could not open the medium ''/home/xxx/VirtualBox VMs/vboxbug/vboxbug-disk1.vmdk.
VBoxManage: error: VD: error VERR_FILE_NOT_FOUND opening image file '/home/xxx/VirtualBox VMs/vboxbug/vboxbug-disk1.vmdk' (VERR_FILE_NOT_FOUND)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component Medium, interface IMedium

% echo $?
0

The log file for the guest doesn't say much interesting except at the very end, which seems to confirm that the exit code being passed through is one for success in spite of the failure:

00:00:00.157344 Power up failed (vrc=VINF_SUCCESS, rc=NS_ERROR_FAILURE (0X80004005))

Some other VBoxManage commands exit correctly, such as:

% VBoxManage startvm nosuchvm --type headless
VBoxManage: error: Could not find a registered machine named 'nosuchvm'
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(pszVM).raw(), machine.asOutParam())" at line 575 of file VBoxManageMisc.cpp

% echo $?
1

This was tested hosts running Linux and OS X. The imported guest type is BSD, but that shouldn't matter since it never powers up.

Change History

comment:1 Changed 3 years ago by frank

Thank you for this report. The fix will be available in the next 4.3.x maintenance release. Changeset r53927 contains the fix.

comment:2 Changed 3 years ago by frank

  • Status changed from new to closed
  • Resolution set to fixed

Fix is part of VBox 4.3.22.

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use