Solved

uptime not showing number of days it is up

Posted on 2008-06-09
9
2,515 Views
Last Modified: 2010-08-05
Hi all,

uptime on a solaris server doesn't show number of days it is up..issue might be wtmpx/utmpx getting truncated not sure or it might be a bug..does any one had similar issue? please let me knwo.

xyz # uptime
 4:01am  6 users,  load average: 12.23, 4.17, 2.62
#

0
Comment
Question by:lkurugan
  • 4
  • 3
  • 2
9 Comments
 
LVL 21

Expert Comment

by:robocat
ID: 21746365

Uptime seems to need the latest boot record from wtmpx to determine how long the system has been up.

You say the wtmpx gets truncated but you don't know why ?

0
 

Author Comment

by:lkurugan
ID: 21747727
uptime is looking at utmpx, utmpx is getting truncated I think...
0
 

Author Comment

by:lkurugan
ID: 21747839
some thing is screwing up utmpx, not sure which script it is and couple of my colleagues wrote dtrace to see which one is screwing up the files..but couldn't figure out ..I need to find out what process is screwing up utmpx and wtmox..any ideas?
0
 
LVL 21

Expert Comment

by:robocat
ID: 21749052

The most obvious place is to check all crontabs. Look in /var/spool/cron/crontabs to see all scheduled crons for all users.

Also check /etc/logadm.conf to see if anything happens to utmpw/wtmpx there. Also check if you're using runacct.

What's the oldest record in the utmpx database right now ?

(btw: you're right, I trussed uptime and it uses utmpx not wtmpx)

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 16

Expert Comment

by:Hanno Schröder
ID: 21749220
Some people (admins) try to keep utmpx small by truncation it.
Unfortunately, as it is a binary file and not a text file, it cannot
be truncated using simple commands like "tail" etc.

If you do run
  last
or
  last | grep boot
what do you get as the most recent entries?
0
 

Author Comment

by:lkurugan
ID: 21750728
we are not running runacct, is there a way on solaris 9 to see which processes is touching, modifying utmpx,wtmpx files?

I verified cron entries and they seem to be fine.
0
 
LVL 16

Expert Comment

by:Hanno Schröder
ID: 21752055
Do you have any entries at all (use "last")?

If not, copy it away and "rewind" it using
 > /var/adm/wtmpx

To find out what is modifying it:
a) when was it modified last (ls -l /var/adm/wtmpx) ?
b) Run "last" against that date. If there is an entry with that
    date it's likely that this event changed it and not your script
c) Check all (!) crontabs
      grep -v '^#' /var/spool/cron/crontabs/*
d) Also, see if you have any at jobs scheduled:
      at -l
0
 

Accepted Solution

by:
lkurugan earned 0 total points
ID: 21778105
we figured out the simultaneous logout of users is corrupting the utmpx file ( trying to update the file at the same time.
0
 
LVL 16

Expert Comment

by:Hanno Schröder
ID: 21838727
I doubt that this is really the reason as it is a normal consition
that multiple users do log out at the same time.
To make sure wtmpx does not get corrupted, only one entry
will get inserted at a time. If there are more, others will get
queued.
Solaris 10 is a very well developed and mature OS.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now