Problem with driver version 418 on Ubuntu 16.04 -- login loop

Hi! I’m stuck in a login loop on Ubuntu 16.04.

I had been using version 418 with no issues for a while, but today I tried to update to version 430 to see if it would help with an issue I had with a new monitor. To update, I selected version 430 under the “Additional Drivers” in ubuntu’s software update center.

Upon rebooting, I found I was stuck in a login loop (successful logins return me back to the login screen). I then logged in through tty1 and purged the drivers (apt-get autoremove --purge nvidia*), rebooted, and was able to successfully login.

Next, I went back into the “Additional Drivers” section and selected the original version 418 so I could at least keep using nvidia drivers. However, upon rebooting, I’m stuck back in a login loop. Any idea what I should try next?

Other relevant info:

  • Secure boot is disabled
  • I tried booting with/without the nomodeset kernel flag, it didn’t help.
  • Running nvidia-smi after booting says that it’s failed to communiate with the NVIDIA driver.
  • Running prime-select nvidia says that nvidia 418 is already selected.

How do I attach a bug report here? I don’t see any options to attach a file.

All right, solved this. At one point, I tried reinstalling just the driver package (apt-get install --reinstall nvidia-418) and I noticed the following message during the install:

Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.

A little investigation showed that the header files for my kernel (as shown by uname -r) were not installed. The easy fix from there was apt-get install linux-headers-$(uname -r), and then reinstalling the nvidia driver. Everything works now!