Operating System - HP-UX
1847474 Members
2955 Online
110265 Solutions
New Discussion

Re: last command not working?

 
Waqar Razi
Regular Advisor

last command not working?

On one of rx8620 server running HP-UX 11.23, last command is not running. It gives the following error:

last
Invalid record size. Unable to continue ..

I have strings wtmp, its giving normal output.

Can some one give me some clue.
6 REPLIES 6
OldSchool
Honored Contributor

Re: last command not working?

still doesn't mean that corrupt record(s) don't exist in wtmp.

"last" expects records in a specific format, while "strings" simply reads a record and translates to printable, having no knowledge of any specific record format.
Waqar Razi
Regular Advisor

Re: last command not working?

Can we fix it?
Ganesan R
Honored Contributor

Re: last command not working?

Hi,

If you want to empty the file and do not need the existing informations.

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

If you want to fix the wtmp file, refer below threat.

http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1227538440018+28353475&threadId=1003618
Best wishes,

Ganesh.
James R. Ferguson
Acclaimed Contributor

Re: last command not working?

Hi Wagar:

> Can we fix it?

Either trim the 'wtmp'file to null and let it begin accumulating data again, or trim the file *until* your inability to run 'last' vanishes:

# /usr/sbin/acct/fwtmp < /var/adm/wtmp > /tmp/wtmp

...edit text and rebuild binary:

# /usr/sbin/acct/fwtmp -ic < /tmp/wtmp > /var/adm/wtmp

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: last command not working?

Note there are two wtmp* files. Have you tried wtmps?
last -X -f /var/adm/wtmps
Suraj K Sankari
Honored Contributor

Re: last command not working?

Hi,

I think last command is not able to read /var/adm/wtmp better trim your wtmp file and check
to trim wtmp I am using :

>/var/adm/wtmp

logout from server then login and try last command.

Suraj