1.5. Configuring netconsole
If disk logging fails or using the serial console is not possible, you might need to use kernel debugging. The
netconsole kernel module enables to log kernel messages to another computer over the network.
To be able to use
netconsole, you need to have an rsyslog server that is properly configured on your network.
Procedure 1.1. Configuring an rsyslog server for netconsole
- Configure the
rsyslogddaemon to listen on the 514/udp port and receive messages from the network by uncommenting the following lines in theMODULESsection of the/etc/rsyslog.conffile:$ModLoad imudp $UDPServerRun 514
$ModLoad imudp $UDPServerRun 514Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the
rsyslogdservice for the changes to take effect:systemctl restart rsyslog
]# systemctl restart rsyslogCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify that
rsyslogdis listening on the 514/udp port:netstat -l | grep syslog
]# netstat -l | grep syslog udp 0 0 0.0.0.0:syslog 0.0.0.0:* udp6 0 0 [::]:syslog [::]:*Copy to Clipboard Copied! Toggle word wrap Toggle overflow The0.0.0.0:syslogand[::]:syslogvalues in thenetstat -loutput mean thatrsyslogdis listening on defaultnetconsoleport defined in the/etc/servicesfile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Netconsole is configured using the /etc/sysconfig/netconsole file, which is a part of the initscripts package. This package is installed by default and it also provides the netconsole service.
If you want to configure a sending machine, follow this procedure:
Procedure 1.2. Configuring a Sending Machine
- Set the value of the
SYSLOGADDRvariable in the/etc/sysconfig/netconsolefile to match the IP address of thesyslogdserver. For example:SYSLOGADDR=192.168.0.1
SYSLOGADDR=192.168.0.1Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the
netconsoleservice for the changes to take effect:systemctl restart netconsole.service
]# systemctl restart netconsole.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Enable
netconsole.serviceto run after rebooting the system:systemctl enable netconsole.service
]# systemctl enable netconsole.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow - View the
netconsolemessages from the client in the/var/log/messagesfile (default) or in the file specified inrsyslog.conf.cat /var/log/messages
]# cat /var/log/messagesCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
By default,
rsyslogd and netconsole.service use port 514. To use a different port, change the following line in /etc/rsyslog.conf to the required port number:
$UDPServerRun <PORT>
$UDPServerRun <PORT>
On the sending machine, uncomment and edit the following line in the
/etc/sysconfig/netconsole file:
SYSLOGPORT=514
SYSLOGPORT=514
For more information about
netconsole configuration and troubleshooting tips, see Netconsole Kernel Documentation.