fth0 wrote:Generally speaking, I'd prefer a different method of repairing a virtual hard disk of a VM:
I'd simply boot the original VM from a GParted Live ISO (or another Linux Live ISO) and repair the virtual hard disk just in place.
If you boot the original VM ( the one to be repaired, just in case if the vm boot ) you cannot modify the filesystem because the root partition is mounted and you cannot umount the root partition.
So you must run another VM and add the default machine as a simple additional hard drive.
I did not see another way to do so.
Anyway this is not my question.
fth0 wrote:When using your method instead, there are some pitfalls to avoid:
...
...
Of course.
Anyway this is not my question.
Now go back to my question : Virtualbox manager does not update vm file config
If you try to configure a new VM from an already registered vdi file you get an error liken :
Code: Select all
Cannot register the hard disk '/data/virtual_LINUX_2/LEAP_15.3_VM_TEST_CONFIG/VDI/LEAP_15.3_VM_TEST_CONFIG.vdi' {289e455f-4c8a-4eca-88b5-2756e1d2cfe3} because a hard disk '/virtual_LINUX_1/LEAP_15.3_VM_1_INITIAL/VDI/LEAP_15.3_VM_1_INITIAL.vdi' with UUID {289e455f-4c8a-4eca-88b5-2756e1d2cfe3} already exists.
Result Code:
NS_ERROR_INVALID_ARG (0x80070057)
Component:
VirtualBoxWrap
Interface:
IVirtualBox {d0a0163f-e254-4e5b-a1f2-011cf991c38d}
Callee RC:
VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)
This is the expected behaviour.
One have a vdi file of a defective VM.
The file is store somewhere, and the defective VM has been deleted from the virtualbox manager.
There is no longer any reference to any of the configuration files of this machine.
You create a
new vm with any iso file of your preferred OS.
You add the defective VM has a secondary disk.
When adding the vdi to be repaired you can see in /home/user/VirtualBox VMs/
new vm/
new vm.vbox :
A new HardDisk is added here :
Code: Select all
<MediaRegistry>
<HardDisks>
<HardDisk uuid="{4b2fd851-faa1-405a-93c6-c7a364894f63}" location="/data/virtual_LINUX_2/CD-RESCUE_VBOX_READ_OTHER_VDI/VDI/CD-RESCUE_VBOX_READ_OTHER_VDI.vdi" format="VDI" type="Normal"/>
---> <HardDisk uuid="{ab2e63c9-5367-4dfe-bc45-2e484f96be87}" location="/data/virtual_LINUX_2/LEAP_15.3_DEFECTIVE_VM/VDI/LEAP_15.3_DEFECTIVE_VM.vdi" format="VDI" type="Normal"/>
</HardDisks>
and there :
Code: Select all
</StorageController>
<StorageController name="SATA" type="AHCI" PortCount="2" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
<Image uuid="{4b2fd851-faa1-405a-93c6-c7a364894f63}"/>
</AttachedDevice>
<AttachedDevice type="HardDisk" hotpluggable="false" port="1" device="0">
---> <Image uuid="{ab2e63c9-5367-4dfe-bc45-2e484f96be87}"/>
</AttachedDevice>
Now once you have finished the job, you remove the secondary disk ( vdi of the failed vm ) using the virtualbox manager.
Examining the .vbox file, the secondary disk has "{ab2e63c9-5367-4dfe-bc45-2e484f96be87}" been removed from the attached device :
Code: Select all
</StorageController>
<StorageController name="SATA" type="AHCI" PortCount="2" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
<Image uuid="{4b2fd851-faa1-405a-93c6-c7a364894f63}"/>
</AttachedDevice>
</StorageController>
</StorageControllers>
But not from hardisk :
Code: Select all
<MediaRegistry>
<HardDisks>
<HardDisk uuid="{4b2fd851-faa1-405a-93c6-c7a364894f63}" location="/data/virtual_LINUX_2/CD-RESCUE_VBOX_READ_OTHER_VDI/VDI/CD-RESCUE_VBOX_READ_OTHER_VDI.vdi" format="VDI" type="Normal"/>
<HardDisk uuid="{ab2e63c9-5367-4dfe-bc45-2e484f96be87}" location="/data/virtual_LINUX_2/LEAP_15.3_DEFECTIVE_VM/VDI/LEAP_15.3_DEFECTIVE_VM.vdi" format="VDI" type="Normal"/>
</HardDisks>
Then you run into problems when adding the repaired VM. :
Code: Select all
Failed to open the disk image file /data/virtual_LINUX_2/LEAP_15.3_REPAIRED_VM/VDI/LEAP_15.3_REPAIRED_VM.vdi.
Cannot register the hard disk '/data/virtual_LINUX_2/LEAP_15.3_REPAIRED_VM/VDI/LEAP_15.3_REPAIRED_VM.vdi' {ab2e63c9-5367-4dfe-bc45-2e484f96be87} because a hard disk '/data/virtual_LINUX_2/LEAP_15.3_DEFECTIVE_VM/VDI/LEAP_15.3_DEFECTIVE_VM.vdi' with UUID {ab2e63c9-5367-4dfe-bc45-2e484f96be87} already exists.
Result Code: NS_ERROR_INVALID_ARG (0x80070057)
Component: VirtualBoxWrap
Interface: IVirtualBox {d0a0163f-e254-4e5b-a1f2-011cf991c38d}
Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)
So the vdi file should also be removed from harddisk paragraph.