Skip to content

Error trying to read XDG_RUNTIME_DIR on Linux #23

@fmbarina

Description

@fmbarina

Output of systemctl status hayabusa.service:

jul 17 17:10:09 fedora systemd[1]: Started hayabusa.service - The hayabusa daemon.
jul 17 17:10:10 fedora hayabusa[1965]: Running as daemon
jul 17 17:10:14 fedora hayabusa[1965]: error: XDG_RUNTIME_DIR is invalid or not set in the environment.
jul 17 17:10:14 fedora hayabusa[1965]: error: XDG_RUNTIME_DIR is invalid or not set in the environment.

Output of echo $XDG_RUNTIME_DIR:

/run/user/1000

Running:

  • Fedora Linux 40
  • Hayabusa version 0.3.1

I don't understand this very well yet, but I'm guessing the hayabusa daemon can't know XDG_RUNTIME_DIR since it's not running under a user process?

From the Arch Wiki:

XDG_RUNTIME_DIR is set by default through pam_systemd(8).

From the manual on pam_systemd:

$XDG_RUNTIME_DIR is not set if the current user is not the original user of the session.

From the freedesktop.org XDG Base Directory Specification:

$XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. The directory MUST be owned by the user, and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700.

Assuming I'm not severily misunderstanding these, doesn't this mean XDG_RUNTIME_DIR is not defined for the daemon, much like other user environment variables are scoped to the current user and generally not available outside of it? Not sure what to do about this, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug fix tasks

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions