Login loop after upgrade to 16.04

I encountered a login loop after updating xenial beta to the latest updates.

I tried a lot of things:

  • xauthority or /tmp privileges change

  • Reinstalling nvidia drivers, removing them.

  • reinstalling unity, unity-greeter, ubuntu-desktop, upstart, lightdm and compiz.

  • resetting compiz and unity settings.(I get dbus launch errors:

    Failed to commit changes to dconf: error spawning command line 'dbus-launch -auto launch=..................)
    
  • using older kernel and failsafe (failsafe report no screen found)

  • tried to launch other DE (steam big picture)

Here's xsession errors log:

unity:
open connection: connect: No such file or directory
Cannot connect to brltty at :0
upstart: gnome-session (unity) main process (5441) terminated with status 1
upstart unity-settings-daemon main process (5434) killed by TERM signal

steam big picture:
open connection: connect: No such file or directory
Cannot connect to brltty at :0
ERROR: ld.so: object '/usr/lib/i386-linux-gnu/libmodeswitch_inhibitor.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file(: ignored.
ERROR: ld.so: object '/usr/lib/i386-linux-gnu/libmodeswitch_inhibitor.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file(: ignored
ERROR: ld.so: object '/usr/lib/i386-linux-gnu/libmodeswitch_inhibitor.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file(: ignored
Could not create GLX context
ERROR: ld.so: object '/usr/lib/i386-linux-gnu/libmodeswitch_inhibitor.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file(: ignored

In Unity (compiz) log there are a lot of errors about opengl plugin

Compiz (opengl) - Fatal: glXQueryExtenisonsString is NULL for screen 0

And a lot of plugins unloaded because of opengl.

Lightdm have sudden SIGTERM signal with no prior errors in the log.

xserver have 2 errors:

xf86EnablePorts: failed to set IOPL for I/O (Operation not permitted)
(EE) Failed to initialize GLX extension (Compatible NVIDIA X driver not found)

But it continue through input operations until it suddenly get terminated.


In my case original nvidia drivers was the cause and switching back to open source nouveau helped. First, I removed all stuff from nvidia:

sudo apt-get remove --purge 'nvidia-*'
sudo apt-get install ubuntu-desktop
sudo rm /etc/X11/xorg.conf
echo 'nouveau' | sudo tee -a /etc/modules

(source: How can I uninstall a nvidia driver completely ?)

After that I could login, but unity didn't load, there was no launcher etc. It turn out I had to re-enable Unity plugin:

sudo apt-get install compizconfig-settings-manager
DISPLAY=:0 ccsm
Find the Unity plugin and enable it.

(source: Unity doesn't load, no Launcher, no Dash appears)


The problem is that, when you update Ubuntu (and even when you install certain programs that call /sbin/ldconfig), there are changes made to /etc/ls.so.cache.

Try it and you'll see that the ld.so.cache file after such an installation/update will have a different size than before the operation.

This, in Ubuntu 16.04, results in a login loop when logging in from lightDM. Therefore, you should keep a copy of the original ld.so.cache since, with the new version generated after the installation/update, lightDM will no longer authenticate.

I have had this issue many times and have had to be very careful with this. I always keep a copy of the original file (/etc/ld.so.cache.orig) that lets me log in without the login loop and use that to log in. Then, once I have logged in successfully, I copy the new one (/etc/ld.so.cache.new) over. To do so, I have modified my ~/.bash_profile file and have added this line:

sudo /bin/cp /etc/ld.so.cache.new /etc/ld.so.cache

Then, in order to copy the original file back when exiting the session so that I'll be ab;e to log ina gain next time, I have added this line to /etc/gdm/PostSession/Default:

/bin/cp /etc/ld.so.cache.orig /etc/ld.so.cache

For that to work, I have modified /etc/sudoers (by running sudo vosudo) to allow non privileged users to run the copy command:

ALL     ALL= NOPASSWD: /bin/cp /etc/ld.so.cache.new /etc/ld.so.cache

This might look like an ugly hack, but it gets around this login-loop issue and, also, to keep the new /etc/ld.so.cache file.