"Invalid MIT-MAGIC-COOKIE-1 key" when trying to run program remotely

3,163

Solution 1

The value you're using for DISPLAY is incorrect: if you don't want to use SSH X forwarding, DISPLAY must indicate the IP address of your X server (the desktop you want to display programs on). On the remote, run

export DISPLAY=desktop:0

replacing desktop with your local hostname or IP address. You may also need to change your X server's configuration to allow remote IP connections.

Solution 2

This one worked for me. So I'm leaving this answer here.

 export DISPLAY=:1.0

Solution 3

The Invalid MIT-MAGIC-COOKIE-1 key part must be a separate (non-)error. I get it in the normal working case of starting any graphical program (even gitk).

Somebody just forgot to end it with a newline, so pretend it's a separate line.

Solution 4

old question, but still happening, here on a completely new installed Opensuse Leap 15.3

in my case I had an empty /etc/hostname file and did fill it with

hostnamectl set-hostname mySysName

to eliminate the "Invalid MIT-MAGIC-COOKIE-1 key" message (doing this with YaST seems more complicated - not tried)

Solution 5

For me the error was :

Invalid MIT-MAGIC-COOKIE-1 keyxcb_connection_has_error() returned true
Invalid MIT-MAGIC-COOKIE-1 keyERROR: Unable to create GUI. Exiting

I played with .Xauthority but it did nothing but hide the "MIT cookie" part, not the xcb_connection error. In the end it worked just by using @PSN answer (export DISPLAY=:1.0).

fwiw i'm on debian 9.

Share:
3,163

Related videos on Youtube

GokcenG
Author by

GokcenG

Updated on September 18, 2022

Comments

  • GokcenG
    GokcenG almost 2 years

    I've a simple rule like this:

    rule "First Rule" //You do not talk about Fight Club
    when
        MyInp(id=="1")
    then
        insert(new MyOut(true));
    end
    

    What I want is, getting the created MyOut object from a Java class. Is there a way to do this or do I have to pass a global variable and update it inside the rule?

    • Admin
      Admin about 9 years
      Is there an X server running on the server's console? I don't understand where you want the program's output to be displayed. Your procedure is clearly wrong since you're getting the local host's cookie but you don't display on the local host. If there is an X server running on the remote machine and that's where you want the program to be displayed, see unix.stackexchange.com/questions/10121/…
  • GokcenG
    GokcenG over 10 years
    Thanks @Steve. If I understood you correctly, I can't get new objects from Stateless session, am I right?
  • Steve
    Steve over 10 years
    No ... you just run the execute() method, which encapsulates creating a stateful (!) session, inserting facts and then terminating that session. So after running, you have no means of querying the session for facts. However, I'll add a quick note on WorkingMemoryEventListener, as that could be used to achieve that goal.
  • GokcenG
    GokcenG over 10 years
    Ok Steve. I don't like EventListener approach too. So I'll go with inserting an empty message/output object to session beforehand and retrieve it after.
  • Steve
    Steve over 10 years
    I think that's the best approach - insert a MyRequest/MyResult pair.
  • kiko
    kiko over 5 years
    This ignores the XAUTHORITY problem, which is what causes the actual error message in the subject line.
  • Admin
    Admin over 3 years
    $ xhost +local: xhost: unable to open display "desktop:0"
  • Arun Kumar Nagarajan
    Arun Kumar Nagarajan about 3 years
    Worked for me! Been stuck with this error for a long time. Could you please explain what it means though?
  • PSN
    PSN about 3 years
    :1.0 is actually an abreviation and means "display 1 at localhost". The format of the display variable is [host]:<display>[.screen]. host refers to a network host name, and if absent means to connect to the local machine via a unix domain socket. Each host can have multiple displays, and each display can have multiple screens. Screens aren't used much anymore, with xinerama and now xrandr combining multiple screens into a single logical screen. Source: unix.stackexchange.com/a/16816
  • Admin
    Admin over 2 years
    @Moberg: It disables authentication control. It allows any user to open graphical windows on your display. So it's not something you want to do all the time! But when you know you want to run some graphical app as a different user, it's what you need to do.
  • Admin
    Admin about 2 years
    $ DISPLAY=:0 xhost +local: gives Invalid MIT-MAGIC-COOKIE-1 key