I kept getting issues with the 'this looks like spam' flag and have reduced the post to be particular to my solution rather than the exhaustive list of other possible solutions I came across.
To continue with your current attempted solution
If you want to double check the existence of .Xauthority
run ls -la
for the $HOME
directory which includes options to show hidden files and will let you confirm whether or not the .Xauthority
file is there are not.
If it does, you Should see it along with .xsession-errors
(which should exist since you're having trouble getting out of this boot loop) and allow you to try that solution again.
It's also possible that the file may have been created under the root
home directory accidentally instead of the user's $HOME
directory, in which case you can check this by:
# login and become root
$ sudo -i
# then as root, check if the .Xauthority file exists
$ ls -la
# and remove, no need for sudo since you're logged in as root in console
$ rm .Xauthority
# if you happen to see another file for xorg.conf.new remove
# that too, it's automatically generated and when it's in the
# home folder and is unused unless moved to /etc/X11
$ rm xorg.conf.new
Resolve Using Recovery Mode
For below, in case you can't reach a console from normal boot as aforementioned using keyboard combinations, then boot into recovery mode, enable networking, and then select the option for dropping to root. This is suggested because you're going to need to install software and aside from the obvious, enabling networking will automatically remount your primary disk with read/write permissions as necessary.
Solution 1: Blacklisting the Nouveau Driver
You can first try blacklisting the nouveau drivers and rebooting to see if that might resolve the issue:
$ sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
$ sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
# before restarting, you should update the initramfs by running
# the following (to purge the system of nouveau loading)
$ sudo update-initramfs -u
# then restart
$ sudo reboot
Alternatively, the answer provided here explains when troubleshooting using nvidia drivers in the case of Ubuntu, that you need to exit the Xserver display before installing the nvidia drivers and after you've stopped lightdm
by switching to a virtual terminal (The tty console) where instead, after arriving at the console
# stop lightdm
$ sudo stop lightdm
# edit nvidia configuration file to blacklist nouveau
$ sudo nano /etc/modprobe.d/nvidia-graphics-drivers.conf
# and then add the following entries
blacklist nouveau
blacklist lbm-nouveau
blacklist nvidia-173
blacklist nvidia-96
blacklist nvidia-current
blacklist nvidia-173-updates
blacklist nvidia-96-updates
alias nvidia nvidia_current_updates
alias nouveau off
alias lbm-nouveau off
# Hit Ctrl or Cmd + X to exit, yes to save, yes to same file name
# (create it if it doesn't exist but it should already exist
# after installing nvidia drivers.
As one further alternative to blacklisting the nouveau driver and trying to get the two drivers to play nice together, don't do any of the above and simply try changing this in your grub configuration:
# use your preferred text editor
$ sudo nano /etc/default/grub
# Add or modify this line to include
GRUB_CMDLINE_LINUX="nouveau.modeset=0"
The above ensures, in one way or another, there's no conflict with your on-board graphics driver or the system's open source nouveau driver.
Solution 2: Get Rid of Nvidia Drivers and revert to system drivers
Using the recovery mode console:
# removes all drivers related to nvidia
$ sudo apt purge nvidia*
# however, if you have a need for CUDA or some other drivers,
# from nvidia, you can target specifically the display driver running
$ dpkg -l | grep nvidia
# then from the list find the nvidia driver that was installed and
# specifically purge that one, for example
$ sudo apt purge nvidia-driver-384
# or
$ sudo apt purge nvidia-384
# as an added assurance
$ sudo apt autoremove
$ sudo apt autoclean
# as a side note, some functions may be needed from the below package
# on certain systems and may not necessarily seem needed for elementary
# Install after purging nvidia
$ sudo apt install nvidia-common
Then to ensure the system loads, we will re-install the elementary desktop, a helpful Ubuntu package, remove any xorg configurations that may have been previously set when nvidia drivers were installed and then manually re-add the open source nouveau drive back to be loaded, all before updating initramfs and rebooting
# You can optionally remove elementary-desktop before installing
$ sudo apt remove elementary-desktop
# otherwise
$ sudo apt install elementary-desktop
$ sudo ubuntu-drivers autoinstall
$ sudo rm /etc/X11/xorg.conf
$ echo 'nouveau' | sudo tee -a /etc/modules
$ sudo update-initramfs -u
$ sudo reboot