Invalid MIT-MAGIC-COOKIE-1 key

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version |

G_DIETPI_VERSION_CORE=9
G_DIETPI_VERSION_SUB=2
G_DIETPI_VERSION_RC=1
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’

  • Distro version |

bookworm

  • Kernel version |

Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

  • Architecture |
    arm64

  • SBC model |
    RPi 3 Model B+ (aarch64)

  • Power supply used |

  • SD card used |
    120 Go hard disk connected by USB

Additional Information (if applicable)

  • Software title | (EG: Nextcloud)
  • Was the software title installed freshly or updated/migrated? No
  • Can this issue be replicated on a fresh installation of DietPi? Yes
    ← If you sent a “dietpi-bugreport”, please paste the ID here →
  • Bug report ID | echo $G_HW_UUID

Steps to reproduce

  1. …After several weeks running well, Il got the error message :
    “invalid MIT-MAGIC-COOKIE-1 key” when launching java jar application.
  2. …I searched with Google and I found that this error could be solved by removing the XAUTHORITY file… but I did not find this file !

Expected behaviour

  • …Please could you help

Actual behaviour

Extra details

are you using a desktop application?

Hello Joulinar,

This is a “standard” Dietpi Installation with a X Server running (and TigerVNC occasionnaly)

dietpi@DietPi:/home$ ps -e | grep X
    691 ?        00:00:04 Xtigervnc
    706 ?        00:00:00 Xtigervnc-sessi
    762 tty2     00:00:05 Xorg

Over that, I have 2 java applications running : one server without GUI and one JavaFx with GUI.
Both are launched with java -jar Name.jar.
In the bash file for launching the JavaFx application, there is the command “export DISPLAY=:0”

May I remember that was running well during several months…

Also, I tried to launch another JavaFx application and I got a different error message :
Authorization required, but no authorization protocol specified

Thanks for your help

Is there somebody who can explain the lauching of JavaFx (with GUI) applications with Dietpi ?

With Google, I found that the “Invalid MIT-MAGIC-COOKIE-1 key” error (object of this request) could be solved by deleting the .XAuthority file. But it seems that this file does not exist in the Dietpi installation ?

dietpi@DietPi:~$ xauth list
xauth: file /home/dietpi/.Xauthority does not exist

Thanks for your help,

Can you do

xauth generate :0 . trusted
xauth list

@Jappe
I send the first command 2 times (second with sudo)
See joined picture
Xauthority

can you do the same as user root?

I also don’t quite understand what you wanna do. If you run a app with GUI you need a display to draw it. But you use SSH, so no display = no GUI.

Can you login locally, to a desktop environment and run these commands again?

@Joulinar
The same as user root
XauthorityRoot

@Jappe
Yes, I run an app with GUI
Yes, I execute "“export DISPLAY=:0” before launching it
No, I don’t use SSH. I use a bash file with "java -jar Name of myAppli.jar

Well you are using Putty, which is a SSH client. Means you are connected via SSH.

Best to start your desktop/xserver and check again

Thanks for your help

1°) I am using Putty only for “testing”
In production, the Java server (running on the Pi) launchs the Java Gui application by executing a shell command which executes a bash file containing “export DISPLAY=:0” and "java -jar nameofJavaFxapplication.jar)

2°) I reboot the system. I log as root and I execute

xauth generate :0 . trusted
xauth list

And I get the same list of 4 MIT-MAGIC-COOKIE-1
(see my picture sent before)

3°) I am (truly) not a specialist but I think the issue is not the way of connecting (all was running well for months before). From my (poor) understanding (built with Google), the issue is coming from these keys in the .Xauthority file ??? Is it possible to remove the .Xauthority file (depending of Google, a new file will be created at the next connection eliminating the “invalid MIT-MAGIC-COOKIE-1 key” error) ? What is the rule of these keys in the file ?

One more time, thanks for the time you spend

This topic was automatically closed 178 days after the last reply. New replies are no longer allowed.