[X11] Invalid MIT-MAGIC-COOKIE-1 mess

Greetings !!
Recently, and this happens completly at random, I got some “Invalid MIT-MAGIC-COOKIE-1 key” messages.

I can not trace from where this misfunctionnal message comes from and that is frustrating.
I looked on this forum and find no satisfying workarounds, as this never happened before and I did not changed the system but did the updates.

The command xauth list displays

xauth list
sirius.dezordi.world/unix:0  MIT-MAGIC-COOKIE-1  de868872a19160bdxxx95cf11b4aeaa
sirius/unix:0  MIT-MAGIC-COOKIE-1  3db5f468e43b5c51205d63f6xxx9b03d

sirius is the hostname and dezordi.world the domain.
I put some xxx to make it cool on the hash key ^^

I saw that xhost + should resolve the messages to be displayed but this workaround is not persistent.
I saw some scripts to add to the bashrc but this is not a normal behaviour and don’t want to add it.

Question: how could I set back the system to a “normal” behaviour ?

No guarantees. But this has worked for me:

(1) Logout from the desktop.
(2) At the login screen, use CTRL-ALT-F1 to get to a virtual console.
(3) Login as yourself at that command line.
(4) Remove “.Xauthority” with

rm -f .Xauthority

(5) Logout at the command line
(6) Use CTRL-ALT-F7 to get back to the graphic login screen
(7) Login.

I did not yet overstood why it happened suddenly.
The workaround provided didn’t worked… I still have those messages displayed and some applications can not launch at all.

The openSUSE network configuration may be be relevant here. I assume the Xorg is sometimes started before network connectivity is complete perhaps? Are you using NetworkManager or wicked? Is ‘hostname’ consistent with ‘xauth list’ when you have the ‘magic’cookie’ errors?

What is output of

env | grep XAUTHORITY

?

This worked for me on my laptop. Thanks! I’ve been getting this on my desktop, too, will try on that next.

Note that if you ever log into a GUI as root you can change ownership of ~/.Xauthority to root totally by accident. So never log into a GUI as root;)