Saving shutting-down kernel messages in a file?

When shutting down or rebooting openSUSE normally there are some kind of final console logs or messages, from the kernel, I think. Probably describing some of the processes run while halting.

Those are the ones I’d like to save in a text file, because they’d help me in debugging certain problem I’m having with another rig. How could I do this?

Thanks beforehand.

The only way to capture console messages is to configure either serial or net console. You can have multiple “console output devices”, all showing the same information.

It’s the first time I’ve ever heard about that. Already did a fast search and found a tutorial about setting up a serial console, but my rig is a laptop and it doesn’t have a 9-pin serial port…

Can you help me with this task?

Still help??

Sorry, no idea about serial debugging…
But aren’t those messages included in /var/log/messages maybe? (depends on which ones you’re interested in of course. the ones after unmounting the root filesystem won’t be in there for sure… :wink: )

And maybe this could help you:
Debugging
There are instructions there on how to write shutdown debug messages from dmesg to a file…

On Sat 01 Jun 2013 04:26:06 AM CDT, F style wrote:

When shutting down or rebooting openSUSE normally there are some kind of
final console logs or messages, from the kernel, I think. Probably
describing some of the processes run while halting.

Those are the ones I’d like to save in a text file, because they’d help
me in debugging certain problem I’m having with another rig. How could I
do this?

Thanks beforehand.

Hi
Have a look at the man page for klogd you can run an instance and log
the kernel messages to a file.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.11-desktop
up 3 days 1:34, 3 users, load average: 0.20, 0.18, 0.21
CPU AMD Athlon™ II P360@2.30GHz | GPU Mobility Radeon HD 4200

On 2013-06-01 17:24, malcolmlewis wrote:

> Hi
> Have a look at the man page for klogd you can run an instance and log
> the kernel messages to a file.

I’m afraid you can not on shutdown, because the filesystem is umounted
at some point. What can be done is already in /var/log/messages, to get
more you need a real serial console (no, usb-rs232 not valid).

OP: if your laptop has no serial port, get another laptop.
Or install a virtualized system, and do the testing there. At least
vmware can save text from the serial port to a log file.

I have never used ‘net console’, so I can’t help you with that one, sorry.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

On Sat 01 Jun 2013 03:53:06 PM CDT, Carlos E. R. wrote:

On 2013-06-01 17:24, malcolmlewis wrote:

> Hi
> Have a look at the man page for klogd you can run an instance and log
> the kernel messages to a file.

I’m afraid you can not on shutdown, because the filesystem is umounted
at some point. What can be done is already in /var/log/messages, to get
more you need a real serial console (no, usb-rs232 not valid).

OP: if your laptop has no serial port, get another laptop.
Or install a virtualized system, and do the testing there. At least
vmware can save text from the serial port to a log file.

I have never used ‘net console’, so I can’t help you with that one,
sorry.

Hi
It can be done over usb serial, not sure if it’s enabled in the kernel
though?

The kernel source has a file netconsole.txt which details how it’s
done, doesn’t seem to hard to configure.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.11-desktop
up 0:10, 3 users, load average: 0.40, 0.20, 0.13
CPU AMD Athlon™ II P360@2.30GHz | GPU Mobility Radeon HD 4200

On 2013-06-01 18:50, malcolmlewis wrote:

> Hi
> It can be done over usb serial, not sure if it’s enabled in the kernel
> though?

That would be a new feature. It is mentioned briefly in the
“serial-console.txt” file:

console=device,options

device: tty0 for the foreground virtual console
ttyX for any other virtual console
ttySx for a serial port
lp0 for the first parallel port
ttyUSB0 for the first USB serial device

options: depend on the driver. For the serial port this
defines the baudrate/parity/bits/flow control of
the port, in the format BBBBPNF, where BBBB is the
speed, P is parity (n/o/e), N is number of bits,
and F is flow control (‘r’ for RTS). Default is
9600n8. The maximum baudrate is 115200.

That’s all it says…

> The kernel source has a file netconsole.txt which details how it’s
> done, doesn’t seem to hard to configure.

Interesting.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

Here’s the info on netconsole.txt; https://www.kernel.org/doc/Documentation/networking/netconsole.txt

Here’s even more kernel documentation; https://www.kernel.org/doc/Documentation/

Enjoy :wink:

I also thought this might be helpfull. Customizing the Linux bootup and shutdown processes | TechRepublic