Tuesday, April 26, 2016

Fixing: error reading existing .Xauthority

Recently I stumbled across a strange issue. I was performing a headless install of my Raspberry Pi.
After enabling ssh connectivity, I was looking into vnc setup that would allow me to use graphical interface.

As it turned out, installed version was minimal Raspbian and LXDE was missing. So, I wanted to install LXDE on my pie, but mistakenly I ran the command on my Ubuntu.

Since the installation of LXDE was done with sudo command, this ended up changing the owner of the .XAutority file to root. This did not cause any effect immediately, as I assume that .XAuthority file is read only once, before the application startup. But after next reboot, I was not able to log into the Unity desktop, and it used to throw an exception, error reading existing .XAuthority error.

The next thing that I did was to login via tty and inspect the .XAuthority file. I noticed that the owner of the file was now set to root. I switched the owner back to my user. Surprisingly this did not work immediately and I had to reboot my machine to get GUI working.

To summarize, if you face this issue:

  1. Verify that you are the owner of .XAuthority file.
    • For this you will have to log in via tty, which can be done by pressing ctrl+alt+F{2-6}
    • This would bring up a text console and bash would work here.
  2. If the owner of this file is not set to your user and set to root, reclaim the ownership for your user. This can be done with chown command.
    • sudo chown user:user /home/user/.Xauthority
  3. Reboot.
Hope this helps!

No comments:

Post a Comment