Tmux ls, no server running, yet ps shows it running

I’ve used screen for 20 years, but didn’t figure out how to install it properly on nixos, so I gave it a shot, but now if I do:

#tmux ls
no server running on /run/user/1000/tmux-1000/default

Yet, I know it’s running, cause I started it yesterday:

#ps -ef|grep -i tmux
luser 252632 1 0 Sep19 ? 00:00:02 tmux
luser 274256 57443 0 Sep19 pts/1 00:00:00 tmux attach-session -t 0
luser 325082 308116 0 11:16 pts/4 00:00:00 grep -i tmux

For me tmux ls works, though I am a bit confused here, as you are using a convention that signals “run as root” while I see a user id thats definitely not roots in the output.

Could you run the equivalent ps without resolving UIDs or at least show the UID of luser and tell us who has the UID 1000?

1 Like

That’s curious you didn’t find how to install screen, it installs exactly like you installed tmux :slight_smile:

As for your tmux issue, it seems you are running tmux ls as root from the # prefixing your commands, and you started tmux as luser, which is a different user.

uid 1000 is luser

I just added the “#” in here before I posted to show it was the prompt.

However, now I’ve started a new tmux, so I have trouble troubleshooting this;)

We’ll see tomorrow if the same thing happens again;) Thank you.

Well, I didn’t find yet how I could specify my configs from my old screenrc, so that’s why I just installed tmux;)

ok, it’s happened again, now that I got home and trying to attach to my tmux.

I think it’s related to this:

, as the tmux was started over ssh and I don’t have that setting

Hehe, I ssh localhost and now it shows up.

Indeed, running a program controlling your terminal requires to force ssh to have a TTY.

I’d recommend using this code in your shell for remote ssh server instead of explicitly calling tmux attach

test -z "$TMUX" && tmux attach

Upon login on the remote system, if you are not in a tmux, attach to the tmux server. The check is to avoid infinite tmux recursion when creating a new shell within the tmux.

You can add a check for an existing tmux server if you want.

You just need to ssh into the server, and no need to run tmux attach

Hmm, the joy was shortlived. I still can’t get this to work.

If I’m in ssh -t and I start a tmux, then exit, shouldn’t I be able to attach to it, then?

yes, it should, the server starts and create a socket somewhere in /tmp/ that is reused to connect later.

[b0ef@quasar:~]$ ssh -t localhost
(b0ef@localhost) Password:
Last login: Tue Sep 20 14:57:00 2022 from ::1

[b0ef@quasar:~]$ tmux ls
no server running on /run/user/1000/tmux-1000/default

[b0ef@quasar:~]$ tmux
[detached (from session 0)]

[b0ef@quasar:~]$
logout
Connection to localhost closed.

[b0ef@quasar:~]$ tmux ls
no server running on /tmp/tmux-1000/default

[b0ef@quasar:~]$ ssh -t localhost
(b0ef@localhost) Password:
Last login: Tue Sep 20 14:57:18 2022 from ::1

[b0ef@quasar:~]$ tmus ls
tmus: command not found

[b0ef@quasar:~]$ tmux ls
0: 1 windows (created Tue Sep 20 14:57:27 2022)

Did you find a solution?

I don’t think it is a root issue.
I set up $TMUX_TMPDIR and build tmux myself and it works for most of the cases. while my tmux cannot my sessions in one of my shared clusters:

(base) [yerong2@golubh2 ~]$ tmux ls
no server running on /scratch/yerong/tmux/tmux-1103445/default