1. 程式人生 > >Vboxmanage修改uuid報錯的解決辦法

Vboxmanage修改uuid報錯的解決辦法

我的環境:

Virtualbox 4.3.10 r93012

作業系統:win7

問題:Virtualbox在使用拷貝的虛擬盤時會提示uuid衝突:

Because a hard disk with uuid ‘’ already exists.

 

按照網上的說法,執行VBoxManage修改uuid報錯:

D:\Program Files\Oracle\VirtualBox>VBoxManage  internalcommands sethduuid D:\vm\

rac1\model.vdi

VBoxManage.exe: error: Failed to create the VirtualBox object!

VBoxManage.exe: error: Code E_INVALIDARG (0x80070057) - One or more arguments ar

e invalid (extended info not available)

VBoxManage.exe: error: Most likely, the VirtualBox COM server is not running or

failed to start.

解決辦法:

將vboxmanage修改為以相容模式執行這個程式即可,如下圖:

重新執行命令即可:

D:\Program Files\Oracle\VirtualBox>VBoxManage  internalcommands sethduuid D:\vm\

rac1\model.vdi

UUID changed to: f52953fb-b3d1-400c-b345-dc4de6acaf75

update at 20180722:

現在VBOX版本是5.2.0 r118431 (Qt5.6.2)

這個版本下只執行命令修改uuid已經不行了:

C:\Users\mipeng>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands sethduuid "E:\vm\oel6_12c\oel6NewVirtualDisk2.vdi"
UUID changed to: f9bbef07-c078-4df0-9869-6f27bddf9156

執行完這個命令後,*.vbox中的uuid並沒有被修改過來,開啟虛擬機器還是有之前的報錯,

解決辦法是:

手動修改*.vbox,在HardDisks和AttachedDevice配置中人為修改uuid為新生成的uuid:

<HardDisks>
        <HardDisk uuid="{1ed029bd-6631-414d-bbf7-87c84cfd3fd3}" location="D:/oel6/Oel6.vmdk" format="VMDK" type="Normal"/>
        <HardDisk uuid="{589cc483-9399-4ff2-b2f8-2a79a8b488a2}" location="oel6NewVirtualDisk1.vdi" format="VDI" type="Normal"/>
        <HardDisk uuid="{43ecfec8-74d4-4160-9989-316ad3dbb0cc}" location="oel6NewVirtualDisk2.vdi" format="VDI" type="Normal"/>
        <HardDisk uuid="{d0699e37-eae5-4e58-8cff-e9bff9f5dd2f}" location="NewVirtualDisk1.vdi" format="VDI" type="Normal"/>
        <HardDisk uuid="{747e4a36-f03a-43a0-b079-ad728fa2aa60}" location="rootdisk1.vdi" format="VDI" type="Normal"/>
        <HardDisk uuid="{9ce0bb1e-bc11-4513-a4e9-c1d557d31a31}" location="data2disk2.vdi" format="VDI" type="Normal"/>
        <HardDisk uuid="{0fd10014-ddfe-440f-a1a4-e284f61e47cf}" location="D:/oel6/rootdisk1.vdi" format="VDI" type="Normal"/>
      </HardDisks>

<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
          <Image uuid="{1ed029bd-6631-414d-bbf7-87c84cfd3fd3}"/>
        </AttachedDevice>