"Authorization required, but no authorization protocol specified" error after 10 days long session

I have been wondering for a few months now why I cannot start new applications on Xorg + KDE Plasma graphical desktop environment after a time. It has seemed like it takes about ten days from session start until problem starts. Today I managed to observe it happens quite exactly when session is 10 days old.

With help of thread Authorization required, but no authorization protocol specified I managed isolate the isssue.

$ env | grep XAUTHORITY
XAUTHORITY=/tmp/xauth_nAGqoK
$ ls -l $XAUTHORITY
ls: cannot access '/tmp/xauth_nAGqoK': No such file or directory

It is obivious that new applications cannot be restarted if $XAUTHORITY file is missing. It is propably /tmp cleanup script which removes the file. I don’t blame cleanup task for this. $XAUTHORITY just is in wrong place.

My questions:

  1. Why XAUTHORITY has been changed to point to /tmp instead of users’ traditional ~/.Xauthority file?

  2. How to fix this system-wide, so that XAUTHORITY is placed in users’ home directory?

You could start with telling us what Display Manager you are using.

It is sddm.

As far as I know it was made non-configurable in SDDM.

1212932 – sddm 0.20 puts $XAUTHORITY in /tmp instead of $XDG_RUNTIME_DIR (opensuse.org)

You may try to override task of cleaning /tmp instead and adjust it. Copy /usr/lib/tmpfiles.d/fs-tmp.conf to /etc/tmpfiles.d/ and change as you like. See man tmpfiles.d for description of the content.

Is this /tmp(xauth_* files deletion some kind of regression issue? Or is a bug on how systemd should handle dos and don’ts from different config filees regarding /tmp?

$ cat /usr/lib/tmpfiles.d/fs-tmp.conf 
q /tmp 1777 root root 10d
$ cat /usr/lib/tmpfiles.d/sddm.conf 
# Home dir of the sddm user, also contains state.conf
d       /var/lib/sddm   0750    sddm    sddm
# This contains X11 auth files passed to Xorg and the greeter
d       /run/sddm       0711    root    root
# Sockets for IPC
r!      /tmp/sddm-auth*
# xauth files passed to user sessions
r!      /tmp/xauth_*

sddm.conf asks not to delete /tmp/xauth_* files except during boot.

If I’d add X /tmp/xauth_* - - - - to sddm.conf, should it then preserve /tmp/xauth_* files? Or is there issues regarding how configurationa are applied?

How systemd keeps track of what it should and should not do in each directory? It seems that file cleanup in /tmp now overrides not-deleting particular files there.