Uptime and who -b are showing different times

I have a server with suse system where it is showing to me two different times when the system was last booted.

suse:~ # who -b
system boot Jun 14 21:32
suse:~ # uptime
14:22pm up 5 days 4:23, 1 user, load average: 0.42, 0.36, 0.33
suse:~ # date
Tue Apr 8 14:22:48 CST 2014
suse:~ # last reboot
reboot system boot 3.0.76-0.11-defa Thu Apr 3 09:59 (5+04:23)
reboot system boot 3.0.76-0.11-defa Wed Dec 25 13:03 (104+01:19)
reboot system boot 3.0.76-0.11-defa Sat Jun 15 06:56 (193+06:01)
reboot system boot 3.0.76-0.11-defa Fri Jun 14 21:32 (193+15:25)

wtmp begins Fri Jun 14 21:32:41 2013

Is there some way to fix this difference?
thank you.

'suse’s is quite ambiguous it could be taken to mean openSUSE or SUSE Linux Enterprise. Could you tell us exactly which version you’re using? You can get this with

$ cat /etc/*release*

Either you’re posting from the future, or your server’s clock is wrong. Where I am the date/time is currently Tue 8 Apr 08:46:37 BST 2014, CST is west of me so the date you post hasn’t happened yet.

I’d start by fixing the clock.

Hi justeba,

Is there some way to fix this difference?

First of all, check your system time, both at the hardware and the system level. Do you run some ntp client? Then your system will start with its time set to the values from the hardware clock and then “jump” upon receiving ntp results. If that is not written back to the hardware clock, try to fix that.

Secondly, “who -b” accesses /var/run/utmp, while “last” uses /var/log/wtmp. Both files have the same general format, so you can take a peek at them using

[CODE]# last -f /var/log/wtmp

last -f /var/run/utmp

…[/CODE]
wtmp is the file considered more appropriate.

On my system /var/run/utmp is cleared upon reboot, so “who -b” reports the same as does “last reboot”. But using the info above, you should be able to track down why this is handled differently on your system. If you need assistance along the way, just let us know your questions together with some “cut&paste"s of the corresponding system commands and we’ll try to get this issue resolved. Start with details on the OS version, which Mike has already asked for (”$ cat /etc/release").

Regards,
Jens

[QUOTE=jmozdzen;20308]Hi justeba,

Is there some way to fix this difference?

First of all, check your system time, both at the hardware and the system level. Do you run some ntp client? Then your system will start with its time set to the values from the hardware clock and then “jump” upon receiving ntp results. If that is not written back to the hardware clock, try to fix that.

Secondly, “who -b” accesses /var/run/utmp, while “last” uses /var/log/wtmp. Both files have the same general format, so you can take a peek at them using

[CODE]# last -f /var/log/wtmp

last -f /var/run/utmp

…[/CODE]
wtmp is the file considered more appropriate.

On my system /var/run/utmp is cleared upon reboot, so “who -b” reports the same as does “last reboot”. But using the info above, you should be able to track down why this is handled differently on your system. If you need assistance along the way, just let us know your questions together with some “cut&paste"s of the corresponding system commands and we’ll try to get this issue resolved. Start with details on the OS version, which Mike has already asked for (”$ cat /etc/release").

Regards,
Jens[/QUOTE]

hi Jens,
at first,thank you for your help.

suse:~ # cat /etc/issue

Welcome to SUSE Linux Enterprise Server 11 SP3 (x86_64) - Kernel \r (\l).

some one told me that this will be ok after next reboot.

[QUOTE=mikewillis;20306]'suse’s is quite ambiguous it could be taken to mean openSUSE or SUSE Linux Enterprise. Could you tell us exactly which version you’re using? You can get this with

$ cat /etc/*release*

Either you’re posting from the future, or your server’s clock is wrong. Where I am the date/time is currently Tue 8 Apr 08:46:37 BST 2014, CST is west of me so the date you post hasn’t happened yet.

I’d start by fixing the clock.[/QUOTE]

hi thank you for your help.

suse:~ # cat /etc/issue

Welcome to SUSE Linux Enterprise Server 11 SP3 (x86_64) - Kernel \r (\l).

i am in china.so server’s clock is ok.

suse:~ # last -f /var/run/utmp
root pts/0 Wed Apr 9 10:04 still logged in
reboot system boot Fri Jun 14 21:32 (298+12:32)

utmp begins Fri Jun 14 21:32:41 2013

suse:~ # last -f /var/log/wtmp
root pts/0 Wed Apr 9 10:04 still logged in
root pts/0 Wed Apr 9 09:59 - 10:02 (00:03)
weblogic pts/0 Tue Apr 8 14:59 - 15:20 (00:20)
root pts/0 Tue Apr 8 14:22 - 14:25 (00:03)
reboot system boot 3.0.76-0.11-defa Thu Apr 3 09:59 (6+00:04)
root pts/0 Fri Nov 15 14:00 - 14:01 (00:00)
reboot system boot 3.0.76-0.11-defa Sat Jun 15 06:56 (193+06:01)
root tty1 Fri Jun 14 21:33 - crash (09:23)
reboot system boot 3.0.76-0.11-defa Fri Jun 14 21:32 (193+15:25)

some one told me that this will be ok after next reboot.may be he is right,but i do not think so.

I think who -b show this time
reboot system boot 3.0.76-0.11-defa Fri Jun 14 21:32 (193+15:25) all the time.

Ah, apologies. The information I looked at told me that CST is Central Standard Time, which is used in North America. Apparently CST can also mean China Standard Time.

As jmozdzen said, the information from ‘who -b’ and last comdes from different places. So I still say, and as jmozdzen suggested, check the time/date of the clocks. Since you say the system clock is OK check the hardware clock. You can see what time the hwclock is set by running as root

$ hwclock

See

$ man hwclock

for information on how to change the hardware clock

That’s an out of date Kernel version. I also advise that you install updates.