You are not logged in.
expected:
I ssh to Arch server, login with non-root user, `tmux` to create a new session, `<prefix> d` to detach from it, exit ssh connection, ssh back, still be able to `tmux a` to attach to the pervious session.
in fact:
When I ssh to the server again, run `tmux a` gets `no sessions`, run `tmux ls` gets `no server running on /tmp/tmux-1000/default`.
I've checked https://wiki.archlinux.org/title/System … _on_logout, I didn't modify `KillUserProcesses` in `/etc/systemd/logind.conf` before.
If I run `systemd-run --scope --user tmux` to start tmux session, it remains after relogin.
And I did `sudo loginctl enable-linger`.
Last edited by freeeeezing (2024-03-29 16:23:32)
Offline
If I run `systemd-run --scope --user tmux` to start tmux session, it remains after relogin.
Means it's only systemd killing the process.
What does /etc/systemd/logind.conf look like and have you tried the explciitly disable KillUserProcesses (and reboot to be extra-super-safe on this)
"loginctl list-users" shows lingering for your reelvant user being enabled?
For tmux specifically, see https://wiki.archlinux.org/title/Tmux#A … th_systemd
Offline
In /etc/systemd/logind.conf KillUserProcesses equals no with a '#' in the begining. (meaning I had never modified that I guess) And the default is "no" accroding to wiki.
loginctl list-users
UID USER LINGER STATE
1000 sxing yes active
1 users listed.
It's active
I don't want to config sshd specifically
Last edited by freeeeezing (2024-03-29 08:07:24)
Offline
Yes, is - the idea however was to explicitly set it to "no" and not rely on any defaults here.
Offline
It's my logind.conf now
[Login]
#NAutoVTs=6
#ReserveVT=6
KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandlePowerKeyLongPress=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#HandleSuspendKey=suspend
#HandleSuspendKeyLongPress=hibernate
#HandleHibernateKey=hibernate
#HandleHibernateKeyLongPress=ignore
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
...
I did as you say and rebooted.
Systemd still kills tmux server.
Last edited by freeeeezing (2024-03-29 08:37:46)
Offline
Please use [code][/code] tags. Edit your post in this regard.
lingering affects user services *only*, but you're starting tmux as regular process, so you're not getting around running it either as a system service (for the user), or running it as user service (and enable lingering)
W/ all the issues and caveats that at least in the past have existed around lingering, I'd suggest to go for the system service (and disable lingering again)
Offline
Like I said I don't want to manually add a service for tmux.
What I expected should be the default behavior and I confirmed that by a newly install in a VM.
I will look for the reason why systemd kills tmux.
Offline
Check
· /etc/systemd/logind.conf
· /etc/systemd/logind.conf.d/*.conf
· /run/systemd/logind.conf.d/*.conf
· /usr/lib/systemd/logind.conf.d/*.conf
for overrides, mind KillOnlyUsers
Offline
I add "KillExcludeUsers=root MY_USERNAME" to logind.conf and problem solved
Don't understand why this should be set again if the "global" one is set to no.
Offline
OMG I found optimus manager write to /usr/lib/systemd/logind.conf.d/*.conf which set KillUserProcess to yes
Offline
These 4 locations have been written on the head of man logind.conf but I have never noticed them. I will keep that in my mind.
Thanks for your help, seth!
Offline
\o/
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline