LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't log in via GUI. Suspect .Xauthority issue (https://www.linuxquestions.org/questions/linux-newbie-8/cant-log-in-via-gui-suspect-xauthority-issue-4175556230/)

Entropy1024 10-15-2015 08:34 AM

Can't log in via GUI. Suspect .Xauthority issue
 
I have had Ubuntu 15.04 running for a week or so fine now. Most of the time I have been accessing it remotely with TeamSeer. All good.

Today I went to log in and no joy, it could not be found. I went to the PC physically and had a look, it was sitting on the login screen, so logged in, all fine for about 10 seconds or so then it kicked me out back to the login screen!
I could log back in fine, however after a few seconds it logged me out again. I could get in via the guest account and that was fine, I was not kicked out.

After reading about this I saw someone say they had a similar issue and it was a corrupted .Xauthority file. They fixed the issue by deleting it and the system auto created a new one.

So I deleted the .Xauthority file via the tty (CTRL+ALT+F1) and now I can't log in at all via the GUI. I can still get in via tty however I can't see a .Xauthority file in my home directory. Yes, I am using the -a modifier.

So my question is how do I recover from this? How do I create a new .Xauthority file?

Many thanks for any help
Tim

cynwulf 10-15-2015 08:43 AM

Removing any Xauth files with the X session running for the logged in user causes bad things to happen.

You need to log out, switch to a vt, rm any stale .Xauthority and .serverauth.* files and then log back in. The display manager can be running, as you're only working with a specific user's dotfiles.

Entropy1024 10-15-2015 08:55 AM

Quote:

Originally Posted by cynwulf (Post 5435048)
Removing any Xauth files with the X session running for the logged in user causes bad things to happen.

You need to log out, switch to a vt, rm any stale .Xauthority and .serverauth.* files and then log back in. The display manager can be running, as you're only working with a specific user's dotfiles.

Thanks for the reply.

Unfortunately I am very new to Linux and I'm not sure how exactly to do the above.
  1. When you say switch to a vt is this not the tty via CTRL+ALT+F1?
  2. I have removed the .Xauthority already using the rm command, I can do the same with the .serverauth.* files, where are they stored?
  3. After I do this will I not be left without the .Xauthority file again & possibly also missing these .serverauth.* files?

Regards
Tim

cynwulf 10-15-2015 11:12 AM

Quote:

Originally Posted by Entropy1024 (Post 5435052)
Thanks for the reply.

Unfortunately I am very new to Linux and I'm not sure how exactly to do the above.


When you say switch to a vt is this not the tty via CTRL+ALT+F1?

Yes that's it. vt is "virtual terminal". You will have terminals on at least F1 to (I think) F6 on Linux and maybe more less on other *nix. (it's not set in stone and depends on whoever set up your distribution really).
Quote:

Originally Posted by Entropy1024 (Post 5435052)
I have removed the .Xauthority already using the rm command, I can do the same with the .serverauth.* files, where are they stored?

The dotfiles are in your user's $HOME directory. Try the following:

1) Log out first - so get back to where you see the display manager logon screen (or boot the system and don't login from the display manager).

2) Switch to any vt (so yes CTRL+ALT+F1) and login as your normal user (i.e. the user with the problem).

3) -
Code:

$ cd ~
$ rm .Xauth*
$ rm .serverauth.*

CTRL+D

4) Switch back to the X server usually CTRL+ALT+F7 but not necessarily (see above)

5) Login and see if that fixes it.

Quote:

Originally Posted by Entropy1024 (Post 5435052)
After I do this will I not be left without the .Xauthority file again & possibly also missing these .serverauth.* files?

Regards
Tim

As soon as you login from the display manager the Xauth session files will be regenerated (normal) for the current session. This is required to solve the problem.

Entropy1024 10-15-2015 11:21 AM

Quote:

Originally Posted by cynwulf (Post 5435104)
Yes that's it. vt is "virtual terminal". You will have terminals on at least F1 to (I think) F6 on Linux and maybe more less on other *nix. (it's not set in stone and depends on whoever set up your distribution really).

The dotfiles are in your user's $HOME directory. Try the following:

1) Log out first - so get back to where you see the display manager logon screen (or boot the system and don't login from the display manager).

2) Switch to any vt (so yes CTRL+ALT+F1) and login as your normal user (i.e. the user with the problem).

3) -
Code:

$ cd ~
$ rm .Xauth*
$ rm .serverauth.*

CTRL+D

4) Switch back to the X server usually CTRL+ALT+F7 but not necessarily (see above)

5) Login and see if that fixes it.


As soon as you login from the display manager the Xauth session files will be regenerated (normal) for the current session. This is required to solve the problem.

OK I just trued that and both the rm commands resulted in a file not found error.
I logged back on using the GUI and as before I got a black screen for a few seconds then back to the GUI log in screen.

Is there anything else I can try?

Thanks again for the help with this issue.
Tim

cynwulf 10-15-2015 11:26 AM

You need to be in your user's home directory to find those. Also file names are case sensitive. Removing those does no harm by the way. X.org creates and removes those files when it starts/stops. Ensure that you have removed them. i.e. enter your home directory and
Code:

$ ls -al
and visibly check they are not there.

Entropy1024 10-15-2015 11:46 AM

Quote:

Originally Posted by cynwulf (Post 5435110)
You need to be in your user's home directory to find those. Also file names are case sensitive. Removing those does no harm by the way. X.org creates and removes those files when it starts/stops. Ensure that you have removed them. i.e. enter your home directory and
Code:

$ ls -al
and visibly check they are not there.

Yes I'm in my home directory. That's what the CD ~ command does right?

When I do the remove command it does not find these files, strongly suggesting they have gone. I have entered the case correctly BTW. Therefore these files simply do not exist in my home directory.
This is confirmed if I do the ls - al command. Ie other files and directories of mine from the home folder such as documents, pictures, videos etc are present. So I'm confident I'm in the correct directory.

I don't think the issue is that I have not deleted the aforementioned files A directory listing of all files including hidden ones does not show them. Using rm results in an error saying they can't be found. They are not there.

As I understand it the system should detect they are missing and generate new ones yes? If so why is this not happy happening is the question.

Cheers
Tim

cynwulf 10-15-2015 03:50 PM

I've mentioned case specifically as you have not differentiated even in the latest post.

I suggest having a look at error logs next.

The ones to look at first are ~/.xsession-errors and /var/log/Xorg.0.log

Warnings and errors in the latter are indicated by "WW" and "EE" respectively. It's worth looking as it might pinpoint the problem exactly.

Entropy1024 10-15-2015 04:27 PM

Quote:

Originally Posted by cynwulf (Post 5435231)
I've mentioned case specifically as you have not differentiated even in the latest post.

I suggest having a look at error logs next.

The ones to look at first are ~/.xsession-errors and /var/log/Xorg.0.log

Warnings and errors in the latter are indicated by "WW" and "EE" respectively. It's worth looking as it might pinpoint the problem exactly.

I will take a look at the logs and see what they say. Thanks.

I don't believe I have ever mixed up the case. I am CERTAIN that there are no .Xauthority or .serverauth.* in any combination of case in my home directory, and I suspect that is why I can't get the GUI to work.

Reading about these files they appear to be integral to the GUI working. I need to find some way to replace these files. I asked before if the system should automatically replace these critical files, do you know if it should? You asked me to delete them which I did, but missed the part about getting them back. :)

How do I create a new .Xauthority file? I have tried 'transplanting' one from another Ubuntu 15.04 system I have, however this did not work and I suspect they may be unique for each install.

Regards
Tim

cynwulf 10-15-2015 05:20 PM

Quote:

Originally Posted by Entropy1024 (Post 5435252)
Reading about these files they appear to be integral to the GUI working. I need to find some way to replace these files. I asked before if the system should automatically replace these critical files, do you know if it should? You asked me to delete them which I did, but missed the part about getting them back. :)

How do I create a new .Xauthority file? I have tried 'transplanting' one from another Ubuntu 15.04 system I have, however this did not work and I suspect they may be unique for each install.

As I said earlier - X.org generates those files for the current session. You do not need to create them and copying them from another system will not help. When X starts those files will be created, when you stop X they get deleted. This is why you can rm those files safely (and why I suggested doing so).

Your problem lies elsewhere, which is why you need to look at the log files...

Also: create another user and try to login via your display manager as that other user.

Entropy1024 10-16-2015 07:28 AM

Quote:

Originally Posted by cynwulf (Post 5435275)
As I said earlier - X.org generates those files for the current session. You do not need to create them and copying them from another system will not help. When X starts those files will be created, when you stop X they get deleted. This is why you can rm those files safely (and why I suggested doing so).

Your problem lies elsewhere, which is why you need to look at the log files...

Also: create another user and try to login via your display manager as that other user.

I decided to re-install Ubuntu from scratch. I need the system running and although it would have been rewarding to find out the fix I ran out of time.

Thanks for the help.
Tim


All times are GMT -5. The time now is 02:13 AM.