I have my old desktop with a old GTX580 and K40. The GTX580 finally burnt out after many years of service. I replaced with an old C2095 since K40 does not have video output. But 16.04 just stopped allowing me to login afterward. I know that it has to be the video driver problem since I came across this nightmare many times before. I used to install the driver directly downloaded from NVIDIA site. I tried to install NVIDIA-Linux-x86_64-375.66 as it seems to be recommended one for C2095. But the driver fails to compile a DKMS module. I finally gave up after many trials. Instead I tried to use the driver from ubuntu (using ubuntu-drivers autoinstall). But still it doesn’t work. Same problem occurs.
Things finally sorted out after I remove K40 (with only C2095) in the machine and use ubuntu-drivers autoinstall to install driver to 384.130. It seems to be working fine now. But of course, I am not going to use this machine to do any CUDA stuff. Anyhow K40 is getting not very efficient in any case.