Skip to content

Conversation

@stacyharper
Copy link

This is needed for some pam services that create the user XDG_RUNTIME_DIR. By example dumb_runtime_dir require the RUNTIME_DIR_PARENT to be present first.

Fixes: #658

fi
else
extra=/var/run
extra=/var/run /var/run/user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing quoting

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

if [ "$RC_UNAME" = Linux ]; then
# Satisfy Linux FHS
extra=/var/lib/misc
if [ ! -d /var/run/user ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should stick to /run/user, not /var/run

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

This is needed for some pam services that create the user
XDG_RUNTIME_DIR. By example dumb_runtime_dir require the RUNTIME_DIR_PARENT
to be present first.
@stacyharper stacyharper changed the title init.d/bootmisc: create /var/run/user init.d/bootmisc: create /run/user Oct 29, 2023
@stacyharper
Copy link
Author

stacyharper commented Dec 14, 2023

Can I have some news about this? Its been some months and I still would like for this directory to exists thanks to openrc.

@stacyharper
Copy link
Author

This is an humble bump. Someone could give a review please?

@zyxhere
Copy link

zyxhere commented Feb 24, 2025

Happy 1 year birthday!

@N-R-K
Copy link
Contributor

N-R-K commented Apr 16, 2025

Looks like alpine (unlike gentoo) doesn't really mandate a tmpfiles.d provider. Shame, since your usecase would've been much better served by it, something as simple as:

$ cat /etc/tmpfiles.d/dumb-xdg.conf
d /run/user 0755 root root -

But anyways, I kinda don't like this change. /run/user is systemd/elogind specific convention. And it's weird to halfass it and only create the basedir but not the user dirs.

It'd be more acceptable (to me, at least) if bootmisc just accepted some additional list of dir from conf.d to create. Something like this:

# conf.d/bootmisc
# ...
# additional directories to create, one per line, `-p` is implicit.
additional_mkdir="
-m 0755 /run/user
-m 1777 /tmp/mydir
"

The arguments can just be fed to mkdir(1) directly. Though mkdir(1) doesn't support owner/group so if that's necessary then that's a bit of a problem. (tmpfiles.d nicely solves this problem).

@navi-desu
Copy link
Member

we could have something like "user:group perms /dir", and feed that to checkpath

also i would argue that dumb_runtime_dir not creating it's toplevel dir is a bug in their code

@stacyharper
Copy link
Author

also i would argue that dumb_runtime_dir not creating it's toplevel dir is a bug in their code

I don't think they would change their mind: ifreund/dumb_runtime_dir#5 (comment)

@N-R-K
Copy link
Contributor

N-R-K commented Apr 16, 2025

Unless there are programs that hardcode /run/user/$UID (I wouldn't be surprised), then you don't need to create it there anyways. It's the entire reason why the path is supposed to be set in an env var (XDG_RUNTIME_DIR) so that it can be wherever.

It's perfectly acceptable to just do it as /run/$UID or /run/user.$UID or even put it somewhere in your $HOME optionally mounting it as a tmpfs (e.g in your /etc/fstab) so that cleanup auto occurs at shutdown.

@stacyharper
Copy link
Author

To be noted, dumb_runtime_dir has been patched in Alpine to use /run/user- as prefix, instead of /run/user/.

https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/81609

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create /run/user

5 participants