Error removing a GPU from isolation

i tried isolating a gpu earlier to pass thru to a VM but that didnt work. Now i just want to be able to use it for apps again and i cannot because it will not allow itself to be removed from isolated gpu devices. this is the error i get:

 Error: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 198, in call_method
    result = await self.middleware.call_with_audit(message['method'], serviceobj, methodobj, params, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1466, in call_with_audit
    result = await self._call(method, serviceobj, methodobj, params, app=app,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1417, in _call
    return await methodobj(*prepared_call.args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/schema/processor.py", line 187, in nf
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/schema/processor.py", line 47, in nf
    res = await f(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/plugins/system_advanced/gpu.py", line 53, in update_gpu_pci_ids
    await self.middleware.call('boot.update_initramfs')
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1564, in call
    return await self._call(
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1417, in _call
    return await methodobj(*prepared_call.args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/schema/processor.py", line 187, in nf
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/plugins/boot.py", line 234, in update_initramfs
    raise CallError(f'Failed to update initramfs: {cp.stderr}')
middlewared.service_exception.CallError: [EFAULT] Failed to update initramfs: Failed to update initramfs
Traceback (most recent call last):
  File "/usr/local/bin/truenas-initrd.py", line 252, in <module>
    update_pci_initramfs_config(root),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/truenas-initrd.py", line 188, in update_pci_initramfs_config
    set_readonly(root, False)
  File "/usr/local/bin/truenas-initrd.py", line 46, in set_readonly
    os.rename(os.path.join(root, "usr/local/bin/dpkg"), os.path.join(root, "usr/local/bin/dpkg.bak"))
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/dpkg' -> '/usr/local/bin/dpkg.bak'

Hello newguy123,
I am experiencing the same error. My GPU was isolated, and it was passed to a virtual machine without issues. I removed the virtual machine and tried to remove the GPU from isolation. After unchecking the GPU and clicking save the I got an error in line 252 from truenas-initrd.py (update-pci-initramfs_config(root).

After refreshing the GPU disappeared from the isolation list and I was able to isolate it again. However, when I try to use (passthrough) it for a new virtual machine I received and error indicating the GPU is not available.

I already checked this GPU is not used by any other APP or container.

Were you able to deal with your issue?

Not the best solution, but you could try restarting.

Otherwise, it’s probably a bug, and you should perhaps report it if you can repro.