I’m experiencing kernel panics in a headless Raspberry Pi with Fedora 29 Server and need a way to capture what is happening.
First I tried to enable kdump, but this doesn’t seem possible. If someone has done it, I’d like to hear.
What I’m using now, is enabling netconsole to log all the kernel messages over the network to a rsyslog server. This is the config in the Pi:
/etc/modules-load.d/netconsole.conf:
netconsole
/etc/modprobe.d/netconsole.conf:
options netconsole netconsole=4444@10.0.0.1/eth0,20514@10.0.0.2/00:11:22:33:44:55
From the netconsole documentation:
netconsole=[+][src-port]@[src-ip]/[],[tgt-port]@/[tgt-macaddr]
where
+ if present, enable extended console support
src-port source for UDP packets (defaults to 6665)
src-ip source IP to use (interface address)
dev network interface (eth0)
tgt-port port for logging agent (6666)
tgt-ip IP address for logging agent
tgt-macaddr ethernet MAC address for logging agent (broadcast)
And in the rsyslog server:
/etc/rsyslog.d/pi-remote.conf:
$ModLoad imudp
$RuleSet remote
if $fromhost-ip=='10.0.0.1' then /var/log/remote/pi-netconsole.log
& stop
$InputUDPServerBindRuleset remote
$UDPServerRun 20514
$RuleSet RSYSLOG_DefaultRuleset
/etc/logrotate.d/remote-netconsole:
/var/log/remote/*.log
{
copytruncate
rotate 30
daily
missingok
dateext
notifempty
delaycompress
compress
maxage 31
postrotate
/usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true
endscript
}
# firewall-cmd --add-port=20514/udp
# firewall-cmd --add-port=20514/udp --permanent
I’ve used this documentation: https://fedoraproject.org/wiki/Netconsole https://www.kernel.org/doc/Documentation/networking/netconsole.txt https://michael.stapelberg.de/posts/2013-09-16-remote_syslog/
EDIT 03/02/2019:
I just realized there is a netconsole-service package you can install and provides an easy configuration file and service unit:
/etc/sysconfig/netconsole
# This is the configuration file for the netconsole service. By starting
# this service you allow a remote syslog daemon to record console output
# from this system.
# The local port number that the netconsole module will use
# LOCALPORT=6666
# The ethernet device to send console messages out of (only set this if it
# can't be automatically determined)
# DEV=
# The IP address of the remote syslog server to send messages to
SYSLOGADDR=10.0.0.2
# The listening port of the remote syslog daemon
SYSLOGPORT=20514
# The MAC address of the remote syslog server (only set this if it can't
# be automatically determined)
SYSLOGMACADDR="00:11:22:33:44:55"
# systemctl enable netconsole
# systemctl start netconsole