15

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 ?

Eric Leschinski
  • 2,221
  • 1
  • 20
  • 24
  • 1
    xauth list and hostnamectl status please. – nobody Jun 09 '20 at 09:09
  • The program executable (In my case octave), is trying to be smart and pipe the internal X11 display through ssh to the remote computer, and fails. Are you passing the -X parameter to ssh? Take that off, and try passing the -Y as in: ssh -Y youruser@yourhostname, or if that fails try running octave from a logged in user that has access to the primary monitor display. – Eric Leschinski Jan 02 '22 at 03:00

1 Answers1

3

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

  • what works for me: xhost + 192.168.1.2 for virtual boxes , then in the virtual machine : DISPLAY=192.168.1.1:0.0 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 01 '20 at 09: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 https://www.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: https://stackoverflow.com/questions/23691491/the-use-of-mpi-init

    – Benji over_9000 'benchonaut' Jul 07 '20 at 11:18