HEADS UP: <utmp.h> gone. All welcome <utmpx.h>.

Vincent Poy vincepoy at gmail.com
Mon Feb 1 23:30:54 UTC 2010


I just updated to a January 31, 2010 -CURRENT from a -CURRENT prior to the
above change and have a few questions and issues:

1) What's the correct way to use wtmpcvt(1) as the usage is wtmpcvt oldfile
newfile
out of the utmp, wtmp, lastlog, the utmp is not important as that's
basically the current logins.  wtmp is not important either as that's just
the recent monthly logins.  What is the correct procedure to convert lastlog
as that is basically the database that showed when the last time a user
logged on to the system so that when using lastlogin or finger, it will
showed when the person last logged in?

I've tried wtmpcvt /var/log/lastlog /var/log/utx.lastlogin after backing up
/var/log/utx.lastlogin but when I ran lastlogin, it was all blank.

2) I noticed that for last for ftp sessions, it will not show it as a ftp
session like how the previous utmp did even though w now shows the session
when it's still connected, not sure if this is really a bad thing unless ftp
isn't the only way to not use a tty.  It seems finger now will report the
last login session which previously was only for tty sessions.

root at bigbang [2:19pm][/var/log] >> w
 2:20PM  up  8:59, 2 users, load averages: 0.08, 0.04, 0.00
USER       TTY      FROM                      LOGIN@  IDLE WHAT
vince      pts/0    solar.dnalogic.net        5:23AM     - screen
vince      -        solar                     2:20PM     - -
root at bigbang [2:20pm][/var/log] >> last
vince               solar                  Mon Feb  1 14:20   still logged
in
vince               localhost              Mon Feb  1 13:33 - 13:33  (00:00)
root       pts/11   localhost              Mon Feb  1 06:51 - 06:51  (00:00)
vince      pts/0    solar.dnalogic.net     Mon Feb  1 05:23   still logged
in
vince      pts/1    solar.dnalogic.net     Mon Feb  1 05:08 - 05:19  (00:11)
wtmp begins Mon Feb  1 05:07:02 PST 2010
root at bigbang [2:20pm][/var/log] >> last
vince               solar                  Mon Feb  1 14:20 - 14:20  (00:00)
vince               localhost              Mon Feb  1 13:33 - 13:33  (00:00)
root       pts/11   localhost              Mon Feb  1 06:51 - 06:51  (00:00)
vince      pts/0    solar.dnalogic.net     Mon Feb  1 05:23   still logged
in
vince      pts/1    solar.dnalogic.net     Mon Feb  1 05:08 - 05:19  (00:11)

3) I noticed that it seems the system in the w, who, finger, last,
lastlogin output is not recognizing additional sessions of the same user on
a new tty if they are already logged in such as this example.  I am already
logged in as vince on ptys/0 so I login again as vince on ptys/1:
28681  1  Is     0:00.04 login [pam] (login)
28682  1  S      0:00.10 -tcsh (tcsh)
28755  1  R+     0:00.00 ps -ax

who, w will only show the session on pts/0 but not the pts/1
vince at bigbang [2:43pm][~] >> who
vince            pts/0    Feb  1 05:23 (solar.dnalogic.net)
vince at bigbang [2:43pm][~] >> who
vince            pts/0    Feb  1 05:23 (solar.dnalogic.net)
vince at bigbang [2:43pm][~] >> w
 2:43PM  up  9:23, 1 user, load averages: 0.01, 0.05, 0.02
USER       TTY      FROM                      LOGIN@  IDLE WHAT
vince      pts/0    solar.dnalogic.net        5:23AM     - screen
last shows only the pts/0 session but not pts/1 while it does show two blank
tty sessions which were ftp.

vince at bigbang [2:43pm][~] >> last
vince               solar                  Mon Feb  1 14:20 - 14:20  (00:00)
vince               localhost              Mon Feb  1 13:33 - 13:33  (00:00)
root       pts/11   localhost              Mon Feb  1 06:51 - 06:51  (00:00)
vince      pts/0    solar.dnalogic.net     Mon Feb  1 05:23   still logged
in
vince      pts/1    solar.dnalogic.net     Mon Feb  1 05:08 - 05:19  (00:11)
wtmp begins Mon Feb  1 05:07:02 PST 2010

lastlogin shows only the last ftp session but not acknowledging that the
current ptys/1 session as the ptys/0 session is still active.
vince at bigbang [2:44pm][~] >> lastlogin
vince               solar                  Mon Feb  1 14:20:03 2010
finger shows only the pts/0 session but not the current pts/0 session and
the last login is basically the ftp session as the pts/1 session is not
acknowledged here either since pts/0 is still logged in.
vince at bigbang [2:44pm][~] >> finger vince |more
Login: vince                            Name: Vincent Poy
Directory: /home/vince                  Shell: /bin/tcsh
On since Mon Feb  1 05:23 (PST) on pts/0 (messages off) from
solar.dnalogic.net
Last login Mon Feb  1 14:20 (PST) on  from solar
New mail received Mon Feb  1 14:44 2010 (PST)
     Unread since Mon Feb  1 14:43 2010 (PST)

4) the misc/screen port appears to be broken:
It will stop in files screen.c and tty.c with the error:
sys/stropts.h: No such file or directory
which can be fixed by commenting out sys/stropts.h. in those two files but
the build will fail here:
cc -c -I. -I.    -O2 -pipe -DCOLORS256 -fno-strict-aliasing utmp.c
utmp.c:95: error: static declaration of 'getutxent' follows non-static
declaration
/usr/include/utmpx.h:76: error: previous declaration of 'getutxent' was here
utmp.c:96: error: static declaration of 'endutxent' follows non-static
declaration
/usr/include/utmpx.h:75: error: previous declaration of 'endutxent' was here
utmp.c:98: error: static declaration of 'setutxent' follows non-static
declaration
/usr/include/utmpx.h:80: error: previous declaration of 'setutxent' was here
utmp.c:107: error: 'UTMPX_FILE' undeclared here (not in a function)
utmp.c: In function 'makeuser':
utmp.c:740: error: 'struct utmpx' has no member named 'ut_name'
utmp.c:740: error: 'struct utmpx' has no member named 'ut_name'
utmp.c:740: warning: passing argument 3 of 'strncpy' makes integer from
pointer without a cast
utmp.c:742: error: 'struct utmpx' has no member named 'ut_xtime'
*** Error code 1
Stop in /usr/ports/sysutils/screen/work/screen-4.0.3.
*** Error code 1
Stop in /usr/ports/sysutils/screen.
*** Error code 1
Stop in /usr/ports/sysutils/screen.
root at bigbang [2:55pm][/usr/ports/sysutils/screen] >>
Cheers,
Vince
Vincent Poy, Ph.D. - Astrophysics


More information about the freebsd-current mailing list