Loop login or stop at logo on Ubuntu 16.04 LTS kernel 4.15.0-48 (driver 418 or 430)

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.

  1. If there was no xorg.conf, and I installed driver without OpenGL libraries, I could login but Nvidia graphic card was not used.
  2. If there was no xorg.conf, and I installed driver with OpenGL libraries, the endless login problem occurred.
  3. 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.)

Also, I have tried the process wrote in:
https://devtalk.nvidia.com/default/topic/1051051/linux/nvidia-driver-418-or-430-installation-issues-on-ubuntu-190-4-disco-/
But it still didn’t resolve the problem.

xorg.conf:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0@0:2:0"
    Option "AccelMethod" "None"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1@0:0:0"
    Option "ConstrainCursor" "off"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration" "on"
    Option "IgnoreDisplayDevices" "CRT"
EndSection

Could you please give some advice?
Thank you.
nvidia-bug-report.log.gz (1.16 MB)

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 the reply.
After I installed linux-modules-extra, it became black screen.
(with xorg.conf)

And here is the new log file.
nvidia-bug-report-after-install-linux-moudles-extra.log.gz (1.17 MB)

Looks like everything is in place now, you’re just missing the xrandr commands to enable PRIME output:

xrandr --setprovideroutputsource modesetting NVIDIA-0 && xrandr --auto

But since you’re using Ubuntu, you should rather use the ppa drivers, gpumanager and nvidia-prime.

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
  • remove the kernel parameter ‘nomodeset’
  • add the ubuntu graphics ppa https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
  • install the driver from there (sudo apt install nvidia-driver-430)
  • install nvidia-prime (sudo apt install nvidia-prime)
  • switch to nvidia (sudo prime-select nvidia)
  • remove stray blacklist files (sudo rm /lib/modprobe.d/blacklist-nvidia.conf /etc/modprobe.d/blacklist-nvidia.conf)
  • update the initrd (sudo update-initramfs -u)
  • For the LightDM display manager:
    /etc/lightdm/display_setup.sh
#!/bin/sh
  xrandr --setprovideroutputsource modesetting NVIDIA-0
  xrandr --auto

Make the script executable:

# chmod +x /etc/lightdm/display_setup.sh

Configure lightdm to run the script by editing the [Seat:*] section in /etc/lightdm/lightdm.conf:
/etc/lightdm/lightdm.conf

[Seat:*]
  display-setup-script=/etc/lightdm/display_setup.sh
  • copy the xorg.conf to /etc/X11/ in last post
  • reboot