Linux – invalid MIT-MAGIC-COOKIE-1 error whenever computer falls asleep

arch linuxx11xauthxmonad

Whenever my laptop falls asleep and is woken up (Lenovo Thinkpad X1 Carbon Gen 3), certain applications will no longer run. For example, when trying to launch dmenu or google-chrome-stable (XMonad window manager on Arch Linux), I get this error: Invalid MIT-MAGIC-COOKIE-1.

What does this error mean? I assume it's related to X11. How can I resolve it?

Best Answer

Either your cookie file $XAUTHORITY is getting cleaned up, or maybe your machine name is changing (some aggressive dhcp settings?) so that the wrong thing is getting looked up. Things to check:

  • Run xauth info and echo $XAUTHORITY to see if your file is someplace that might get cleaned up (like /tmp).

  • Run xauth list > xauth.working, then sleep your laptop, then run xauth list > xauth.broken. Then run diff -u xauth.working xauth.broken to see if anything is changing in your cookie file.

Related Question