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:

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.

5 Answers 5


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 removal of nvidia-* was the main fix for me. In ~/.xsession.errors I had message cannot connect to brltty at 0 which is related to NVIDIA.
    – Jon
    Feb 27, 2018 at 0:44
  • 1
    I followed these exact steps but it did not work for me
    – Hakaishin
    Oct 11, 2018 at 9:06
  • Plus what if I need to use the Nvidia drivers, then this does not work.
    – Hakaishin
    Oct 22, 2018 at 15:20
  • @Hakaishinrare you able to solve it?
    – sagarr
    Dec 4, 2018 at 16:48

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.

  • 2
    Lo siento, pero el Ask Ubuntu es una pagina donde solo se escribe en Ingles. Gracias por la respuesta pero como es en Castellano, la tube que borrar. Si no hables, o no hables bien, el Ingles, puedes usar herramientas como el Google Translate para traducir tus contribuciones.
    – terdon
    Sep 9, 2016 at 11:02
  • 1
    De hecho, la traduje yo ya que tiene pinta de ser una solución buena. Pero en el futuro, por favor pásala por Google Translate.
    – terdon
    Sep 9, 2016 at 11:19

I had the same error on 16.04 as well. In my case it was also an NVidia driver issue. I have 8 monitors and I like how the NVidia diver performs with them. So to get it working, I:

  1. Pressed CTRL + ALT + F1 at the login prompt and logged into through terminal.

  2. Backed up may old /etc/X11/xorg.conf file, as it was a pain to configure 8 monitors.

  3. Downloaded the driver file from NVidia: NVIDIA-Linux-x86_64-367.44.run

  4. Ran the following command: sudo service lightdm stop (driver install will fail if this step is skipped).

  5. Reinstalled the driver: sudo ./NVIDIA-Linux-x86_64-367.44.run I was notified that the auto generated script did not complete and given the choice to continue the install which I accepted. I also chose to have the driver installed as a kernel module and have the program generate a new xorg.conf file (backed mine up before). At the end of the process it complained about a missing link to a lib, but gave instructions on linking to it. I put off dealing with that for later.

  6. Rebooted and was able to login through the GUI.


I was using xfce and I manually checked each folder and file by renaming them. Deleting ~/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml worked for me.

I had nvidia drivers as well, but they were working fine when I logged in as root and a backup user.


In my case this issue was caused by accidentially enabling Secure Boot in UEFI, which effects in third party drivers unusable (e.g. Nvidia). That caused X session error. After disabling Secure Boot, everything went back to normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.