System Administration

no ouput from command 'last'

 
yulianto piyut
Valued Contributor

no ouput from command 'last'

guys,

anyone know why there are no output from command last? system running hp-ux 11.11. I have already do this for troubleshoot but still failed:

# cat /dev/null > /var/adm/wtmp
# last

wtmp begins Thu Jan 1 07:00
# /usr/sbin/acct/fwtmp < /var/adm/wtmp > /tmp/wtmp
# more /tmp/wtmp
user1 pts/5 0 0 0000 0000 0 Jan 1 07:00:00 1970
pts/5 0 0 0000 0000 0 Jan 1 07:00:00 1970
# /usr/sbin/acct/fwtmp -ic < /tmp/wtmp > /var/adm/wtmp
# last

wtmp begins Thu Jan 1 07:00


many thanks for your valuable time to discuss with me!


thx
7 REPLIES 7
yulianto piyut
Valued Contributor

Re: no ouput from command 'last'

guys,

this case happened for command "w/who". no user display from command w.

thx,
skt_skt
Honored Contributor

Re: no ouput from command 'last'

provide the output of
file /var/adm/wtmp;ll /var/adm/wtmp
last `who am i`
yulianto piyut
Valued Contributor

Re: no ouput from command 'last'

this,

$ who am i
$ file /var/adm/wtmp
/var/adm/wtmp: ascii text
$ ll /var/adm/wtmp
-rw-r--r-- 1 adm adm 180 Jul 19 12:03 /var/adm/wtmp
$ last `who am i`

wtmp begins Thu Jan 1 07:00
Dennis Handly
Acclaimed Contributor

Re: no ouput from command 'last'

I'm confused. The first thing you do is zap the contents of wtmp. How to you expect last(1) to work?
yulianto piyut
Valued Contributor

Re: no ouput from command 'last'

hi denis,

you can cek timestamp of /var/adm/wtmp (july 19). when i run last command, there is message " wtmp begin at Jan 1".

i login to server too (so i have 2 session using my login user), but when i run last command, there are no user displayed.

thx,
Dennis Handly
Acclaimed Contributor

Re: no ouput from command 'last'

>you can check timestamp of /var/adm/wtmp (july 19). when i run last command, there is message " wtmp begin at Jan 1".

I assume that if last(1) sees garbage in wtmp, it prints that bogus date, the start of the epoch, (time_t)0.
Nagashankarp
Frequent Advisor

Re: no ouput from command 'last'

sometimes the wtmp file might be corrupt, rename wtmp file and do a "touch wtmp"
then try logging in and check the result