I tried tmux on Ubuntu Server 22.04, and closing SSH terminal did not terminate tmux. I did the same thing on Gnome Manjaro, tmux was terminated. Can I make it keep running, like Ubuntu?
There was the same question ( Tmux dies when logging out from remote ) but it is old so the thread was closed, and the reply " ssh.service instead of ssh.socket" does not seem to work, because when I executed systemctl, I saw “sshd.service”, not “ssh.socket”. /etc/systemd/system/multi-user.target.wants/sshd.service already had KillMode=process. I want to avoid that complicated systemd-run --scope --user... thing if possible. It did not require that on Ubuntu, so shouldn’t it be possible on Manjaro, too?
I enabled it (loginctl user-status says Linger: yes), but still closing the terminal seems to close tmux, because if I relog in and type tmux ls, it says no server running on /tmp/tmux-1000/default. I have not rebooted the PC. Is a reboot required?
And here: systemd/User - ArchWiki
It seems that on Arch-based (I don’t know if Manjaro has the same configuration but I guess so) systems, you don’t need linger because systemd is configured to not kill user processes after logout.
It’s unclear from your first post what your server is running (Manjaro or Ubuntu).
Which part exactly am I suppose to read. The only part that I think may be related is the service part. Do I have to run tmux as a service to keep it running after SSH is disclosed?
But with Ubuntu server, when I re-logged in SSH, the session was still there. I did not do any special configuration other than just running sudo apt install tmux.
The server is Manjaro. The client was Windows Terminal, but probably Windows Terminal (on Windows 11) is not the cause, because I used the same app to connect to both Manjaro and Ubuntu.
No, I did not change any tmux settings. So, enabling lingering is not needed, right? I have a Manjaro Gnome virtual machine that I had set up to ask about the Docker bridge network problem (which I still have not found a solution and gave up). I had created a snapshot after doing nothing but installing updates after the installation.
So, in the VM, I only installed tmux. I locally (by locally, I mean within the VM’s Gnome desktop) created a session, detached it, and logged out of Gnome desktop, re-logged in to the desktop, and tmux ls showed the session.
I reverted the VM to the previous state, installed openssh, and connected to it over SSH, installed tmux, created a session, detached it, disconnected from the SSH by typing exit, re-logged into the SSH, and tmux ls showed no server running on /tmp/tmux-1000/default.
I can’t anything of value to aarhus’ post above. I tested it with a new VM and it works right away exactly as it’s supposed to (xfce minimal as opposed to arm-minimal).
It seems it has something to do with Gnome. Because with XFCE I also had no problems, but Gnome with GDM did not worked. The tmux process was killed, even with KillUserProcesses=no in logind.conf (which is the default).
The only thing that worked was to start tmux with systemd-run and linger was enabled.
systemd-run --scope --user tmux
The systemd services from the Arch Wiki page might also work, but I did not tried these.
But this is a good example why using a GUI on a server is stupid.