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

6,103

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.

Share:
6,103

Related videos on Youtube

user1569339
Author by

user1569339

Updated on September 18, 2022

Comments

  • user1569339
    user1569339 over 1 year

    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?

    • Gilles 'SO- stop being evil'
      Gilles 'SO- stop being evil' almost 9 years
      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?