"Invalid MIT-MAGIC-COOKIE-1 key" message while running a program with the Terminal

Ask Ubuntu Asked by Valérie Bibeau on December 4, 2020

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.

One Answer

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

Answered by Benji over_9000 'benchonaut' on December 4, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP