Last command displays wrong information


 
Thread Tools Search this Thread
Operating Systems Solaris Last command displays wrong information
# 1  
Old 07-30-2011
Last command displays wrong information

Hi am having Solaris10 - Sun-Fire-V890 server, the information displayed by Last command is wrong how do i get this sorted without loosing any datas..
Code:
# uptime
 12:32am  up 20 day(s), 33 min(s),  1 user,  load average: 1.54, 1.82, 1.93
# last reboot
reboot    system boot                   Sat Jun  7 23:12
reboot    system down                   Sat Jun  7 23:10
reboot    system boot                   Sun Jun  1 00:12
reboot    system down                   Sat Jun  7 23:09
reboot    system boot                   Sun Jun  1 00:12
# date
Sat Jul 30 00:32:56 CDT 2011

---------- Post updated at 04:34 AM ---------- Previous update was at 01:35 AM ----------

guru's please help..

Last edited by Scott; 07-30-2011 at 03:33 AM.. Reason: Code tags, please.
# 2  
Old 07-30-2011
On Solaris 10

The information that last uses resides in
/var/adm/wtmpx

the information for uptime is in:
/var/adm/utmpx

The disparity you see is not a big deal. It means someone did something to one of the files; it does not mean there is something horribly wrong with your system
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 07-30-2011
Fix your corrupt wtmpx file. The usual reason for having one is /var file system being almost full while some event is logged in wtmpx.

I haven't tried it but you might get help with that tool:
martin carpenter / projects / ckwtmpx
This User Gave Thanks to jlliagre For This Post:
# 4  
Old 07-30-2011
Solaris also provides system tool for fixing wtmpx. Check
Code:
man wtmpfix

This User Gave Thanks to bartus11 For This Post:
# 5  
Old 07-30-2011
AFAIK, wtmpfix can fix corrupted entries but not truncated ones, i.e. those that make the newer logs unreadable by regular tools.

Edit: After looking at its source code, wtmpfix does actually fix truncated entries too.

Cross Reference: /onnv/onnv-gate/usr/src/cmd/acct/wtmpfix.c

Last edited by jlliagre; 07-30-2011 at 05:38 PM..
This User Gave Thanks to jlliagre For This Post:
# 6  
Old 07-30-2011
Thanks all, for helping me ..
Bartuss11: how do i use wtmpfix command.. will it lead to server reboot or loss in the data which is there in wtmpx file.

I even checked the size of wtmpx file its 6M file..
# 7  
Old 07-30-2011
Quote:
Originally Posted by Sojourner
Thanks all, for helping me ..
Bartuss11: how do i use wtmpfix command.. will it lead to server reboot or loss in the data which is there in wtmpx file.

I even checked the size of wtmpx file its 6M file..
You use it like this:
Code:
cp /var/adm/wtmpx /var/adm/wtmpx.bak
/usr/lib/acct/wtmpfix /var/adm/wtmpx > /var/adm/wtmpx.tmp
mv /var/adm/wtmpx.tmp /var/adm/wtmpx

No reboot is required. If there is some problem with last command after this operation, you can simply restore the file from the backup copy:
Code:
cp /var/adm/wtmpx.bak /var/adm/wtmpx

This User Gave Thanks to bartus11 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Create a shell script to gather user account information and displays the result to administrator

I want to create a shell script to gather user account information and displays the result to administrator. I have created a script but its showing all the information when i search for username like: amit@mx:~$ ./uinfo.sh amit Username : amit User Info ... (2 Replies)
Discussion started by: amit1986
2 Replies

2. Shell Programming and Scripting

Bash $(...) DISPLAYS EVERY COMMAND

I use things like this a lot in ksh and bash, but lately bash has been printing the command for every loop: ... | while read f do if then echo Differ "$f" fi done How to prevent this? (5 Replies)
Discussion started by: DGPickett
5 Replies

3. UNIX for Dummies Questions & Answers

Which of the following command displays your login shell in bash shell?

Options:: A)$shell B)echo $ bash C)echo $ O D)$ O (1 Reply)
Discussion started by: raghugowda
1 Replies

4. Shell Programming and Scripting

What's wrong with the following command?

Hi all, I'm trying to run the following command to get all files in one directory to another with the files' timestamps preserved, cp -p /logs/dvgbiau/batch/* /logs/dvgbiau/tmp_batch Note that ./batch and ./tmp_batch are two sub-directories under /logs/dvgbiau. The error was,... (1 Reply)
Discussion started by: isaacniu
1 Replies

5. AIX

Command last displays wrong hostname

I faced an interesting problem on my AIX servers. When I checked last logins with command last I saw that hostnames are wrong. Let say, I made login from workstation xxxxx and with the command last I saw: root pts/2 yyyyy 5 jan 15:38 still logged in Ping xxxxx and ping... (3 Replies)
Discussion started by: giovanni
3 Replies

6. UNIX for Advanced & Expert Users

xbindkeys giving wrong mapping information

Hello, I'm having a problem with xbindkeys giving the wrong mapping information, hence I can't get it work at all when trying new mappings from this machine. From another computer, I have some definitions for xbindkeys (made with xbindkeys-config). These key codes work correctly on this... (0 Replies)
Discussion started by: Narnie
0 Replies

7. UNIX for Dummies Questions & Answers

what is wrong with this command?

Hello, I try to using the below command to find out all the datafiles under "sja" direcotory. $ xargs -i find {} -type f -ls < sja /bin/ksh: sja: cannot open so can you tell me what is wrong? Thanks Jerry (3 Replies)
Discussion started by: GreatJerry
3 Replies

8. UNIX for Advanced & Expert Users

what is wrong with this find command

i am trying to find the files which are more than 100MB and it was created 10 days ago. find /lola/loaded -size +102400 -mtime -10 -print | xargs ls -ltr -rw-rw-r-- 1 lola_adm gdrmp 82054170 Jun 23 06:17 /lola/loaded/ILMEMBER20090622.txt -rw-rw-r-- 1 lola_adm gdrmp 652080494 Jun 24... (3 Replies)
Discussion started by: sudhiroracle
3 Replies

9. Shell Programming and Scripting

Is anything wrong with this command

Hi All, can anyone tell me what is wrong with this command. tail -f /opt/olr-logs/PaymentGateway.log | grep "DEBUG - Start! AkhtarPaymentGateway - generateChecksum" | awk '{print $13}' | sed 's/,//g'>> abc But I found nothing in the file abc Please do help me.or Provide me some... (8 Replies)
Discussion started by: akhtar.bhat
8 Replies

10. UNIX for Dummies Questions & Answers

Creating a file that contains output from a command, and then displays itself

hey, I'm trying to create the command that will create a file named user.txt that contains the output of the command cut -d: -f1,5 /etc/passwd, and displays itself afterwards. I don't know how to bridge cat > user.txt with cut -d: -f1,5 /etc/passwd, or how display it afterwards. Any help would... (2 Replies)
Discussion started by: raidkridley
2 Replies
Login or Register to Ask a Question