New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
session-management.md: Proper handling of XDG_RUNTIME_DIR
#635
Comments
The lifetime requirement is pretty pointless, if programs fail to handle unclean |
Note that the rundir repo is archived/unmaintained, and the original author has created an alternative that doesn't remove the directory. At the moment I have a permanent 0700 dir in .config for each user, and
Which is sort of similar to what the docs suggest, however I had issues with waypipe (ssh -X for wayland):
This happens because ssh sessions aren't login sessions, and don't source remote profile scripts by default. Eventually, I solved the issue by putting the same line in Maybe dumb_runtime_dir or pam_rundir provide a more general way of doing it, I don't quite understand PAM yet though. If they work, I think it could be worth adding mentions to the docs. My other suggestion is to add a warning about the fact that setting |
@adigitoleo putting the runtime dir into that said, the approach using a global dir has the definitive benefit of being in a ramdisk (something usually a normal user can't just mount), thus providing faster access without drive wear, especially since it's pretty much only used for stuff like pid files, sockets, fifos and mmap and doesn't really require any significant space. also note the specific requirement:
so essentially you'd have to destroy and remake that directory whenever all "sessions" (however that's defined on your system) of a user quit, something that a simple shell script can't really provide reliably. PAM / elogind and similar systems however can keep track of this.
but ssh is a login session. and handled by PAM/elogind just fine. |
Deviating from |
I see, thanks for the clarifications. I looked into pam_rundir but it seems there are some unresolved issues around the directory permissions. In this issue an artix guy mentions a fork of the project that apparently solves the issue. Void is not yet packaging that version. Simple installation of the current pam_rundir package doesn't seem to work. I suppose I need to set up the pam module somehow? My reservation about elogind does not come from an anti-systemd stance (although lack of systemd is probably an attractive feature of void for many users), but if all I want is to set up a directory and one environment variable, ~200k LOC seems rather overkill, so I'd prefer a simpler package for this. As I understand, elogind also provides other features, but I don't seem to miss them. If they are really critical, I'd be happy to reconsider using it. I tried to read through the Arch wiki on PAM but it's still a bit arcane to me. Setting up environment variables seems to be the easy part, but creating/destroying For the simplest possible solution, would it be reasonable to simply create the directory once, never destroy it (flaunting the spec) and use pam_env to set up the variable? |
@adigitoleo I think, unfortunately,
https://github.com/linux-pam/linux-pam/releases There don't seem to be any good alternatives yet: https://www.reddit.com/r/archlinux/comments/l0ascx/pam_env_is_being_deprecated_any_alternatives/ Maybe we just need to wait a bit longer, to see which of the different "PAM rundir" implementations are stable and maintained in the future. Right now there is:
|
Makes sense. I'll probably wait for the dumb_runtime_dir package myself, but I can understand not recommending it. Was lurking IRC today so I've seen that discussion ;) |
Another alternative, my favorite is just to create the directories in rc.local and export the variable from profiles. |
Manually setting `$XDG_RUNTIME_DIR` is not trivial to do while staying compliant to the XDG spec as noted in issue void-linux#635. This proposed way handles `$XDG_RUNTIME_DIR` properly without having to install `elogind` and should suggested as its alternative
Closing because the alternatives to manage the lifetime of runtime directories all have issues, the lifetime requirement on runtime directories has not been demonstrated to have any appreciable merit, and this issue has not seen continued activity. |
The docs have a section called XDG_RUNTIME_DIR which advises users that are not in a
elogind
environment (which takes care ofXDG_RUNTIME_DIR
automatically) to manually manage it through the shell:This is not trivial to do while staying compliant to the XDG spec. Here's the relevant part:
On IRC it was recently proposed to instead manage
XDG_RUNTIME_DIR
via pam_rundir in environments withoutelogind
.It seems there is also another alternative already packaged: rundird
The text was updated successfully, but these errors were encountered: