I have a problem when running a certain program. The execution works perfectly fine, but there is an additional line that appears before the execution : Invalid MIT-MAGIC-COOKIE-1 key

Is there a way to prevent this message to appear ? With some research, I tried different commands :

  • Try xhost +local: before running

  • Change the variable DISPLAY with the export command

  • Check if the XAUTHORITY environment exists (it does not)

Do you have any other suggestions that I can try ?

Thank you in advance.

  • xauth list and hostnamectl status please.
    – nobody
    Jun 9 '20 at 9:09

This indicates a permission Problem or simply a wrong magic cookie ..

  • what works for me: xhost + for virtual boxes , then in the virtual machine : DISPLAY= dbus-run my-x11-program

  • the MIT-MAGIC-COOKIE is stored in the file .Xauthority of the user who is running the desktop

  • you might have an already wrong-filled .Xauthority ?

  • you could also just "steal" this one (transfer via ssh) or copy on localhost , sometimes sudo works , and su not

  • when everything fails: run via ssh with e.g ssh -YXC myuser@the-machine "the-command"

  • if you encounter failures concerning MPI_init() from openMPI, you should read the mpirun-gui section from the manual there is another thread in the SE community describing what MPI_Init() it does

  • 1
    What if i don't have an .Xauthority file? Everything is local in my case, I'm just running programs on my local machine and getting that error message. Also ubuntu 20.04. The programs that cause this are ones that call MPI_Init(), if that helps. Paraview for example.
    – RL-S
    Jul 1 '20 at 9:32
  • uuhm "MPI_init()" is a environment setup function from a clustering mechanism (openMPI.. if it is from the REAL MPI ) , you can use strace to see what is going on , also you should read the mpirun-gui open-mpi.org/faq/?category=running#mpirun-gui on that topic and adjust your xhost/DISPLAY variables , they have a good example a good explanation on mpi_init is here: stackoverflow.com/questions/23691491/the-use-of-mpi-init Jul 7 '20 at 11:18

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.