Ubuntu 17.10 boot stuck at message "Started NVIDIA Persistence Daemon" after installing nVidia 384.90

I have made fresh install of Ubuntu 17.10 (fresh, except keeping my old /home partition). Everything seams to work out of the box except after I installed (or actually enable in Additional drivers) the nVidia 384.90 driver system failed to start. I was just getting following error

[ OK ] Started NVIDIA Persistence Daemon.
Stopping NVIDIA Persistence Daemon...
[ OK ] Stopped NVIDIA Persistence Daemon.
Starting NVIDIA Persistence Daemon...

And this goes all over again and again like hundred times and the just stops. The only way out is uninstalling nvidia-384 using recovery mode.

I have tried other versions of the driver as well but with very same result. On shared Intel graphics (Intel® Haswell Mobile) everything works fine.

My config:

Intel i7-4710MQ
nVidia GT 940M

Switch to Discrete Graphics on BIOS

Lenovo P51, UEFI BIOS Version N1UE40W, NVIDIA Quadro M1200 Mobile, Ubuntu 17.10, nvidia-384 installed from software-properties-gtk:

  • Hit Enter at boot time
  • Press F1 for BIOS setup
  • Config
    • Graphics Device
    • Select Discrete Graphics (Default was hybrid graphics)
  • Security
    • Secure Boot
    • Secure Boot
    • Select Disabled (Default enabled). If I don't do this, the NVIDIA driver simply gets ignored (and the boot problem does not happen either)
  • Press F10 to save settings and exit boot menu

I think this makes the battery last less, but I'd rather have a desktop :-)

I also noticed that the problem is not reproducible every time. If I power cycle a few times, I also see the following behaviours:

  • immediate computer restart during boot
  • once everything actually worked

Then check that the GPU is actually being used: How do I check if Ubuntu is using my NVIDIA graphics card?

Possible launchpad bug for this: https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/1714881


$sudo apt-get purge nvidia*  

will work fine. Once the system gets started install the compatible driver.