Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What's reponsible of creating /run/user/<UID>
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6103
Location: Dallas area

PostPosted: Sun Mar 13, 2022 5:49 pm    Post subject: Reply with quote

Who owns the tmux process during all this (especially the daemon/server)

I would imagine that tmux has something to do with it.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3366
Location: Rasi, Finland

PostPosted: Sun Mar 13, 2022 7:09 pm    Post subject: Reply with quote

tmux server is per user basis, so the user who uses it owns the server process too.
Looks like elogind/pam doesn't consider detached tmux session as login session.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6103
Location: Dallas area

PostPosted: Sun Mar 13, 2022 7:49 pm    Post subject: Reply with quote

So a little shell script/bash subroutine, should work here. Then you'd just have to execute it after attaching session.

In it check for run dir existence and whether RUNTIME var is set and either create dir/set perms and/or set RUNTIME var.

Edit to add: post /etc/elogind/logind.conf

ETA2: You could always compile and add this also https://github.com/jjk-jacky/pam_rundir
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3366
Location: Rasi, Finland

PostPosted: Mon Mar 14, 2022 7:09 am    Post subject: Reply with quote

Code:
# grep -Ev '^#(\s+|$)' /etc/elogind/logind.conf

[Login]
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
RuntimeDirectorySize=2G
RuntimeDirectoryInodes=512k
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192

[Sleep]
#AllowSuspend=yes
#AllowHibernation=yes
#AllowSuspendThenHibernate=yes
#AllowHybridSleep=yes
#AllowPowerOffInterrupts=no
#BroadcastPowerOffInterrupts=yes
#AllowSuspendInterrupts=no
#BroadcastSuspendInterrupts=yes
#HandleNvidiaSleep=no
#SuspendState=mem standby freeze
#SuspendMode=
#HibernateState=disk
#HibernateMode=platform shutdown
#HybridSleepState=disk
#HybridSleepMode=suspend platform shutdown
#HibernateDelaySec=10800


I'll might give that PAM module a try...
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6103
Location: Dallas area

PostPosted: Mon Mar 14, 2022 10:43 am    Post subject: Reply with quote

Zucca wrote:
Code:
# grep -Ev '^#(\s+|$)' /etc/elogind/logind.conf

[Login]
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root


I'll might give that PAM module a try...


Have you tried uncommenting KillUserProcesses and KillExcludeUsers (add your user to list)?

I'm not sure what the default is, but if kill user process is set to yes then tmux doesn't like it.

As far as the pam module, it doesn't have an ebuild (not even overlays) but I though since it's a lua driven setup, using libucl as a basis would probably work for a new one. Though personally I'd just compile it and use it to see if it works, then worry about an ebuild.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3366
Location: Rasi, Finland

PostPosted: Fri Feb 10, 2023 8:51 pm    Post subject: Reply with quote

Bump. Back to the topic.
Since I didn't see any reason to keep elogind around anymore I switched to seatd.
seatd is quite barebones, so I needed to use a hack called pam_exec.
Specifically:
Code:
auth            requisite       pam_exec.so             /etc/greetd/login.sh auth
session         optional        pam_exec.so             /etc/greetd/login.sh session
... these lines I have added only so far to my greetd (display-manager) pam configuration.
I will add those too to my login pam conf too when I get this working as intended.
My plan is also to edit and add more information to seatd wiki page.

So far my simple shell script ran by pam/exec upon auth phase creates XDG_RUNTIME_DIR and empties its content (neccessary?) upon close_session. I will need to add more checks (in case of for example tmux session) before emptying the XDG_RUNTIME_DIR.

Currently my XDG_RUNTIME_DIRs are located under /tmp since it's mounted from zram dev.
I guess I could add directory quotas per user via filesystem too.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 932
Location: Richmond Hill, Canada

PostPosted: Fri Feb 10, 2023 9:26 pm    Post subject: Reply with quote

Zucca,

in your /etc/greetd/login.sh do you need to perform/execute actions other than setting environment?

if all you need are setting environment variables may be you can consider use pam_env(8) which can use a file in $HOME/.pam_environment to define per-user settting.
man pam_env:
PAM_ENV(8)                     Linux-PAM Manual                     PAM_ENV(8)

NAME
       pam_env - PAM module to set/unset environment variables

SYNOPSIS
       pam_env.so [debug] [conffile=conf-file] [envfile=env-file]
                  [readenv=0|1] [user_envfile=env-file] [user_readenv=0|1]

DESCRIPTION
       The pam_env PAM module allows the (un)setting of environment variables.
       Supported is the use of previously set environment variables as well as
       PAM_ITEMs such as PAM_RHOST.

       By default rules for (un)setting of variables are taken from the config
       file /etc/security/pam_env.conf. An alternate file can be specified
       with the conffile option.

       Second a file (/etc/environment by default) with simple KEY=VAL pairs
       on separate lines will be read. With the envfile option an alternate
       file can be specified. And with the readenv option this can be
       completely disabled.

       Third it will read a user configuration file ($HOME/.pam_environment by
       default). The default file can be changed with the user_envfile option
       and it can be turned on and off with the user_readenv option.

       Since setting of PAM environment variables can have side effects to
       other modules, this module should be the last one on the stack.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3366
Location: Rasi, Finland

PostPosted: Fri Feb 10, 2023 9:55 pm    Post subject: Reply with quote

pingtoo wrote:
in your /etc/greetd/login.sh do you need to perform/execute actions other than setting environment?

if all you need are setting environment variables may be you can consider use pam_env(8) which can use a file in $HOME/.pam_environment to define per-user settting.
I use pam_env in conjunction. I just didn't mention it (yet)
You cannot set any environment variables trough pam_exec - exporting variables from child to parent process isn't possible afaik.
However I use
/etc/security/pam_env.conf:
XDG_RUNTIME_DIR   DEFAULT=   OVERRIDE=/tmp/run/${USER}
... instead of per-user config.

The basic principle is that pam_env sets the XDG_RUNTIME_DIR, then pam_exec creates (and empties) the directories as needed.
I like this process to be dynamic. Meaning the actions are taken during login and logout.
The simpler way would just to have pam_env set XDG_RUNTIME_DIR and some boot script to loop trough actual user accounts and create the directories.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum