Ubuntu 18.04 doesn't boot to GUI after installing recommended nvidia driver 470

Hi, I’m running into a similar bug to “Ubuntu 18.04 cannot boot after installing recommended nvidia driver 470” (forum won’t let me add more than 1 link). My computer is a single-boot Ubuntu desktop which I recently upgraded from Ubuntu 16.04 to 18.04 with an Nvidia GP104 (Geforce 1080). I didn’t previously install any Nvidia driver as far as I know. Today I attempted to install the recommended driver via:

ubuntu-drivers devices
sudo ubuntu-drivers autoinstall

This installed nvidia-driver-470. After restarting, instead of booting to a desktop, the computer booted to a screen with some text output like “Stopping User Manager for UID 123…”. I was able to get out of this by uninstalling all nvidia packages via:

sudo apt-get remove --purge '^nvidia-.*'
sudo apt-get remove --purge '^libnvidia-.*'
sudo apt-get remove --purge '^cuda-.*'

Here’s the bug report:
nvidia-bug-report.log.gz (117.5 KB)

I tried a few other methods of installing nvidia drivers including using the PPA and using the “additional drivers” found in “Software & Updates” application. All of them result in something like the above.

Has anyone run into this before? Thanks for any help.

You booted a kernel that has no headers installed. Please check that you booted into the correct 18.04 kernel in grub menu, uninstall the runfile driver, install headers sudo apt install linux-headers-$(uname -r) and reinstall the driver using Software&Updates

Thanks for quick response. It doesn’t look like the runfile driver was installed. After running the install headers command, it looks like headers are also already up-to-date:

linux-headers-4.15.0-197-generic is already the newest version (4.15.0-197.208).
The following packages were automatically installed and are no longer required:
  dkms libatomic1:i386 libbsd0:i386 libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libedit2:i386 libelf1:i386 libexpat1:i386 libffi6:i386 libgl1:i386 libgl1-mesa-dri:i386 libglapi-mesa:i386
  libglvnd0:i386 libglx-mesa0:i386 libglx0:i386 libllvm10:i386 libnvidia-compute-470:i386 libnvidia-decode-470:i386 libnvidia-encode-470:i386 libnvidia-fbc1-470:i386 libpciaccess0:i386 libsensors4:i386 libstdc++6:i386 libwayland-client0:i386
  libwayland-server0:i386 libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386
  libxnvctrl0 libxshmfence1:i386 libxxf86vm1:i386 linux-objects-nvidia-470-4.15.0-197-generic linux-signatures-nvidia-4.15.0-197-generic screen-resolution-extra
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

I then re-installed driver 470 via Software & Updates, restarted, and the computer booted to the same text-only screen without terminal prompt.

Something possibly relevant is that I was only able to run nvidia-bug-report.sh when in recovery mode, in case that affects what appears in the bug report. Is it possible that recovery mode does not have headers present for whatever reason?

It was in the install log:

ERROR: Failed to run `/usr/sbin/dkms build -m nvidia -v 515.86.01 -k 4.15.0-197-generic`: Error! Your kernel headers for kernel 4.15.0-197-generic cannot be found.

Maybe the dkms build link is missing. Please check that
exists and is a symlink to the headers directory.