LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 03-25-2010, 07:07 AM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
[FYI] "last -f <old wtmp> -x reboot shutdown" incorrect for last reboot and shutdown


Hello

Further to this LQ thread which Tinkster solved by suggesting the last command (thanks Tinkster) I have been exploring last -x reboot and have found that the reported duration is incorrect for the last reboot and shutdown when a old wtmp file is used. Not having a record for the following shutdown, last assumes that the system has been up until the current time and similarly for the shutdown.

The output comes in time order, latest first, each line showing the time of the reboot and the uptime from then to shutdown. Using last -x reboot shutdown to show the shutdown time, here's an illustration
Code:
shutdown system down  2.6.29.6-smp     Sun Mar  7 15:35 - 03:02  (11:27)
reboot   system boot  2.6.29.6-smp     Sun Mar  7 09:35          (05:59)
09:35 until 15:35 is 05:59.

When the uptime exceeds 24 hours it is shown as (<days>+<hours:minutes) like this
Code:
shutdown system down  2.6.29.6-smp     Sun Feb 21 12:39 - 13:20  (00:40)
reboot   system boot  2.6.29.6-smp     Sat Feb 20 09:39         (1+02:59)
09:39 until 12:39 the next day is 1 day 02:59.

The time in parentheses at the end of the shutdown lines is normally the time until the next shutdown.

So far so good. The incorrect output is for the last reboot and shutdown of an old wtmp file. Here's the output of last /var/log/wtmp -x reboot shutdown; last -f /var/log/wtmp.1 -x reboot shutdown
Code:
[snip]
reboot   system boot  2.6.29.6-smp     Fri Mar 12 07:42          (01:54)
shutdown system down  2.6.29.6-smp     Fri Mar 12 01:31 - 09:37  (08:05)

wtmp begins Thu Mar 11 08:25:26 2010
[snip]
reboot   system boot  2.6.29.6-smp     Wed Mar 10 14:12         (15+01:42)
shutdown system down  2.6.29.6-smp     Wed Mar 10 12:41 - 15:54 (15+03:13)
[snip]
The boot started at "Wed Mar 10 14:12" which had an actual uptime of 1 day 11:20 is reported as 15 days 03:13 which is the time from then until the last -f /var/log/wtmp.1 -x reboot shutdown command was issued. The time from shutdown to shutdown is similarly affected.

Best

Charles

Last edited by catkin; 03-25-2010 at 07:10 AM. Reason: Subediting tyranny
 
Old 03-26-2010, 12:52 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Original Poster
Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Taking this thread off the zero reply list.
 
  


Reply

Tags
last, reboot, shutdown, uptime


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"shutdown" and "halt" symlinks: poweroff, reboot. sud_crow Linux From Scratch 11 10-18-2006 12:03 AM
"**** /sbin/dhcpcd: not running" messages on shutdown/reboot Nylex Slackware 2 01-22-2006 10:12 AM
ShutDown/Reboot using "KDE graphical logout" and GDM ? tsiMental Ubuntu 2 08-08-2005 11:54 AM
Removing "shutdown" and "reboot" in logout window nearfar Red Hat 1 10-07-2003 12:33 PM
"shutdown -r now" fails to reboot confusedchambo Linux - Software 6 08-21-2003 07:01 PM


All times are GMT -5. The time now is 10:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration