View previous topic :: View next topic |
Author |
Message |
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6103 Location: Dallas area
|
Posted: Sun Mar 13, 2022 5:49 pm Post subject: |
|
|
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 |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3366 Location: Rasi, Finland
|
Posted: Sun Mar 13, 2022 7:09 pm Post subject: |
|
|
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 |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6103 Location: Dallas area
|
Posted: Sun Mar 13, 2022 7:49 pm Post subject: |
|
|
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 |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3366 Location: Rasi, Finland
|
Posted: Mon Mar 14, 2022 7:09 am Post subject: |
|
|
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 |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6103 Location: Dallas area
|
Posted: Mon Mar 14, 2022 10:43 am Post subject: |
|
|
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 |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3366 Location: Rasi, Finland
|
Posted: Fri Feb 10, 2023 8:51 pm Post subject: |
|
|
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 |
|
|
pingtoo l33t
Joined: 10 Sep 2021 Posts: 932 Location: Richmond Hill, Canada
|
Posted: Fri Feb 10, 2023 9:26 pm Post subject: |
|
|
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 |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3366 Location: Rasi, Finland
|
Posted: Fri Feb 10, 2023 9:55 pm Post subject: |
|
|
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 |
|
|
|