Ubuntu 16.04: Even with WaylandEnable=false gdm3 and lightdm only load sometimes

I am happy to use either gdm3 or lightdm, but neither are stable on my Ubuntu 18.04 system, they will work for either one or several boots after I take corrective action, but inevitably this results in the greeter not loading - the last few times (at least) I noticed this was immediately after I did a sudo apt update. The graphics card on my Intel Core i5 system is an Nvidia GTX 970, and I manually installed nvidia-driver-415 using apt when I could not load a greeter as soon as I had installed.

Searching here and elsewhere, I have tried many things to resolve this, which I will outline below. If you know something else I can try - to get either greeter stable - please let me know.

gdm3

gdm3:
Installed: 3.28.3-0ubuntu18.04.3

Even with WaylandEnable=false uncommented in /etc/gdm3/custom.conf, I could never login, instead of the greeter I would see either a black screen or graphic distortion like a black screen with some pink lines across the top, and I am only able to login setting nomodeset.

gdm3 sample distortion:

https://i.imgur.com/iTB2YFW.jpg

With gd3 not working, I tried lightdm, and on encountering similar issues switched back to gdm3 again:

sudo apt-get install gdm3
sudo dpkg-reconfigure gdm3

This seemed to work - kind of, for the first few days I could boot most of the time. I have quiet splash permanently removed from my boot options, and boot was sometimes hanging on Started NVIDIA Persistence Daemon as below:

gdm fail 1

https://i.stack.imgur.com/l1Qv4.jpg

Another time with gdm3 I saw the following output instead of the greeter:

gdm fail 2:

https://i.stack.imgur.com/HFgsm.jpg

gdm fail 3:

https://i.stack.imgur.com/V7j78.jpg

lightdm

lightdm:
Installed: 1.26.0-0ubuntu1

When I use lightdm instead, and the greeter does not load, I see a flashing black screen with a single white underscore top left. I can never get to a TTY using ctrl + alt + f3/f4/f5, REISUB does not work, so I hard rebooted, the greeter loads with nomodeset, and from there without logging in I switch to a TTY and I have tried what I outline below. Sometimes if I just reboot again without nomodeset the greeter will just load properly, without my changing anything.

flashing black screen with single white cursor top let:

All pictures of my monitor are now also attached to this post

https://i.imgur.com/WKaFarS.jpg

nvidia-bug-report.log.gz, generated after one first nomodeset login after lightdm fail now attached

Observing these permissions:

-rw-------  1 dusf dusf      56 Jan  7 17:38 .Xauthority
-rw-------  1 dusf dusf   15886 Jan  7 17:38 .ICEauthority
    
drwxrwxrwt 16 root root 4096 Jan  7 17:45 /tmp

I input the following, and could login normally next reboot:

sudo chown dusf:dusf .Xauthority
sudo chown dusf:dusf .ICEauthority
sudo chmod a+wt /tmp

The next time the issue occurred I input the following, and could login next reboot:

sudo dpkg-reconfigure lightdm

In .xsession-errors, I noticed the following line, which I thought could be relevant considering I see an underscore instead of a greeter?

_=/usr/bin/dbus-update-activation-environment

Next temporary fix:

sudo mv .Xauthority .Xauthority.bak

Again:

sudo apt-get purge lightdmsudo apt-get install --reinstall lightdm
sudo apt-get install gnome

After a sudo apt upgrade a few days ago with the same issue recurring I input all of the following and everything seemed fine for a few days:

sudo apt upgradesudo apt purge lightdm
sudo apt purge gnome
sudo apt purge nvidia*
sudo apt remove nvidia-driver-415
reboot
sudo apt purge nvidia-*
sudo apt install nvidia-415
sudo apt install nvidia-driver-415
reboot
sudo apt purge xorg-* xserver-xorg
sudo apt install xorg xserver-xorg
sudo dpkg-reconfigure xorg
sudo apt purge ubuntu-gnome-desktop
sudo apt purge gnome-desktop-environment
apt install ubuntu-gnome-desktop
sudo apt install ubuntu-gnome-desktop
sudo apt purge lightdm
sudo apt install --reinstall lightdm

The next time the issue occurred I noticed in my .bash_history the last commands I input were:

sudo apt update
sudo apt upgrade

and I uploaded the following logs:

/var/log/lightdm/lightdm.log

/var/log/kern.log

.xsession-errors

I read adding an xrandr line to some files may be the next step, but the actual lines seem to be system specific, and their are recommendations on adding them to different files.

How can I begin to resolve the issue, either with gdm3 or lightdm please?
nvidia-bug-report.log.gz (1.05 MB)



You have canonical-livepatch enabled, also the intel gpu still enabled but put it blind using nomodeset kernel parameter. So when canonical-livepatch kicks in, the i915 driver freaks out, blocking everything. Disable the intel gpu in bios or livepatching or both and remove the nomodeset parameter.