I was using Ubuntu 16.04 LTS kernel 4.15.0-45 on Optimus-based laptops, and everything (CUDA + OpenGL display) went well.
I was using 960M with driver 396 in CUDA 9.2 at first, and recently updated to driver 418 with .run which also OK.
But kernel 4.15.0-45 has a xHCI controller bug which will cause xHCI controller dead randomly.
So I had to update the kernel.
When I finished to update to kernel 4.15.0-48, problem occurred.
If there was no xorg.conf, and I installed driver without OpenGL libraries, I could login but Nvidia graphic card was not used.
If there was no xorg.conf, and I installed driver with OpenGL libraries, the endless login problem occurred.
If I tried to use the xorg.conf which worked smoothly before, boot would stop at Ubuntu logo (loading page).
I have tried to install new driver 430 with .run, nothing changed.
Also I have tried to install driver from Ubuntu graphics ppa, still the same result.
(.run can select not to install OpenGL libraries, but nvidia-prime cannot run correctly.
ppa installer can not select OpenGL libraries, but nvidia-prime can do switch.)
The intel gpu kernel driver (i915) is missing, IIRC, it’s in the package linux-modules-extra, did the kernel update forget to install the matching package?
Try updating your system again, maybe it’s installed afterwards, otherwise install it manually.
Thanks for your reply.
I tried to add these to lightdm script, and this time finally log into the desktop.
For using ppa drivers and nvidia-prime, I should do the process below, am I right?
(I have not used gpumanager before, and it seems that it is no need to use it?)
remove the .run installer driver using the --uninstall option