0

UPDATE 1: I am not using SSH. I am using a local machine.

UPDATE 2: I restarted the X and notice that the Xauthority file that I am exporting to is actually being updated:

$ sudo systemctl restart display-manager
$ ls /run/user/1000/gdm/Xauthority*
-rwx------ 1 mona mona 96 Jan 25 16:07 /run/user/1000/gdm/Xauthority

Also, after I restarted the X, the other two Xauthority files, namely /run/user/1000/gdm/Xauthority-c and /run/user/1000/gdm/Xauthority-l, are gone as can be seen below:

$ fd Xauthority /
/run/user/1000/gdm/Xauthority

and I can call xauth after reboot:

$ xauth
Using authority file /run/user/1000/gdm/Xauthority
xauth> 

Following "Invalid MIT-MAGIC-COOKIE-1 key" when trying to run program remotely I tried:

[9080:9072 0:2035] 02:14:50 Mon Jan 25 [mona@goku:pts/0 +1] ~/research/code/vision/integration
$ export DISPLAY=desktop:0
18838/31772MB(vision)

and then:

$ xhost +local: 
xhost:  unable to open display "desktop:0"

how could I fix this problem?

$ lsb_release -a
LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal

Another similar example:

$ xclock
Error: Can't open display: desktop:0

More details:

$ xclock
Error: Can't open display: desktop:0
27296/31772MB
[3266:3258 3:2008] 02:54:16 Mon Jan 25 [mona@goku:pts/0 +1] ~
$ export DISPLAY=":0.0"
26016/31772MB
[3266:3258 3:2009] 02:57:24 Mon Jan 25 [mona@goku:pts/0 +1] ~
$ xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :0.0
$ export DISPLAY=":0"
26238/31772MB
[3266:3258 3:2011] 02:57:40 Mon Jan 25 [mona@goku:pts/0 +1] ~
$ xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :0
$ xhost +mona
Invalid MIT-MAGIC-COOKIE-1 keyxhost:  unable to open display ":0"
$ firefox
Invalid MIT-MAGIC-COOKIE-1 keyUnable to init server: Could not connect: Connection refused
Error: cannot open display: :0
 
 
$ xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :0
25694/31772MB
[3266:3258 3:2026] 03:04:35 Mon Jan 25 [mona@goku:pts/0 +1] ~
$ export DISPLAY=desktop:0
25694/31772MB
[3266:3258 3:2027] 03:04:49 Mon Jan 25 [mona@goku:pts/0 +1] ~
$ xclock
Error: Can't open display: desktop:0

Also, I am having weird characters in Xauthority file:

$  xrandr | nc termbin.com 9999
Invalid MIT-MAGIC-COOKIE-1 keyCan't open display :0
21618/31772MB
[9136:3258 0:2002] 03:49:16 Mon Jan 25 [mona@goku:pts/2 +1] ~
$ fd Xauthority /
/run/user/1000/gdm/Xauthority
/run/user/1000/gdm/Xauthority-c
/run/user/1000/gdm/Xauthority-l
22048/31772MB
[9136:3258 0:2003] 03:51:26 Mon Jan 25 [mona@goku:pts/2 +1] ~
$ cat /run/user/1000/gdm/Xauthority-c
22048/31772MB
[9136:3258 0:2004] 03:51:49 Mon Jan 25 [mona@goku:pts/2 +1] ~
$ cat /run/user/1000/gdm/Xauthority-l
22081/31772MB
[9136:3258 0:2005] 03:51:58 Mon Jan 25 [mona@goku:pts/2 +1] ~
$ cat /run/user/1000/gdm/Xauthority
gokuMIT-MAGIC-COOKIE-1R��9��s{�H��H�l��gokuMIT-MAGIC-COOKIE-1R��9��s{�H��H�l22081/31772MB
[9136:3258 0:2006] 03:52:03 Mon Jan 25 [mona@goku:pts/2 +1] ~

Also, setting it to the found Xauthority file didn't solve the problem:

$ export XAUTHORITY=/run/user/1000/gdm/Xauthority
22022/31772MB
[9136:3258 0:2010] 03:54:31 Mon Jan 25 [mona@goku:pts/2 +1] ~
$ xclock
Invalid MIT-MAGIC-COOKIE-1 keyError: Can't open display: :0

I am uid 1000:

uid=1000(mona) gid=1000(mona) groups=1000(mona),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare)

I also have these about xauth:

$ xauth info Authority file: /run/user/1000/gdm/Xauthority File new: no File locked: no Number of entries: 2 Changes honored: yes Changes made: no Current input: (argv):1 21740/31772MB [11979:11971 0:2016] 05:26:34 Mon Jan 25 [mona@goku:pts/0 +1] ~ $ xauth list goku/unix: MIT-MAGIC-COOKIE-1 SECRET_KEY #ffff#676f6b75#: MIT-MAGIC-COOKIE-1 SECRET_KEY

enter image description here

17
  • 1
    Notice that in the Q&A you link to the desktop in desktop:0 is a placeholder for actual hostname of the machine. Does ping desktop work? But you better present your case from the start -- that Q&A you link to may be a dead end, with a problem completely different from yours.
    – user313992
    Jan 25, 2021 at 20:14
  • no $ ping desktop ping: desktop: Temporary failure in name resolution
    – Mona Jalal
    Jan 25, 2021 at 20:15
  • my problem is stuck at whatever x program I run with this error Error: Can't open display: desktop:0
    – Mona Jalal
    Jan 25, 2021 at 20:16
  • 1
    in the 3rd paragraph of code, I can't disentangle the code from prompts and other stuff. Post code without prompts, to make it readable. Jan 25, 2021 at 21:16
  • 1
    If it is confusing me then it is distracting me form answering the question, as evident by this comment thread. Jan 25, 2021 at 21:23

1 Answer 1

0
$  export DISPLAY=:1.0

worked for me.

enter image description here

1
  • Yes I was just staring to wonder, if you had 2 X sessions running: I just noticed he screen shot of a perfectly functional X session, with you messing with stuff, and said "I wonder if you are trying to control another session?" Jan 25, 2021 at 22:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .