Date: Sun, 26 Jul 2020 22:18:30 +0200 From: Polytropon <freebsd@edvax.de> To: Ernie Luzar <luzar722@gmail.com> Cc: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: How to see shutdown log Message-ID: <20200726221830.f26e018f.freebsd@edvax.de> In-Reply-To: <5F1D8817.9090501@gmail.com> References: <5F1B8399.6000502@gmail.com> <20200725032502.5e0a272b.freebsd@edvax.de> <5F1D8817.9090501@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 26 Jul 2020 09:41:43 -0400, Ernie Luzar wrote: > Polytropon wrote: > > On Fri, 24 Jul 2020 20:58:01 -0400, Ernie Luzar wrote: > >> When you boot the system a bunch of messages roll across the screen to > >> fast to read. The dmesg -a command will show these to you to read at > >> your own pace. When you issue the shutdown or halt command a bunch of > >> different messages roll across the screen to fast to read. > >> > >> Is there a way view these messages after the system comes back up later? > > > > Yes, those are located to /var/log/messages, as long as > > file system access is possible; the last kernel messages > > therefore aren't being logged. > > > I checked and what is logged to /var/log/messages on host shutdown is no > were close to the messages I see fly past on the console terminal. The problem probably is that at a certain point, messages will only be written to terminal and to memory buffer, but not to a file because no file access is possible anymore (kernel still runs, but disks have been unmounted, so no VFS access can be done anymore). Messages in the RAM will not survive a reboot. However, those created at system startup are copied to the log file as soon as it becomes accessible. > This is real easy for people to test so give it a run. Sure. There is a possibility that might work, even though I have not tested it: You could "hijack" the kernel printing routine (the one that emits the messages) and have it copy characters to a line printer, a virtual one or a real one, and then you could see those messages. It would maybe also be possible to read the system console's file /dev/console and copy everything that is written to it to /dev/lpt0. > Thinking maybe something else is controlling what goes to the message > file on shutdown. Have any ideas where I should look? Basically, /var/log/messages contains all messages created with the system logging mechanism. When programs decide to emit messages by a simple printf() to whatever is their controlling terminal, those won't be logged. To get those messages, checking the console buffer (rather than the system message buffer) is probably a better way to do. Again, note that file access is made impossible at a certain stage during system shutdown that is usually followed by other stages that also can print messages. If you really want to get those messages, you need a way to capture them independently from anything that is a log file unter VFS control... -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200726221830.f26e018f.freebsd>