Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1016475: tmux sessions do not persist through logout

228 views
Skip to first unread message

chrysn

unread,
Aug 1, 2022, 7:30:03 AM8/1/22
to
Package: tmux
Version: 3.3a-1
Severity: normal

Under some starting conditions (eg. "starting from an xterm in Gnome"),
the tmux server gets killed when the user logs off (or, more
practically, gets logged off by the X server crashing). This damages one
of tmux's strong points: keeping whatever is launched in it running no
matter how unstable the terminal connection is.

Steps to reproduce:

* In a fresh sid installation, start Gnome under X11 (Wayland not
tested).
* Alt+F2, xterm
* tmux
* Ensure you recognize the screen again later on
* Log out
* Log in back again, open xterm again
* tmux attach: "no sessions" -- the session was killed

Note that this is sentitive to the precise way tmux is being launched;
for example, if gnome-terminal were used, things would behave as normal.
That indicates that there is something processes can do to protect
themselves from getting killed (possibly with cgroups involved).

I've originally reported this against systemd as
https://bugs.debian.org/946645 assuming it's an error in
`KillUserProcesses=no` (whose default has caused similar grief), but
maintainers there insist it's not about that. The issue and discussion
around it may have valuable material, also w/rt other things I've
tested.

Please enable tmux to persist in the rough desktop environment. If you
think that it's not tmux's fault but tmux sessions should still persist,
please reassign to where you think this should be fixed.


Thanks
chrysn

PS. The issue appears to also exist in 3.4, which I've tested for
unrelated reasons.

-- System Information:
Debian Release: bookworm/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.18.0-3-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages tmux depends on:
ii libc6 2.33-8
ii libevent-core-2.1-7 2.1.12-stable-5+b1
ii libtinfo6 6.3+20220423-2
ii libutempter0 1.2.1-2

tmux recommends no packages.

tmux suggests no packages.

-- no debconf information

--
To use raw power is to make yourself infinitely vulnerable to greater powers.
-- Bene Gesserit axiom
signature.asc

Romain Francoise

unread,
Aug 1, 2022, 2:40:03 PM8/1/22
to
Hi,

There’s nothing tmux can do right now about systemd killing user
sessions without lingering enabled; just run `sudo loginctl
enable-linger $USER`.

Thanks.

Richard Lewis

unread,
Aug 7, 2022, 8:50:03 AM8/7/22
to
I start tmux with

$ systemd-run --scope --user tmux -2 # etc

and it seems to work for me - advantage being no 'sudo' needed

Perhaps 'tmux' should be a script that invokes the real tmux binary
with systemd-run (if running under systemd) and solve this problem for
everyone.
0 new messages