Oracle VM VirtualBox: Ticket #3797: VBoxManage openmedium reports failure on connecting disk images but does it, however fails setting type as immutable => Fixed in SVNhttps://www.virtualbox.org/ticket/3797
<p>
I'm modifying a script which I have used for <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> 1.6.x to setup a virtual machine for an educational lab. In migrating to 2.2.0 I've noticed some problems. Although I have a work around, it still should be addressed. To show how this error is reproduced I will show a series of simple VBoxManage commands:
</p>
<ol><li>Create a VDI disk image (/tmp/a.vdi) - guest OS independent:
<pre class="wiki">VBoxManage createhd --filename /tmp/a.vdi --size 100 --format vdi --variant standard --type normal
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Disk image created. UUID: fc46a7ef-cf54-487e-ab18-71e65c72077a
</pre></li></ol><ol start="2"><li>To show that this is not an issue of re-attaching an already attached image, I will purge the VBox database
<pre class="wiki">rm ~/.VirtualBox
</pre></li><li>Attach the disk image:
<pre class="wiki">VBoxManage openmedium disk /tmp/a.vdi
</pre></li></ol><p>
The following is the output from the command:
</p>
<pre class="wiki">ERROR: Cannot register the hard disk '/tmp/a.vdi'
with UUID {4c8fb9c9-5300-4d14-a9e5-c28c08cc347c} because a hard disk '/tmp/a.vdi'
with UUID {4c8fb9c9-5300-4d14-a9e5-c28c08cc347c} already exists in the media registry
('/root/.VirtualBox/VirtualBox.xml')
Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox,
callee nsISupports
Context: "OpenHardDisk(Bstr(Filename), AccessMode_ReadWrite, hardDisk.asOutParam())"
at line 1286 of file VBoxManageDisk.cpp
</pre><p>
As you can see the system is stating the image is already in the database, but the database is not there to begin with. Fortunately, the image is registered as it appears in the ~/.VirtualBox/VirtualBox.xml file.
</p>
<pre class="wiki">VBoxManage showhdinfo /tmp/a.vdi
UUID: fc46a7ef-cf54-487e-ab18-71e65c72077a
Accessible: yes
Logical size: 100 MBytes
Current size on disk: 0 MBytes
Type: normal (base)
Storage format: VDI
Location: /tmp/a.vdi
</pre><p>
However, if I try to use the option "--type immutable" with the "openmedium" command, the image does not become immutable and the error is still reported.
</p>
<p>
There is a workaround: we can use "VBoxManage modifyhd" to make it immutable:
</p>
<pre class="wiki">VBoxManage modifyhd /tmp/a.vdi --type immutable
VBoxManage showhdinfo /tmp/a.vdi
UUID: fc46a7ef-cf54-487e-ab18-71e65c72077a
Accessible: yes
Logical size: 100 MBytes
Current size on disk: 0 MBytes
Type: immutable
Storage format: VDI
Location: /tmp/a.vdi
</pre>en-usOracle VM VirtualBox/graphics/vbox_logo2_gradient.pnghttps://www.virtualbox.org/ticket/3797
Trac 0.12tpakWed, 22 Apr 2009 02:47:09 GMThttps://www.virtualbox.org/ticket/3797#comment:1
https://www.virtualbox.org/ticket/3797#comment:1
<p>
I can confirm the same behavior on an Ubuntu 8.10 host. I receive the same error messages as the original poster and the same result - the image is in fact in the database and can be pulled up or seen via the GUI. Adding it to the Library using the GUI Media Manager reports no error. Either way, the vdi is usable.
</p>
TickettpakWed, 22 Apr 2009 03:38:10 GMThttps://www.virtualbox.org/ticket/3797#comment:2
https://www.virtualbox.org/ticket/3797#comment:2
<p>
Upon further experimenting this bug seems like it may be 2 different bugs. I get the same error when issuing the openmedium command with or without the -type immutable parameter. Issuing the modifyhd command works with either version of the openmedium command.
</p>
TicketfrankThu, 23 Apr 2009 11:29:17 GMTdescription changedhttps://www.virtualbox.org/ticket/3797#comment:3
https://www.virtualbox.org/ticket/3797#comment:3
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/3797?action=diff&amp;version=3">diff</a>)
</li>
</ul>
TicketfrankThu, 23 Apr 2009 12:13:04 GMTsummary changedhttps://www.virtualbox.org/ticket/3797#comment:4
https://www.virtualbox.org/ticket/3797#comment:4
<ul>
<li><strong>summary</strong>
changed from <em>VBoxManage openmedium reports failure on connecting disk images but does it, however fails setting type as immutable</em> to <em>VBoxManage openmedium reports failure on connecting disk images but does it, however fails setting type as immutable => Fixed in SVN</em>
</li>
</ul>
<p>
Thanks for the report, all this is fixed in SVN.
</p>
TicketfrankTue, 28 Apr 2009 13:50:07 GMTstatus changed; resolution sethttps://www.virtualbox.org/ticket/3797#comment:5
https://www.virtualbox.org/ticket/3797#comment:5
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
Ticket