Editing Remote console setup

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
In case you are experiencing a kernel crash ([[oops]]) and have already [[Hardware testing|tested your hardware]], you should report what kernel says to the console (i.e. an [[oops]] text) to [https://bugs.openvz.org/ bug tracker]. Sometimes kernel crashes so badly that <tt>syslogd</tt> is not working and what kernel says is never written to a file. If this is the case, you have to catch what kernel says. There are several ways possible.
+
In case you are experiencing a kernel crash ([[oops]]) and have already [[Hardware testing|tested your hardware]], you should report what kernel says to the console (i.e. an [[oops]] text) to [http://bugzilla.openvz.org/ Bugzilla]. Sometimes kernel crashes so badly that <tt>syslogd</tt> is not working and what kernel says is never written to a file. If this is the case, you have to catch what kernel says. There are several ways possible.
 
 
== KDump ==
 
 
 
With RHEL6-based servers, kdump is pre-configured. See http://kb.odin.com/en/10044 to check the configuration. Dumps can be found under <code>/var/crash/</code> directory.
 
  
 
== Manual/Photo ==
 
== Manual/Photo ==
Line 27: Line 23:
 
</pre>
 
</pre>
  
<!--T:10-->
 
 
{{Warning|make sure kernel command line does '''not''' contain the word '''<code>quiet</code>''', otherwise most of the kernel messages will not be printed to console.}}
 
{{Warning|make sure kernel command line does '''not''' contain the word '''<code>quiet</code>''', otherwise most of the kernel messages will not be printed to console.}}
  
<!--T:11-->
 
 
For example, in GRUB boot loader configuration file <tt>/boot/grub/grub.conf</tt> it looks like this:
 
For example, in GRUB boot loader configuration file <tt>/boot/grub/grub.conf</tt> it looks like this:
 
<pre>
 
<pre>
Line 41: Line 35:
 
Kernel loaded with such parameters will send all kernel messages to /dev/ttyS0 (first serial port, a.k.a. COM1). If you have several ports, make sure that your null modem cable is connected to the appropriate port.
 
Kernel loaded with such parameters will send all kernel messages to /dev/ttyS0 (first serial port, a.k.a. COM1). If you have several ports, make sure that your null modem cable is connected to the appropriate port.
  
==== Receiving side ==== <!--T:13-->
+
==== Receiving side ====
 
On the second node you should run any software that can log from /dev/ttyS0.
 
On the second node you should run any software that can log from /dev/ttyS0.
  
<!--T:14-->
 
 
It can be usual
 
It can be usual
 
<pre>
 
<pre>
Line 78: Line 71:
 
Save the file, then recompile the kernel:
 
Save the file, then recompile the kernel:
  
# make bzImage && make modules && make modules_install
+
<pre>
 
+
# make bzImage && make modules && make modules_install
 +
</pre>
 
Update your bootloader for the new updated kernel. In my case I use LILO so I just type lilo at the prompt.
 
Update your bootloader for the new updated kernel. In my case I use LILO so I just type lilo at the prompt.
  
Line 88: Line 82:
 
Next you want your netconsole to send the request to somewhere. Load netconsole module, specifying the remote server parameters:
 
Next you want your netconsole to send the request to somewhere. Load netconsole module, specifying the remote server parameters:
  
# modprobe netconsole netconsole=4444@10.0.2.1/eth0,6666@10.0.2.2/00:05:5D:34:11:AF
+
<pre># modprobe netconsole netconsole=4444@10.0.2.1/eth0,6666@10.0.2.2/00:05:5D:34:11:AF</pre>
  
 
This will load the module with your settings. Replace your local IP address with where <tt>10.0.2.1</tt> is, <tt>eth0</tt> with your network interface card device, <tt>6666</tt> with the remote netconsole port (UDP), and <tt>10.0.2.2</tt> with your remote netconsole server IP. Also add in the mac address of your remote netconsole server, which in my case was 00:05:5D:34:11:AF. You can get the MAC address using arp utility:
 
This will load the module with your settings. Replace your local IP address with where <tt>10.0.2.1</tt> is, <tt>eth0</tt> with your network interface card device, <tt>6666</tt> with the remote netconsole port (UDP), and <tt>10.0.2.2</tt> with your remote netconsole server IP. Also add in the mac address of your remote netconsole server, which in my case was 00:05:5D:34:11:AF. You can get the MAC address using arp utility:
Line 105: Line 99:
 
=== Setting from initrd ===
 
=== Setting from initrd ===
  
To log the boot process before root filesystem is mounted, network device driver and netconsole modules must be loaded from initd.
+
To durable logging boot process before root filesystem mounting network device driver and netconsole module must be loaded from initd.
 
 
  
 
RedHat 5/CentOS 5:
 
RedHat 5/CentOS 5:
Line 112: Line 105:
 
  chmod +x /etc/sysconfig/mkinitrd/netconsole
 
  chmod +x /etc/sysconfig/mkinitrd/netconsole
 
  echo 'options netconsole netconsole=<sport>@<saddr>/<dev>,<dport>@<daddr>/<dmac>' >> /etc/modprobe.conf
 
  echo 'options netconsole netconsole=<sport>@<saddr>/<dev>,<dport>@<daddr>/<dmac>' >> /etc/modprobe.conf
 
 
Debian/Ubuntu:
 
Debian/Ubuntu:
 
  echo '<network-driver-module>' >> /etc/initramfs-tools/modules
 
  echo '<network-driver-module>' >> /etc/initramfs-tools/modules
 
  echo 'netconsole netconsole=<sport>@<saddr>/<dev>,<dport>@<daddr>/<dmac>' >> /etc/initramfs-tools/modules
 
  echo 'netconsole netconsole=<sport>@<saddr>/<dev>,<dport>@<daddr>/<dmac>' >> /etc/initramfs-tools/modules
  
and rebuild initrd.
+
and rebuild initrd
 
 
=== Setting up rsyslogd ===
 
 
 
 
 
/etc/rsyslog.d/netconsole.conf
 
  
$template NetconsoleFile,"/var/log/netconsole/%FROMHOST%-%$NOW%.log"
+
=== Setting up remote side ===  
$template NetconsoleFormat,"%rawmsg%"
 
 
$EscapeControlCharactersOnReceive off
 
$DropTrailingLFOnReception off
 
$RepeatedMsgReduction off
 
 
$RuleSet NetconsoleRuleset
 
*.* ?NetconsoleFile;NetconsoleFormat
 
$RuleSet RSYSLOG_DefaultRuleset
 
 
$ModLoad imudp
 
$InputUDPServerBindRuleset NetconsoleRuleset
 
$UDPServerRun 6666
 
 
 
=== Setting up remote side ===
 
 
 
Set up '''netcat''' ('''nc''' on some Linux distributions) on your console server to listen on port 6666 UDP:
 
 
 
netcat -u -l -p6666
 
 
 
or
 
 
 
nc -lu 6666
 
  
 +
Setup '''netcat''' ('''nc''' on some Linux distributions) on your console server to listen on port 6666 UDP:
 +
<pre>netcat -u -l -p6666</pre>
 
or
 
or
 
+
<pre>nc -lu 6666</pre>
socat  udp-listen:6666,reuseaddr -
 
 
 
 
When your kernel prints something on the console, the text will be also captured on this netconsole server.
 
When your kernel prints something on the console, the text will be also captured on this netconsole server.
  
Line 158: Line 122:
 
For automatic care about capturing on console server you can use init respawn feature in this way:
 
For automatic care about capturing on console server you can use init respawn feature in this way:
  
echo "n1:23:respawn:/bin/netcat -u -l -p 6666 >> /var/log/netconsole" >> /etc/inittab
+
<pre>
telinit q
+
echo "n1:23:respawn:/bin/netcat -u -l -p 6666 >> /var/log/netconsole" >> /etc/inittab
 +
telinit q
 +
</pre>
  
 
==== Adding date/time to messages ====
 
==== Adding date/time to messages ====
Line 197: Line 163:
 
</pre>
 
</pre>
  
<!--T:53-->
 
 
For more details, see man logrotate.
 
For more details, see man logrotate.
  
=== Testing netconsole ===
+
=== Testing netconsole ===  
First, check log level of console messages on OpenVZ side by:
 
  
cat /proc/sys/kernel/printk
+
First check log level of console messages on OpenVZ side by:
 +
 
 +
<pre>cat /proc/sys/kernel/printk</pre>
  
 
First number should be 7 for testing. You can arrange it by:
 
First number should be 7 for testing. You can arrange it by:
  
sysctl -w kernel.printk="7 4 1 7"
+
<pre>sysctl -w kernel.printk="7 4 1 7"</pre>
  
 
After testing you can restore previous setting the same way.
 
After testing you can restore previous setting the same way.
Line 220: Line 186:
 
* [[SysRq debugger]]
 
* [[SysRq debugger]]
 
* [[Kernel debug options]]
 
* [[Kernel debug options]]
 +
* [http://www.christians-louboutin.org/ christian louboutin]
  
== External links ==
 
* [http://kb.odin.com/en/10044 How to configure kdump (kernel crash dump)]
 
 
[[Category:QA]]
 
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
 
[[Category:Kernel]]
 
[[Category:Kernel]]
 
[[Category:Troubleshooting]]
 
[[Category:Troubleshooting]]

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: