Background:
I have bought myself a thunderbolt eGPU case (Razer Core) and I want to use it with my AMD GPU (Rx480) on Linux. I use Kernel 5.0. Plugging in the eGPU while the PC is running seems to work.
> DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD Radeon (TM) RX 480 Graphics (POLARIS10, DRM 3.27.0, 5.0.16-050016-generic, LLVM 7.0.0)
However, unplugging the GPU freezes the system. Disabling the PCI device with the following command also leads to a freeze:
> sudo sh -c 'echo 1 > /sys/bus/pci/devices/0000:06:04.0/remove'
Apparently the reason for this is, that the graphics driver (amdgpu) is still using the device. So I tried to end the graphics driver:
> sudo modprobe -r amdgpu
modprobe: FATAL: Module amdgpu is in use
The application that uses the driver module is the display manager (lightdm 1.26.0).
What works is to switch to one of the Ctrl-Alt-F1 consoles and execute:
> sudo service lightdm stop
> sudo modprobe -r amdgpu
> sudo sh -c 'echo 1 > /sys/bus/pci/devices/0000:06:04.0/remove'
[Unpluging the eGPU]
> sudo service lightdm start
and then switching back to the desktop (Ctrl-Alt-F7). However, all desktop applications are lost this way.
Question:
Can I somehow remove the amdgpu driver without shutting down lightdm? Or can I restart lightdm without loosing all desktop applications?