Opened 15 years ago
Last modified 15 years ago
#3797 closed defect
VBoxManage openmedium reports failure on connecting disk images but does it, however fails setting type as immutable — at Initial Version
| Reported by: | Roberto Muscedere | Owned by: | |
|---|---|---|---|
| Component: | virtual disk | Version: | VirtualBox 2.2.0 |
| Keywords: | Cc: | ||
| Guest type: | other | Host type: | Linux |
Description
I'm modifying a script which I have used for VirtualBox 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:
1) Create a VDI disk image (/tmp/a.vdi) - guest OS independent:
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
2) To show that this is not an issue of re-attaching an already attached image, I will purge the VBox database
rm ~/.VirtualBox
3) Attach the disk image:
VBoxManage openmedium disk /tmp/a.vdi
The following is the output from the command:
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
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.
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
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.
There is a workaround: we can use "VBoxManage modifyhd" to make it immutable:
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

