VirtualBox

15 年 前 建立

15 年 前 結束

#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:1 15 年 前Frank Mehnert 編輯

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.

回覆:  1 comment:2 15 年 前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 15 年 前Frank Mehnert 編輯

狀態: newclosed
處理結果: worksforme
注意: 瀏覽 TracTickets 來幫助您使用待辦事項功能

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette