Cannot launch VM after a reboot - medium is already in use

Discussions related to using VirtualBox on Windows hosts.
Post Reply
barefootjon
Posts: 5
Joined: 5. Apr 2021, 17:34

Cannot launch VM after a reboot - medium is already in use

Post by barefootjon »

I'm getting this error:

Cannot attach medium 'C:\Users\611528\VirtualBox VMs\xrae\xrae.vdi' {de34a02d-2ab5-471b-a3cb-c72aaf67688c} from snapshot '268488cf-3b1a-4964-b5f1-1438173584e6': medium is already in use by this snapshot!.

I've been googling all morning. Everything seems to refer to DVD/CD lines needing to be removed in the .vbox file. I tried that and still no luck. I attached the file if that helps.

Is there anyway I can recover this VM? I have a bunch of snapshots but it won't even allow me to use snapshots.

Thanks for any help you can provide

Jon
Attachments
vboxfile.txt
vbox file
(34.17 KiB) Downloaded 10 times
barefootjon
Posts: 5
Joined: 5. Apr 2021, 17:34

Re: Cannot launch VM after a reboot - medium is already in use

Post by barefootjon »

Additional info:

So I can create a new VM and use the vdi file and it comes up. However, it's in an old state and all my most current work is missing. Is there an easy way to get my current state back from the old VM using the new VM?

But I think I just need to fix something in the .vbox file because the vdi file isn't corrupted or anything. The VM just isn't accessible using the existing vbox file.

So in this error that I'm getting:

Cannot attach medium 'C:\Users\611528\VirtualBox VMs\xrae\xrae.vdi' {de34a02d-2ab5-471b-a3cb-c72aaf67688c} from snapshot '268488cf-3b1a-4964-b5f1-1438173584e6': medium is already in use by this snapshot!.

What do those numbers represent in my .vbox file?

The first number is in the .vbox file twice.

First place is here:
<HardDisks>
<HardDisk uuid="{de34a02d-2ab5-471b-a3cb-c72aaf67688c}" location="xrae.vdi" format="VDI" type="Normal">
<HardDisk uuid="{11d8784e-92c9-4e06-9e77-c6f6c302488f}" location="Snapshots/{11d8784e-92c9-4e06-9e77-c6f6c302488f}.vdi" format="VDI">
<HardDisk uuid="{91a110eb-5f8f-4615-9608-38e53138c7cc}" location="Snapshots/{91a110eb-5f8f-4615-9608-38e53138c7cc}.vdi" format="VDI"/>
</HardDisk>
</HardDisk>
</HardDisks>
Second place is here:
<StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
<Image uuid="{de34a02d-2ab5-471b-a3cb-c72aaf67688c}"/>
</AttachedDevice>
</StorageController>

The snapshot number in the error is in the vbox file once and shows the following. This was the very first snapshot I took when I created the VM:
<Snapshot uuid="{268488cf-3b1a-4964-b5f1-1438173584e6}" name="Initial_Good_State" timeStamp="2021-01-27T18:45:30Z" stateFile="Snapshots/2021-01-27T18-45-30-684436500Z.sav">
<Description>First snapshot after installing everything</Description>
Any help appreciated. Thanks
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Cannot launch VM after a reboot - medium is already in use

Post by fth0 »

We should first take a look at the whole tree of virtual disk images before modifying the .vbox file. Please provide the output of

Code: Select all

C:\Program Files\Oracle\VirtualBox\VBoxManage list hdds
Other than that, you could read 5.5. Differencing Images to get a basic understanding of how virtual disk images and snapshots work.
barefootjon
Posts: 5
Joined: 5. Apr 2021, 17:34

Re: Cannot launch VM after a reboot - medium is already in use

Post by barefootjon »

Here are the hdds. They all exist in those directories.

Code: Select all

C:\Users\611528\VirtualBox VMs\xrae>"\Program Files\Oracle\VirtualBox\VBoxManage.exe" list hdds
UUID:           de34a02d-2ab5-471b-a3cb-c72aaf67688c
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       C:\Users\611528\VirtualBox VMs\xrae\xrae.vdi
Storage format: VDI
Capacity:       131072 MBytes
Encryption:     disabled

UUID:           11d8784e-92c9-4e06-9e77-c6f6c302488f
Parent UUID:    de34a02d-2ab5-471b-a3cb-c72aaf67688c
State:          created
Type:           normal (differencing)
Location:       C:\Users\611528\VirtualBox VMs\xrae\Snapshots/{11d8784e-92c9-4e06-9e77-c6f6c302488f}.vdi
Storage format: VDI
Capacity:       131072 MBytes
Encryption:     disabled

UUID:           91a110eb-5f8f-4615-9608-38e53138c7cc
Parent UUID:    11d8784e-92c9-4e06-9e77-c6f6c302488f
State:          created
Type:           normal (differencing)
Location:       C:\Users\611528\VirtualBox VMs\xrae\Snapshots/{91a110eb-5f8f-4615-9608-38e53138c7cc}.vdi
Storage format: VDI
Capacity:       131072 MBytes
Encryption:     disabled
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Cannot launch VM after a reboot - medium is already in use

Post by fth0 »

The xrae.vbox file contains structures for several additional snapshots, see the name attributes below:

Code: Select all

    <Snapshot uuid="{268488cf-3b1a-4964-b5f1-1438173584e6}" name="Initial_Good_State" timeStamp="2021-01-27T18:45:30Z" stateFile="Snapshots/2021-01-27T18-45-30-684436500Z.sav">
      <Description>First snapshot after installing everything</Description>
      <Image uuid="{de34a02d-2ab5-471b-a3cb-c72aaf67688c}"/>
      <Snapshot uuid="{81676a6d-efcc-4df4-a9fa-3ef52f16a8f5}" name="power_off_snapshot" timeStamp="2021-01-27T18:51:32Z">
        <Description>snapshot after vm was powered off</Description>
        <Image uuid="{11d8784e-92c9-4e06-9e77-c6f6c302488f}"/>
        <Snapshot uuid="{ad40ad88-b1a5-4f85-865f-2aabbc6d53ca}" name="March" timeStamp="2021-03-23T14:01:26Z" stateFile="Snapshots/2021-03-23T14-01-26-725099100Z.sav">
          <Image uuid="{91a110eb-5f8f-4615-9608-38e53138c7cc}"/>
          <Snapshot uuid="{39171cb1-91e7-442c-bf65-4181c6038608}" name="Snapshot for March" timeStamp="2021-03-23T14:06:19Z" stateFile="Snapshots/2021-03-23T14-06-19-714976600Z.sav">
            <Image uuid="{93d9a00c-fc5a-42e6-921d-5eec0303faaa}"/>
            <Snapshot uuid="{e4ca2e24-9882-4533-84e8-8d5683216daa}" name="April5" timeStamp="2021-04-05T14:06:10Z" stateFile="Snapshots/2021-04-05T14-06-10-595685800Z.sav">
              <Image uuid="{40fc2d3e-ea0f-47b8-9be3-d6fda7123db5}"/>
    <Image uuid="{edd8322a-1d56-4c02-9db8-23a617098164}"/>
Did you try to delete those snapshots? I can modify the xrae.vbox file so that it will probably be usable again, if you tell me what state it is supposed to represent.

You should not edit a file whose content you do not understand, especially if the file itself tells you not to edit it. ;) Do you still have the original xrae.vbox and xrae.vbox-prev files?
barefootjon
Posts: 5
Joined: 5. Apr 2021, 17:34

Re: Cannot launch VM after a reboot - medium is already in use

Post by barefootjon »

Thanks ftho. Here is my Snapshots directory contents

Code: Select all

01/27/2021  01:46 PM     8,271,534,035 2021-01-27T18-45-30-684436500Z.sav
03/23/2021  09:01 AM     3,054,331,406 2021-03-23T14-01-26-725099100Z.sav
03/23/2021  09:06 AM     5,619,025,024 2021-03-23T14-06-19-714976600Z.sav
04/05/2021  09:07 AM     7,282,283,827 2021-04-05T14-06-10-595685800Z.sav
01/27/2021  01:51 PM       269,484,032 {11d8784e-92c9-4e06-9e77-c6f6c302488f}.vdi
04/05/2021  09:06 AM    72,216,477,696 {40fc2d3e-ea0f-47b8-9be3-d6fda7123db5}.vdi
03/23/2021  09:01 AM   130,861,236,224 {91a110eb-5f8f-4615-9608-38e53138c7cc}.vdi
03/23/2021  09:06 AM     2,347,761,664 {93d9a00c-fc5a-42e6-921d-5eec0303faaa}.vdi
04/05/2021  09:08 AM       255,852,544 {edd8322a-1d56-4c02-9db8-23a617098164}.vdi
I added the prev file as a txt.

Yes, I do have the original files. And no, I did not try to delete any snapshots.

Any help would be greatly appreciated. TIA
Attachments
xrae.vbox-prev.txt
(38.53 KiB) Downloaded 9 times
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Cannot launch VM after a reboot - medium is already in use

Post by fth0 »

Below you'll find an edited version of the xrae.vbox file. There are some uncertainties involved, so I'd suggest the following procedure:

1. Reboot your host, so that no VirtualBox components are running.
2. Make a backup copy of all files, if you don't have one already.
3. Replace the xrae.vbox file with the one attached below. Do not start the VM yet.
4. Use the VBoxManage list hdds command and verify that the UUIDs of the VDI files build a linear chain.
5. If they build a linear chain, start the VirtualBox Manager and see if the snapshot chain looks as expected.
6. If everything looks ok, start the VM.
xrae.vbox.new.txt
Adapted MediaRegistry section to snapshot chain
(34.98 KiB) Downloaded 14 times
barefootjon
Posts: 5
Joined: 5. Apr 2021, 17:34

Re: Cannot launch VM after a reboot - medium is already in use

Post by barefootjon »

OMG, you are awesome. Worked like a charm. You just saved me a couple days of work I stupidly never pushed to the repo. Everything looks just like I left it

Thank you so much!
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Cannot launch VM after a reboot - medium is already in use

Post by fth0 »

You're welcome, and thanks for reporting back.
Post Reply