Graphical login INVALID-MIT-MAGIC-COOKIE-1 on first login

I’ve been running Tumbleweed for a couple of months.

It started crashing back to SDDM the first time I tried to log in. The second try would work.
Now its worse.

First time I log in, It successfully starts dolphin and konsole, but any subsequent applications fail to start. when I start them from within konsole, they complain about an invalid MIT-MAGIC-COOKIE-1 key.

The kde menu is there, but using it to log out does not work (presumbably for the same reason).

If I enter “killall kdeinit5” from within konsole, it puts me back to SDDM, and a subsequent login works properly.

I’m baffled. Any suggestions?

First try a different user it may be som config problem

That was a great suggestion. Thank you! Sure enough a new user logs in fine.

I couldn’t find anything obviously wrong with the original user account.
As a shot in the dark I deleted $HOME/.Xauthority and that was it! I can now log in on the first try!

This home partition was originally created as part of a different distro. I’m guessing that was the problem. though I don’t understand why it would fail on the first try and then succeed subsequently…

Do you ever log in as root to a GUI? That can change the ownership of that file

I don’t think that logging in as root should cause this kind of problem, read the following for background on MIT-MAGIC-COOKIE. It works like cookies in other circumstances, like when websites use text cookies to “remember” who you are and your site settings/preferences/more.

If I were to guess, the User is checking “yes” whenever asked to “remember” the User’s authorization for elevated permissions. Or, maybe the Desktop is storing things about the last time that User closed that app, re-applying some preference like positioning and size, or history.

Since the cookie is User-specific (see the wikipedia reference), it’s a good guess that any way of avoiding the problem cookie solves the problem, so re-creating the User profile or logging in as a different User would do this. Unfortunately, a quick Google search to try to find the location where the cookie might be stored suggests that there is no default location, can be in many places. So, <maybe> a file search for a file name might work, but otherwise re-creating the whole profile might be the only sure-fire solution today. Glad to hear you were able to solve your problem by deleting ~/.XAuthority, that appears to be where <your> problem cookies were located.


My INVALID-MID_MAGIC_COOKIE-1 warning comes after trying to change my HOSTNAME:
sudo hostnamectl --transient set-hostname hp_tower
It seems to be a benign warning, but it is annoying. I tried renaming my .Xauthority file, but that caused a core dump.
Does this shed any light on the problem?
Thank you.