VirtualBox

Opened 5 years ago

Last modified 4 years ago

#18964 new defect

storageattach --hotpluggable while running makes disk unremovable

Reported by: georgesovetov Owned by:
Component: virtual disk Version: VirtualBox 5.2.32
Keywords: Cc:
Guest type: other Host type: Linux

Description

Machine w10 is running. I do: gsovetov@gsovetov:~$ VBoxManage storageattach w10 --storagectl SATA --port 4 --type hdd --medium po.vdi --hotpluggable on VBoxManage: error: The machine is not mutable (state is Running) VBoxManage: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002), component SessionMachine, interface IMachine, callee nsISupports VBoxManage: error: Context: "SetHotPluggableForDevice(Bstr(pszCtl).raw(), port, device, TRUE)" at line 901 of file VBoxManageStorageController.cpp }}}

I expect it to complete successfully as I explicitly enable hot-plugging when actually hot-plugging. But it's not all.

The biggest problem is that the disk get irreversibly associated with the VM! Neither attaching the disk again to this or another VM, nor closemedium, nor Release/Remove in Virtual Media Manager after unregistering the VM help.

gsovetov@gsovetov:~$ VBoxManage storageattach w10 --storagectl SATA --port 4 --type hdd --medium po.vdi 
VBoxManage: error: Cannot attach medium '/home/gsovetov/po.vdi' {47bb8284-7df3-42db-8132-c7d1248ee59d}: medium is already associated with the current state of machine uuid {490c11af-e66f-45fa-9e7d-f9f8ed156169}!
VBoxManage: error: Details: code VBOX_E_OBJECT_IN_USE (0x80bb000c), component MediumWrap, interface IMedium, callee nsISupports
VBoxManage: error: Context: "AttachDevice(Bstr(pszCtl).raw(), port, device, DeviceType_HardDisk, pMedium2Mount)" at line 776 of file VBoxManageStorageController.cpp
gsovetov@gsovetov:~$ VBoxManage showvminfo w10 --machinereadable | grep -iE 'storage|sata'
storagecontrollername0="SATA"
storagecontrollertype0="IntelAhci"
storagecontrollerinstance0="0"
storagecontrollermaxportcount0="30"
storagecontrollerportcount0="8"
storagecontrollerbootable0="on"
"SATA-0-0"="/home/gsovetov/VirtualBox VMs/w10/Snapshots/{e27504b0-359a-4caf-bbaa-6770cc83fff1}.vdi"
"SATA-ImageUUID-0-0"="e27504b0-359a-4caf-bbaa-6770cc83fff1"
"SATA-1-0"="none"
"SATA-2-0"="none"
"SATA-3-0"="none"
"SATA-4-0"="none"
"SATA-5-0"="none"
"SATA-6-0"="none"
"SATA-7-0"="none"
gsovetov@gsovetov:~$ VBoxManage list hdds | grep -C5 po

UUID:           47bb8284-7df3-42db-8132-c7d1248ee59d
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /home/gsovetov/po.vdi
Storage format: VDI
Capacity:       100 MBytes
Encryption:     disabled

gsovetov@gsovetov:~$ VBoxManage showmediuminfo po.vdi 
UUID:           47bb8284-7df3-42db-8132-c7d1248ee59d
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /home/gsovetov/po.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       100 MBytes
Size on disk:   2 MBytes
Encryption:     disabled
In use by VMs:  w10 (UUID: 490c11af-e66f-45fa-9e7d-f9f8ed156169)
gsovetov@gsovetov:~$ VBoxManage unregistervm w10  
gsovetov@gsovetov:~$ VBoxManage showmediuminfo po.vdi 
UUID:           47bb8284-7df3-42db-8132-c7d1248ee59d
Parent UUID:    base
State:          created
Type:           normal (base)
Location:       /home/gsovetov/po.vdi
Storage format: VDI
Format variant: dynamic default
Capacity:       100 MBytes
Size on disk:   2 MBytes
Encryption:     disabled
VBoxManage: error: Could not find a registered machine with UUID {490c11af-e66f-45fa-9e7d-f9f8ed156169}
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(machineIds[i], pMachine.asOutParam())" at line 1375 of file VBoxManageDisk.cpp
gsovetov@gsovetov:~$ VBoxManage closemedium /home/gsovetov/po.vdi
VBoxManage: error: Medium '/home/gsovetov/po.vdi' cannot be closed because it is still attached to 1 virtual machines
VBoxManage: error: Details: code VBOX_E_OBJECT_IN_USE (0x80bb000c), component MediumWrap, interface IMedium, callee nsISupports
VBoxManage: error: Context: "Close()" at line 1648 of file VBoxManageDisk.cpp

The only way to detach it is to power off all VMs, wait for VBoxSVC to terminate, then manually remove the record from XML file, then run GUI and open Virtual Media Manager and remove the disk there.

Change History (2)

comment:1 by georgesovetov, 5 years ago

The first command:

gsovetov@gsovetov:~$ VBoxManage storageattach w10 --storagectl SATA --port 4 --type hdd --medium po.vdi --hotpluggable on
VBoxManage: error: The machine is not mutable (state is Running)
VBoxManage: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "SetHotPluggableForDevice(Bstr(pszCtl).raw(), port, device, TRUE)" at line 901 of file VBoxManageStorageController.cpp

in reply to:  1 comment:2 by Squ!d, 4 years ago

Replying to georgesovetov:

The first command:

gsovetov@gsovetov:~$ VBoxManage storageattach w10 --storagectl SATA --port 4 --type hdd --medium po.vdi --hotpluggable on
VBoxManage: error: The machine is not mutable (state is Running)
VBoxManage: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "SetHotPluggableForDevice(Bstr(pszCtl).raw(), port, device, TRUE)" at line 901 of file VBoxManageStorageController.cpp

VBoxManage: error: The machine is not mutable (state is Running)

From what I noticed you have the system running hotpluggable can only be turn on\off when it is not currently running.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use