Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Issue with 'last' command

  • 25-09-2013 08:04AM
    #1
    Closed Accounts Posts: 81 ✭✭


    Hi all,
    I have a problem with 'last' command not displaying recent logins on Solaris 10 zone.
    Basically there are users logging into the system on daily basis but the last login recorded is on Aug 4, over 6 weeks ago.
    I checked /var/adm/wtmpx file permission and it looks ok (644 permission, adm user and group)
    Time stamp on file is updated on every login, /var/ file system has plenty of free space.

    Any ideas how to fix this issue?


Comments

  • Closed Accounts Posts: 81 ✭✭jdod23


    Ok, got is sorted sooner then expected :)
    Turned out the /var/adm/wtmpx file got corrupted.

    Here is what I did to fix it, in case you ever need it:
    1) backup log file
    cp /var/adm/wtmpx /var/adm/wtmpx.backup

    2) use wtmpfix command to recover corrupted file, save in temporary file
    /usr/lib/acct/wtmpfix /var/adm/wtmpx > /var/adm/wtmpx.tmp

    This is the output I got:
    /usr/lib/acct/wtmpfix /var/adm/wtmpx > /var/adm/wtmpx.tmp
    /var/adm/wtmpx: offset 194928: file ends in mid-record
    /var/adm/wtmpx: offset 194928: suspecting misaligned records, repositioning
    /var/adm/wtmpx: offset 68052: starting re-scan
    /var/adm/wtmpx: offset 74748: now recognizing aligned records again
    /var/adm/wtmpx: offset 195276: EOF reached after recovering from corruption in the middle of the file. This file may need to be repaired by hand.

    3) at this stage you can check temporary file
    last -f wtmpx.tmp | more

    4) if output of above command is what you expect move temporary file back to original
    mv /var/adm/wtmpx.tmp /var/adm/wtmpx


  • Registered Users, Registered Users 2 Posts: 10,291 ✭✭✭✭Standard Toaster


    Cheers for the update, handy one that.


Advertisement