#15335 closed defect (invalid)
Empty environment createvm --register fails to finish correctly
回報者: | payo | 負責人: | |
---|---|---|---|
元件: | other | 版本: | VirtualBox 5.0.18 |
關鍵字: | VBoxManage | 副本: | |
Guest type: | Linux | Host type: | Linux |
描述
Oddly, if you run these repros steps fast enough (i.e. <5 seconds) it does not repro
# repro steps mv ~/.VirtualBox ~/V.bk #for testing a clean env mv ~/.config/VirtualBox ~/Vconfig.bk #for testing a clean env VBoxManage createvm --name test --register # exit 0 sleep 10 VBoxManage modifyvm test --memory 8192 # fails, test not found ls -la ~/.VirtualBox # no VirtualBox.xml ls -la ~/.config/VirtualBox # has VirtualBox.xml, even shows where VBoxManage createvm --name test --register # fails, test already exists VBoxManage modifyvm test --memory 8192 # still fails, test not found # test is located, but doesn't seem to use this information
# scenario 2, strange work around mv ~/.VirtualBox ~/V2.bk #for testing a clean env mv ~/.config/VirtualBox ~/Vconfig2.bk #for testing a clean env VBoxManage createvm --name test # don't register sleep 10 # to ensure we are hitting the bug VBoxManage registervm Machines/test/test.vbox # notice the path i used VBoxManage modifyvm test --memory 8192 # works
# scenario 3, better workaround mv ~/.VirtualBox ~/V3.bk #for testing a clean env mv ~/.config/VirtualBox ~/Vconfig3.bk #for testing a clean env mkdir -p ~/.config/VirtualBox mkdir ~/.VirtualBox # just have the dirs appears to be good enough VBoxManage createvm --name test --register sleep 10 # again, just for testing the race bug VBoxManage modifyvm test --memory 8192 # works
更動歷史 (4)
comment:2 9 年 前 由 編輯
Which version of VirtualBox did you use for testing?
You should NOT rename the ~/.VirtualBox and ~/.config/VirtualBox directories while VBoxSVC is running. If there are no special environment variables set then VirtualBox will first look in ~/.VirtualBox and (if that directory does not exist) it will look for ~/.config/VirtualBox and (if that directory does not exist either) it will create ~/.config/VirtualBox.
From the above instructions it is not clear if VBoxSVC was running or not when you renamed the directories. Also in your tests you didn't consider the default machine folder which defaults to $HOME/VirtualBox VMs. If you create a VM and a directory with the VM name already exists then the regstration will fail as well (VBoxManage will display an error). To have a clean environment, better do the following:
#!/bin/sh while pidof VBoxSVC > /dev/null; do echo "waiting for VBoxSVC to terminate" sleep 1 done export VBOX_USER_HOME=$HOME/foobar if [ -d $VBOX_USER_HOME ]; then echo "Directory $VBOX_USER_HOME already exists!" exit 1 fi VBoxManage setproperty machinefolder $VBOX_USER_HOME/Machines VBoxManage createvm --name test --register VBoxManage modifyvm test --memory 8192 ...
comment:3 9 年 前 由 編輯
vbox version (as listed in the ticket) 5.0.18 Stopping the service appears to fix this completely. Thanks Frank.
comment:4 9 年 前 由 編輯
狀態: | new → closed |
---|---|
處理結果: | → invalid |
If you move the directories out of the way while VBoxSVC is running it can happen that the directories/files aren't correctly recreated. The consequence is that global settings (like VM registrations) are lost when VBoxSVC auto-terminates. This happens after 5 seconds without any API client.
So sorry, the description messed up my repro step newlines.