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?

  • That error is indeed related to the X authorization mechanism. An X client needs to present the cookie (a password) to the X server. Normally the cookie is generated when the server starts and stored in a file, either $XAUTHORITY or ~/.Xauthority. Is the variable XAUTHORITY defined in your session? What are examples of applications that keep working? Do any of your dot files (e.g. .bashrc) do anything with XAUTHORITY or ~/.Xauthority or the xauth command? – Gilles Aug 1 '15 at 21:54

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.