I'd like to fix issue for tmux when it can't report username via logname:

logname: no login name

I'm using steps below:

# lets assume all other prerequisites are compiled already
# and staged/installed to $HOME/opt

# libutempter (http://freecode.com/projects/libutempter)
# URL : ftp://ftp.altlinux.org/pub/people/ldv/utempter/libutempter-1.1.5.tar.bz2
tar xvfj libutempter-1.1.5.tar.bz2
cd libutempter-1.1.5
vi Makefile
grep 'DESTDIR =' Makefile
DESTDIR = /home/xxxxxx/opt

make install

# tmux (http://tmux.sourceforge.net/)
# URL : git://git.code.sf.net/p/tmux/tmux-code
git clone git://git.code.sf.net/p/tmux/tmux-code tmux
cd tmux
sh autogen.sh

CFLAGS="-I$HOME/opt/include -I$HOME/opt/usr/include -I$HOME/opt/include/ncurses" \
CPPFLAGS="-I$HOME/opt/include -I$HOME/opt/usr/include -I$HOME/opt/include/ncurses" \
LDFLAGS="-L$HOME/opt/lib -L$HOME/opt/include/ncurses -L$HOME/opt/include -L$HOME/opt/usr/lib" \
./configure --enable-static

CPPFLAGS="-I$HOME/opt/include -I$HOME/opt/usr/include -I$HOME/opt/include/ncurses" \
LDFLAGS="-static -L$HOME/opt/include -L$HOME/opt/usr/include -L$HOME/opt/include/ncurses -L$HOME/opt/lib -L$HOME/opt/usr/lib" \

But tmux still can't report login name via logname.

I can't install packages (no root access).

I updated env vars and flags, ldd reports no shared libs, but tmux still can't show login name via logname.

1 Answer 1


This is the intended purpose of libutempter, but it also requires a level of application support, which tmux has only recently (Feb 2014) gotten in the master branch (which you are using), but might not be ready for use.

From the FAQ in the current 1.9a source distribution:

* How is tmux different from GNU screen?
  - screen has support for updating utmp. Nobody has really come up with a clean,
    portable way to do this without making tmux setuid or setgid yet.

The master branch online FAQ omits exactly that point, though the CHANGES file is not yet updated.

Check for the define HAVE_UTEMPTER in Makefile (not the expected config.h!) after running configure, if it's not defined then you need to read config.log to determine what's wrong with the build environment.

My best guesses at this time are:

  • you don't have a libutempter.a, only libutempter.so, so the use of -static causes libutempter to fail detection, since it cannot be linked
  • it is detected and compiled in, but the utempter helper (to which the privileged task of updating utmp is delegated) is not setgid (usually setgid utmp)
  • some systems are known to limit access to that helper to prevent silliness, so the invoking binary (i.e. tmux) must also be setgid (usually setgid utempter)

If you build libutempter yourself it should make both static and dynamic versions, but I suspect that distribution packages will only contain the dynamic version.

If you do not have root access, you cannot install your own libutempter correctly: it cannot maintain the system utmp/wtmp files. If there is a system install of libutempter that lacks only libutempter.a, then you should be able to compile your own libutempter.a in order configure/link tmux statically, and use the already installed system setgid helper (usually /usr/lib/utempter/utempter or /usr/libexec/utempter/utempter). You cannot workaround the problem if access to that binary is also restricted, i.e. tmux needs to be setgid to run it.

Error handling for the new libutempter features is incomplete in tmux at this time, if you can rebuild libutempter with -DUTEMPTER_DEBUG it might help if none of the above did:

  • Thank you for answer. I've played with code a little, and think that utemper is used by tmux. Will probably need to check -DUTEMPTER_DEBUG.
    – zais
    Jan 30, 2015 at 14:28
  • BTW, how can i recompile libutemper with debug?
    – zais
    Jan 30, 2015 at 14:33
  • This should do the trick make CFLAGS=-DUTEMPTER_DEBUG Jan 30, 2015 at 16:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .