Command to output panic/reboot history in FreeBSD

5,542

Solution 1

You can use last(1). It's output looks like this:

$ last
savetherbtz      ttyp7    gw               Wed Aug 19 13:18   still logged in
reboot           ~                         Sat Aug 15 17:38
savetherbtz      ttyp0    gw               Sat Aug 15 04:34 - crash  (13:03)
reboot           ~                         Sat Aug 15 04:32
savetherbtz      ttyp0    gw               Fri Aug 14 21:07 - crash  (07:24)

If crashdumps were enabled you can also see timestamps of files in /var/crash directory.

Also you can see recent panics using command:

(cat /var/log/messages; bzcat /var/log/messages.*.bz2) | fgrep panic

Solution 2

If you have dumps turned on, there is some reasonably useful information about the crashes you've had in /var/crash - specifically the info.* files - this includes the dump time and the kernel panic string.

You can also use the crash dump (vmdump.*) with kgdb(1) to do more detailed debugging on these crashes.

Share:
5,542

Related videos on Youtube

Donald Byrd
Author by

Donald Byrd

Updated on September 17, 2022

Comments

  • Donald Byrd
    Donald Byrd almost 2 years

    Many years ago while dealing with a FreeBSD (5.3?) box that randomly panic'ed and reboot (bad memory as it turned out), I came across a command in some forum post that when used would output information about previous reboots including the panic message. It allowed me to look back and see how often the issue was happening. I should have made note of it, I guess I relied too much on history to remember it.

    It was an obscure (at least to me) command with a few args. It wasn't something I had to install via ports. I assume it relied on logs or dumps to collect the information. I think the output was formatted in two 40 character columns with most of the information in the first column. I think the panic message was part of the second column.

    Does this sound familiar to anyone?

  • Donald Byrd
    Donald Byrd almost 15 years
    Thanks for the reply. What you answered is useful but I would have remembered if it was a piped grep or awk command.
  • Donald Byrd
    Donald Byrd almost 15 years
    Thanks for the reply, but what I remember wasn't really about the crashes themselves, just that the system had rebooted and why (in my case it was from panics). I've asked this question many times in different forums but no luck -- I wish I had made note of the command instead of just thinking I could get it from history.
  • SaveTheRbtz
    SaveTheRbtz over 14 years
    I think it's linux-specific
  • TonyUser
    TonyUser over 14 years
    Your right, it is. Maybe kgdb? freebsd.org/doc/en/books/developers-handbook/…