2

The who -b command desn't show me the last reboot times on my Raspberry 3

    :~ $ uname -a
Linux xxxxx 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux
:~ $ who -b 
    system boot  1970-01-01 01:00

I configured the ntp daemon as the date is uptodate.

How to configure the system for getting this king of information.

Regards,

2
  • "who -b" should work. "last reboot" is also borked This is a bug Commented Nov 16, 2020 at 14:09
  • Does journalctl --list-boots help?
    – Pablo A
    Commented Nov 12 at 0:58

1 Answer 1

8

Short answer: Use: uptime --since (-s for short)

You can use the uptime command to find out how long it has been since the Pi (or any Unix/Linux OS) has booted. The -s flag tells uptime to calculate the boot time.

The Pi doesn't have a real-time clock (though there are RTC chips that you can add). This means it does not know the date/time as it boots. If it has access to a network, it'll reach out to a time-server to set these. But if it doesn't have a network, it will rely on a fake hardware clock (basically a file where it periodically writes the time). It isn't accurate, but at least it fixes problems where log files have "newer" entries with older date/time stamps than "older" entries.

See also.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.