Skip to content

Commit

Permalink
Prevent tmpfiles from removing "old" xauth files
Browse files Browse the repository at this point in the history
Starting from sddm 0.20 (by #1230),
the xauth file is at `/tmp/xauth_*` instead of `~/.Xauthority`.
The new location is subject to systemd-tmpfiles's cleanup, which
deletes files from /tmp/ that are older than 10 days:
https://github.com/systemd/systemd/blob/v254/tmpfiles.d/tmp.conf

The xauth file should not be removed while the session is active,
because it is needed for starting X applications. When removed,
X applications won't start any more.

This patch fixes the issue by declaring these files as "ignored"
in sddm-tmpfiles.conf, so that systemd-tmpfiles doesn't remove them.

Minimal test case:

```
touch /tmp/xauth_testonly
SYSTEMD_LOG_LEVEL=debug systemd-tmpfiles --prefix=/tmp/ --clean
```

Pre-patch output:
File "/tmp/xauth_testonly": change time Mon 2023-10-02 01:27:38.395466 CEST is too new.

(meaning that the file was considered for removal)

Post-patch output:
Ignoring "/tmp/xauth_testonly": a separate glob exists.

(meaning that the file is ignored and not considered for removal)
  • Loading branch information
Rob--W authored and Vogtinator committed Dec 7, 2023
1 parent 132f105 commit b002d02
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions services/sddm-tmpfiles.conf.in
Expand Up @@ -6,3 +6,9 @@ d ${RUNTIME_DIR} 0711 root root
r! /tmp/sddm-auth*
# xauth files passed to user sessions
r! /tmp/xauth_*
# "r!" above means to remove the files if existent (r), but only at boot (!).
# tmpfiles.d/tmp.conf declares a periodic cleanup of old /tmp/ files, which
# would ordinarily result in the deletion of our xauth files. To prevent that
# from happening, explicitly tag these as X (ignore).
X /tmp/sddm-auth*
X /tmp/xauth_*

0 comments on commit b002d02

Please sign in to comment.