Trying to reproduce on my machine, this is what I get:
List of PCI devices, let's use 01:00.0 being my 3D card:
Code: Select all
noteirak@Max-Laptop-Linux ~ $ lspci
[...]
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 860M] (rev ff)
[...]
Let's create a VM for the occasion and set chipset type to ICH9 (required for PCI attach)
Code: Select all
noteirak@Max-Laptop-Linux ~ $ vboxmanage unregistervm test --delete
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
noteirak@Max-Laptop-Linux ~ $ vboxmanage createvm --name test --register
Virtual machine 'test' is created and registered.
UUID: b77218bd-1b50-46a2-b357-87320aad1338
Settings file: '/home/noteirak/VMs/test/test.vbox'
noteirak@Max-Laptop-Linux ~ $ vboxmanage modifyvm test --chipset ich9
*** I/O APIC must be enabled for ICH9, enabling. ***
Let's try to attach & detach the PCI device:
Code: Select all
noteirak@Max-Laptop-Linux ~ $ vboxmanage modifyvm test --pciattach 01:00.0
noteirak@Max-Laptop-Linux ~ $ vboxmanage modifyvm test --pcidetach 01:00.0
VBoxManage: error: No host PCI device 00000100 attached
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "DetachHostPCIDevice(iHostAddr)" at line 2981 of file VBoxManageModifyVM.cpp
So indeed, it doesn't seem to find it, and interesting that the report host PCI device is "00000100" in the error message, while the adress 01:00.0 is used. At this point I start suspecting a bug.
Let's check the VM config to see if it was added in any way:
Code: Select all
noteirak@Max-Laptop-Linux ~ $ grep -iF -A 5 "<hostpci>" /home/noteirak/VMs/test/test.vbox
<HostPci>
<Devices>
<Device host="256" guest="256" name="host01:00.0"/>
</Devices>
</HostPci>
<EmulatedUSB>
So we do have a configuration entry for the PCI device.
Finally, let's see if we have a PCI entry in the VM config with the --machinereadable options so we get the raw output:
Code: Select all
noteirak@Max-Laptop-Linux ~ $ vboxmanage showvminfo test --machinereadable | grep -i pci
AttachedHostPCI=ff:1f.7,ff:1f.7
Indeed we do.
The address seems to be changed by internal mechanism (the numbers 256 seem to play a role in this). Let's use that address instead and see if we can detach:
Code: Select all
noteirak@Max-Laptop-Linux ~ $ vboxmanage modifyvm test --pcidetach ff:1f.7
VBoxManage: error: No host PCI device 0000ffff attached
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "DetachHostPCIDevice(iHostAddr)" at line 2981 of file VBoxManageModifyVM.cpp
No dice. so something is definitly fishy here. One last test to confirm a bug:
Code: Select all
noteirak@Max-Laptop-Linux ~ $ vboxmanage modifyvm test --pciattach 01:00.0
noteirak@Max-Laptop-Linux ~ $
so I am able to add the same device twice which should not be possible - a check exists in the source code but seems broken then.
Let's recheck the VM config:
Code: Select all
noteirak@Max-Laptop-Linux ~ $ grep -iF -A 5 "<hostpci>" /home/noteirak/VMs/test/test.vbox
<HostPci>
<Devices>
<Device host="256" guest="256" name="host01:00.0"/>
<Device host="256" guest="256" name="host01:00.0"/>
</Devices>
</HostPci>
I will open a ticket on the Bugtracker about this and report back the ticket number.