#5413 closed defect (worksforme)
VBoxHeadless $? returns 0 on error
回報者: | ToddAndMargo | 負責人: | |
---|---|---|---|
元件: | other | 版本: | VirtualBox 3.0.10 |
關鍵字: | 副本: | ||
Guest type: | Windows | Host type: | Linux |
描述
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=$?
更動歷史 (3)
comment:2 15 年 前 由 編輯
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 $?
"
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.