You are not logged in.

#1 2019-03-05 02:33:47

quinoa42
Member
Registered: 2019-03-05
Posts: 7

[SOLVED] pts created by tmux counts as unique users

I accidentally realized that every pane in my tmux counts as a unique user when calling `users` or `w`. For example, this is the output of `w` when I have two pane opened in one tmux session:

$ w
 18:20:35 up  2:49,  3 users,  load average: 0.30, 0.28, 0.21
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
quinoa42 tty1      15:31    2:48m  1:38   0.00s xinit /home/quinoa42/.xinitrc -- /etc/X11/xinit/xserverrc ...
quinoa42 pts/1     15:36    2:25m 12.05s  1.80s /usr/bin/zsh
quinoa42 pts/3     15:50    3.00s  6.64s  0.00s w

This is the output of `users`:

$  users
quinoa42 quinoa42 quinoa42

However on all other *nix machines I have, including several VPSs running CentOS7 and one MBP, pts' with the same name as the user, created by tmux, are not considered as unique users.
Also I tried different combination of shells (between the latest zsh and the latest bash) and with or without my tmux configuration, it remains the same in Arch. I also tried this in my VM running Arch that was installed in January, and things are still the same.

Is this actually the correct behavior? If it isn't, is there any way I can fix it? Thanks!

EDIT:

according to the discussion on #archlinux-cn with farseerfc and megumi_fox, this is actually a feature instead of a bug: https://git.archlinux.org/svntogit/comm … s/tmux#n23

Last edited by quinoa42 (2019-03-27 05:19:23)

Offline

#2 2019-03-05 02:36:20

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] pts created by tmux counts as unique users

I can not reproduce. OMZ?

Please post your shell rc (bash or zsh).


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2019-03-05 03:09:27

quinoa42
Member
Registered: 2019-03-05
Posts: 7

Re: [SOLVED] pts created by tmux counts as unique users

jasonwryan wrote:

I can not reproduce. OMZ?

Please post your shell rc (bash or zsh).

Thanks for the quick response. I tried removing all my dotfiles (all of them are symlinked from a single directory, so removing it will disable all of them) but that didn't fix this, same when I switched to a new user account just created, so I think this shouldn't be directly related to my tmux or zsh/bash config. but Anyway, I do use OMZ (via antigen), and all my dotfiles is on my Github, and zsh/bashrc is here and my tmux.conf is here. If this is still impossible to reproduce or no one had any similar experience, I'll try this weekend to install a fresh Arch in my VM to see if I can find the cause.

Last edited by quinoa42 (2019-03-05 03:34:35)

Offline

#4 2019-03-05 04:05:21

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] pts created by tmux counts as unique users

LikeI said, i can't reproduce. And with OMZ (which is a clustetfuck of bad ideas ineptly implemented) and all those tmux plugins, I would imagine your issue is in there.

As it happens with a new user, are you sure you haven't altered any shell related files in  /etc?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2019-03-05 08:57:27

quinoa42
Member
Registered: 2019-03-05
Posts: 7

Re: [SOLVED] pts created by tmux counts as unique users

jasonwryan wrote:

LikeI said, i can't reproduce. And with OMZ (which is a clustetfuck of bad ideas ineptly implemented) and all those tmux plugins, I would imagine your issue is in there.

As it happens with a new user, are you sure you haven't altered any shell related files in  /etc?

Hi, thanks for your reply.

Yes I didn't alter any shell related file in /etc. To make my argument more persuasive, I just installed a fresh Arch in VM with the newest March iso and tried it without adding any configurations. It comes out that things are still the same. Here is the screenshot.
The only packages I installed beyond what have been provided by `base` are tmux, intel-ucode, grub, dosfstools and efibootmgr. And the only files I edited in /etc are those mentioned in the Install Guide explicitly.

Last edited by quinoa42 (2019-03-05 09:11:07)

Offline

#6 2019-03-05 12:25:47

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,611

Re: [SOLVED] pts created by tmux counts as unique users

ls -l /var/run/utmp /var/run/utmp /usr/lib/utempter/utempter

(Both of you ;-)

Edit, @quinoa42 - your vanilla testcase is btw. as root. Try a regular user as well.

Last edited by seth (2019-03-05 12:27:46)

Offline

#7 2019-03-05 22:23:06

quinoa42
Member
Registered: 2019-03-05
Posts: 7

Re: [SOLVED] pts created by tmux counts as unique users

seth wrote:
ls -l /var/run/utmp /var/run/utmp /usr/lib/utempter/utempter

(Both of you ;-)

Edit, @quinoa42 - your vanilla testcase is btw. as root. Try a regular user as well.

Thanks for the help. Here is the output:

$ ls -l /var/run/utmp /var/run/utmp /usr/lib/utempter/utempter
-rwxr-sr-x 1 root utmp 9992 Jun  4  2018 /usr/lib/utempter/utempter
-rw-rw-r-- 1 root utmp 1536 Mar  5 14:01 /var/run/utmp
-rw-rw-r-- 1 root utmp 1536 Mar  5 14:01 /var/run/utmp

The output is exactly the same in either a regular user or in root, and also the same both in the host Arch and in the fresh VM arch, except the timestamp for /var/run/utmp (which is the time I logged in I believe).

Offline

#8 2019-03-05 22:28:40

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,611

Re: [SOLVED] pts created by tmux counts as unique users

Not the output of those commands, but the tmux behavior.
However, utempter is capable of writing utmp on your side and afaiu some tmux bugs/wishes, that's the compile-time only configurable behavior (it's possible to compile tmux w/o utempter support)
The interesting question is whether the output is different for Jason (because of sysusers.d and utmp longing to be GID 20 and whatnot mumbojumbo going up and down this forum when dynamic user support showed up)

Offline

#9 2019-03-05 22:37:31

quinoa42
Member
Registered: 2019-03-05
Posts: 7

Re: [SOLVED] pts created by tmux counts as unique users

seth wrote:

Not the output of those commands, but the tmux behavior.
However, utempter is capable of writing utmp on your side and afaiu some tmux bugs/wishes, that's the compile-time only configurable behavior (it's possible to compile tmux w/o utempter support)
The interesting question is whether the output is different for Jason (because of sysusers.d and utmp longing to be GID 20 and whatnot mumbojumbo going up and down this forum when dynamic user support showed up)

Thanks for the quick response!
As you might have known, a new tmux pane refresh the timestamp of /var/run/utmp. Other than that I didn't notice any difference on my side.

Offline

#10 2019-03-05 22:38:22

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] pts created by tmux counts as unique users

The output is the same. After experimenting some more, I can reproduce this when I remote in to the tmux session.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#11 2019-03-05 22:57:54

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,611

Re: [SOLVED] pts created by tmux counts as unique users

Difference on https://wiki.archlinux.org/index.php/Tm … ogin_shell ?

qnd workaround could be to "cmod -x /usr/lib/utempter/utempter"

Offline

#12 2019-03-05 23:23:30

quinoa42
Member
Registered: 2019-03-05
Posts: 7

Re: [SOLVED] pts created by tmux counts as unique users

I've also thought about using a non-login shell might fix this, so I tried setting so yesterday,  but still the behavior remains the same.

Offline

Board footer

Powered by FluxBB