<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Koct9i</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Koct9i"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Koct9i"/>
	<updated>2026-05-02T17:31:13Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Remote_console_setup&amp;diff=15739</id>
		<title>Remote console setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Remote_console_setup&amp;diff=15739"/>
		<updated>2015-01-26T13:41:30Z</updated>

		<summary type="html">&lt;p&gt;Koct9i: /* Setting up rsyslogd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;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 &amp;lt;tt&amp;gt;syslogd&amp;lt;/tt&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
== Manual/Photo ==&lt;br /&gt;
If kernel backtrace is not long enough there are chances that it can fit into a single screen. In that case, you can just make a photo of the kernel crash screen and attach it to the bug report. If you do not have a camera, you still can carefully write down (using a piece of paper and a pen, that is) what you see on the screen, and later type it into the bug report.&lt;br /&gt;
&lt;br /&gt;
== Serial console ==&lt;br /&gt;
Here is a description of a common routine that is necessary to set up a serial console.&lt;br /&gt;
&lt;br /&gt;
=== Hardware setup ===&lt;br /&gt;
First of all you should make sure that your node has a [[w:Serial port|serial port]]. If there is no such port then&lt;br /&gt;
unfortunately this way is not for you.&lt;br /&gt;
&lt;br /&gt;
Then you need to find a second machine with a serial port on it.&lt;br /&gt;
This machine will be used to collect logs from your primary machine. Further you need to acquire&lt;br /&gt;
so-called [[w:Serial cable|null modem cable (a.k.a. serial cable)]] and it must be long enough to connect these two machines.&lt;br /&gt;
&lt;br /&gt;
=== Software setup ===&lt;br /&gt;
&lt;br /&gt;
==== Sending side ====&lt;br /&gt;
In your boot loader add the following kernel parameters: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
console=ttyS0,115200 console=tty0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Warning|make sure kernel command line does '''not''' contain the word '''&amp;lt;code&amp;gt;quiet&amp;lt;/code&amp;gt;''', otherwise most of the kernel messages will not be printed to console.}}&lt;br /&gt;
&lt;br /&gt;
For example, in GRUB boot loader configuration file &amp;lt;tt&amp;gt;/boot/grub/grub.conf&amp;lt;/tt&amp;gt; it looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
title Fedora Core (2.6.16-026test014.1-smp)&lt;br /&gt;
        root (hd0,0)&lt;br /&gt;
        kernel /vmlinuz-2.6.16-026test014.1-smp ro root=LABEL=/ console=ttyS0,115200 console=tty debug silencelevel=8&lt;br /&gt;
        initrd /initrd-2.6.16-026test014.1-smp.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==== Receiving side ====&lt;br /&gt;
On the second node you should run any software that can log from /dev/ttyS0.&lt;br /&gt;
&lt;br /&gt;
It can be usual&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat /dev/ttyS0 &amp;gt; /var/log/serial.log &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or something more sophisticated: syslogd, watchtty etc.&lt;br /&gt;
&lt;br /&gt;
==== Port setup ====&lt;br /&gt;
One more important thing. 115200 in the example above is the rate of emitting port. Receiving port must also work at the same rate. For example, to tune ttyS0 rate use stty program like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
stty 115200  &amp;lt; /dev/ttyS0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some other serial port parameters, like parity, number of stop bits etc. should also be the same on both sides.&lt;br /&gt;
&lt;br /&gt;
== Netconsole ==&lt;br /&gt;
&lt;br /&gt;
=== Kernel recompilation ===&lt;br /&gt;
If you use binary kernel from openvz.org, it already has netconsole module compiled in, so just skip to next section.&lt;br /&gt;
&lt;br /&gt;
If you build the kernel yourself, you might need to check if netconsole is compiled. To that effect, change to your kernel source directory and grep your kernel &amp;lt;tt&amp;gt;.config&amp;lt;/tt&amp;gt; for NETCONSOLE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/openvz/linux-2.6.16&lt;br /&gt;
# grep NETCONSOLE .config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see nothing or &amp;quot;# CONFIG_NETCONSOLE is not set&amp;quot; you need to recompile the kernel.&lt;br /&gt;
&lt;br /&gt;
Edit your kernel configuration file &amp;lt;tt&amp;gt;.config&amp;lt;/tt&amp;gt; with a text editor (&amp;lt;tt&amp;gt;nano .config&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;vi .config&amp;lt;/tt&amp;gt;). Set netconsole to Y or M (depending on whether you want it as a module or built into the kernel; I have compiled it as a module):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;CONFIG_NETCONSOLE=m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file, then recompile the kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# make bzImage &amp;amp;&amp;amp; make modules &amp;amp;&amp;amp; make modules_install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Update your bootloader for the new updated kernel. In my case I use LILO so I just type lilo at the prompt.&lt;br /&gt;
&lt;br /&gt;
Reboot into new kernel.&lt;br /&gt;
&lt;br /&gt;
=== Setting up OpenVZ side ===&lt;br /&gt;
&lt;br /&gt;
Next you want your netconsole to send the request to somewhere. Load netconsole module, specifying the remote server parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# modprobe netconsole netconsole=4444@10.0.2.1/eth0,6666@10.0.2.2/00:05:5D:34:11:AF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will load the module with your settings. Replace your local IP address with where &amp;lt;tt&amp;gt;10.0.2.1&amp;lt;/tt&amp;gt; is, &amp;lt;tt&amp;gt;eth0&amp;lt;/tt&amp;gt; with your network interface card device, &amp;lt;tt&amp;gt;6666&amp;lt;/tt&amp;gt; with the remote netconsole port (UDP), and &amp;lt;tt&amp;gt;10.0.2.2&amp;lt;/tt&amp;gt; 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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ping -c 1 10.0.2.2&lt;br /&gt;
# /sbin/arp -n 10.0.2.2&lt;br /&gt;
Address                  HWtype  HWaddress           Flags Mask            Iface&lt;br /&gt;
10.0.2.2                 ether   00:05:5D:34:11:AF   C                     eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the remote netconsole server is outside of local network area, use mac address of default gateway or router on local network area and IP address of remote netconsole server (loging via WAN). Mac address of default gateway or router you can get the same way (ping to gateway/router and see mac address via arp command).&lt;br /&gt;
&lt;br /&gt;
Netconsole documentation is available from &amp;lt;tt&amp;gt;Documentation/networking/netconsole.txt&amp;lt;/tt&amp;gt; file under your kernel source directory.&lt;br /&gt;
&lt;br /&gt;
=== Setting from initrd ===&lt;br /&gt;
&lt;br /&gt;
To durable logging boot process before root filesystem mounting network device driver and netconsole module must be loaded from initd.&lt;br /&gt;
&lt;br /&gt;
RedHat 5/CentOS 5:&lt;br /&gt;
 echo 'MODULES+=&amp;quot;&amp;lt;network-driver-module&amp;gt; netconsole &amp;quot;' &amp;gt; /etc/sysconfig/mkinitrd/netconsole&lt;br /&gt;
 chmod +x /etc/sysconfig/mkinitrd/netconsole&lt;br /&gt;
 echo 'options netconsole netconsole=&amp;lt;sport&amp;gt;@&amp;lt;saddr&amp;gt;/&amp;lt;dev&amp;gt;,&amp;lt;dport&amp;gt;@&amp;lt;daddr&amp;gt;/&amp;lt;dmac&amp;gt;' &amp;gt;&amp;gt; /etc/modprobe.conf&lt;br /&gt;
Debian/Ubuntu:&lt;br /&gt;
 echo '&amp;lt;network-driver-module&amp;gt;' &amp;gt;&amp;gt; /etc/initramfs-tools/modules&lt;br /&gt;
 echo 'netconsole netconsole=&amp;lt;sport&amp;gt;@&amp;lt;saddr&amp;gt;/&amp;lt;dev&amp;gt;,&amp;lt;dport&amp;gt;@&amp;lt;daddr&amp;gt;/&amp;lt;dmac&amp;gt;' &amp;gt;&amp;gt; /etc/initramfs-tools/modules&lt;br /&gt;
&lt;br /&gt;
and rebuild initrd&lt;br /&gt;
&lt;br /&gt;
=== Setting up rsyslogd ===&lt;br /&gt;
&lt;br /&gt;
/etc/rsyslog.d/netconsole.conf&lt;br /&gt;
&lt;br /&gt;
 $template NetconsoleFile,&amp;quot;/var/log/netconsole/%FROMHOST%-%$NOW%.log&amp;quot;&lt;br /&gt;
 $template NetconsoleFormat,&amp;quot;%rawmsg%&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 $EscapeControlCharactersOnReceive off&lt;br /&gt;
 $DropTrailingLFOnReception off&lt;br /&gt;
 $RepeatedMsgReduction off&lt;br /&gt;
 &lt;br /&gt;
 $RuleSet NetconsoleRuleset&lt;br /&gt;
 *.* ?NetconsoleFile;NetconsoleFormat&lt;br /&gt;
 $RuleSet RSYSLOG_DefaultRuleset&lt;br /&gt;
 &lt;br /&gt;
 $ModLoad imudp&lt;br /&gt;
 $InputUDPServerBindRuleset NetconsoleRuleset&lt;br /&gt;
 $UDPServerRun 6666&lt;br /&gt;
&lt;br /&gt;
=== Setting up remote side === &lt;br /&gt;
&lt;br /&gt;
Setup '''netcat''' ('''nc''' on some Linux distributions) on your console server to listen on port 6666 UDP:&lt;br /&gt;
&amp;lt;pre&amp;gt;netcat -u -l -p6666&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;nc -lu 6666&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;socat  udp-listen:6666,reuseaddr -&amp;lt;/pre&amp;gt;&lt;br /&gt;
When your kernel prints something on the console, the text will be also captured on this netconsole server.&lt;br /&gt;
&lt;br /&gt;
==== Adding to inittab ====&lt;br /&gt;
For automatic care about capturing on console server you can use init respawn feature in this way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;n1:23:respawn:/bin/netcat -u -l -p 6666 &amp;gt;&amp;gt; /var/log/netconsole&amp;quot; &amp;gt;&amp;gt; /etc/inittab&lt;br /&gt;
telinit q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Adding date/time to messages ====&lt;br /&gt;
&lt;br /&gt;
If you want the log to contain date/time of each line, you can use '''awk''' like this:&lt;br /&gt;
&lt;br /&gt;
 netcat -u -l -p6666 | awk '{print strftime(&amp;quot;%d %b %Y %H:%M:%S&amp;quot;), $0; fflush(stdout);}' &amp;gt;&amp;gt; /var/log/netconsole&lt;br /&gt;
&lt;br /&gt;
See man strftime for info about how to tailor strftime() argument to your needs.&lt;br /&gt;
&lt;br /&gt;
Note that if you want to add this to /etc/inittab, it should be done like this:&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;netcat -u -l -p6666 | awk '{print \&lt;br /&gt;
   strftime(&amp;quot;%d %b %Y %H:%M:%S&amp;quot;), \$0; fflush(stdout);}' \&lt;br /&gt;
   &amp;gt;&amp;gt; /var/log/netconsole&amp;quot; &amp;gt; /usr/local/sbin/netconsole&lt;br /&gt;
 chmod a+x /usr/local/sbin/netconsole&lt;br /&gt;
 echo &amp;quot;n1:23:respawn:/usr/local/sbin/netconsole&amp;quot; &amp;gt;&amp;gt; /etc/inittab&lt;br /&gt;
 telinit q&lt;br /&gt;
&lt;br /&gt;
==== Configuring logrotate ====&lt;br /&gt;
&lt;br /&gt;
For long term capturing you would like to do log rotating some way. With logrotate you can do it by creating config file /etc/logrotate.d/netconsole:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/netconsole {&lt;br /&gt;
    weekly&lt;br /&gt;
    rotate 8&lt;br /&gt;
    missingok&lt;br /&gt;
    compress&lt;br /&gt;
    copytruncate&lt;br /&gt;
    notifempty&lt;br /&gt;
    # Need to restart logger after log file move&lt;br /&gt;
    postrotate&lt;br /&gt;
        # Below line assumes netcat will be restarted by init&lt;br /&gt;
        killall -TERM netcat &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 || true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details, see man logrotate.&lt;br /&gt;
&lt;br /&gt;
=== Testing netconsole === &lt;br /&gt;
&lt;br /&gt;
First check log level of console messages on OpenVZ side by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cat /proc/sys/kernel/printk&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First number should be 7 for testing. You can arrange it by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sysctl -w kernel.printk=&amp;quot;7 4 1 7&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After testing you can restore previous setting the same way.&lt;br /&gt;
&lt;br /&gt;
Load '''netconsole''' module (see above) and on the console server run netcat (nc) command. On OpenVZ side provoke any console message, for example connect any USB hardware or try command:&lt;br /&gt;
&lt;br /&gt;
 modprobe tun&lt;br /&gt;
&lt;br /&gt;
If you see any console message on OpenVZ side, you should see message on console server too. If not, something is wrong. When debugging a problem, do not use tcpdump on OpenVZ side — it is not able to show netconsole packets. Instead, use tcpdump on console server. Quite a common source of problems with netconsole are firewalls.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[SysRq debugger]]&lt;br /&gt;
* [[Kernel debug options]]&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Kernel]]&lt;br /&gt;
[[Category:Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Koct9i</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Remote_console_setup&amp;diff=15657</id>
		<title>Remote console setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Remote_console_setup&amp;diff=15657"/>
		<updated>2014-12-15T13:04:17Z</updated>

		<summary type="html">&lt;p&gt;Koct9i: /* Setting up remote side */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;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 &amp;lt;tt&amp;gt;syslogd&amp;lt;/tt&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
== Manual/Photo ==&lt;br /&gt;
If kernel backtrace is not long enough there are chances that it can fit into a single screen. In that case, you can just make a photo of the kernel crash screen and attach it to the bug report. If you do not have a camera, you still can carefully write down (using a piece of paper and a pen, that is) what you see on the screen, and later type it into the bug report.&lt;br /&gt;
&lt;br /&gt;
== Serial console ==&lt;br /&gt;
Here is a description of a common routine that is necessary to set up a serial console.&lt;br /&gt;
&lt;br /&gt;
=== Hardware setup ===&lt;br /&gt;
First of all you should make sure that your node has a [[w:Serial port|serial port]]. If there is no such port then&lt;br /&gt;
unfortunately this way is not for you.&lt;br /&gt;
&lt;br /&gt;
Then you need to find a second machine with a serial port on it.&lt;br /&gt;
This machine will be used to collect logs from your primary machine. Further you need to acquire&lt;br /&gt;
so-called [[w:Serial cable|null modem cable (a.k.a. serial cable)]] and it must be long enough to connect these two machines.&lt;br /&gt;
&lt;br /&gt;
=== Software setup ===&lt;br /&gt;
&lt;br /&gt;
==== Sending side ====&lt;br /&gt;
In your boot loader add the following kernel parameters: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
console=ttyS0,115200 console=tty0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Warning|make sure kernel command line does '''not''' contain the word '''&amp;lt;code&amp;gt;quiet&amp;lt;/code&amp;gt;''', otherwise most of the kernel messages will not be printed to console.}}&lt;br /&gt;
&lt;br /&gt;
For example, in GRUB boot loader configuration file &amp;lt;tt&amp;gt;/boot/grub/grub.conf&amp;lt;/tt&amp;gt; it looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
title Fedora Core (2.6.16-026test014.1-smp)&lt;br /&gt;
        root (hd0,0)&lt;br /&gt;
        kernel /vmlinuz-2.6.16-026test014.1-smp ro root=LABEL=/ console=ttyS0,115200 console=tty debug silencelevel=8&lt;br /&gt;
        initrd /initrd-2.6.16-026test014.1-smp.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==== Receiving side ====&lt;br /&gt;
On the second node you should run any software that can log from /dev/ttyS0.&lt;br /&gt;
&lt;br /&gt;
It can be usual&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat /dev/ttyS0 &amp;gt; /var/log/serial.log &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or something more sophisticated: syslogd, watchtty etc.&lt;br /&gt;
&lt;br /&gt;
==== Port setup ====&lt;br /&gt;
One more important thing. 115200 in the example above is the rate of emitting port. Receiving port must also work at the same rate. For example, to tune ttyS0 rate use stty program like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
stty 115200  &amp;lt; /dev/ttyS0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some other serial port parameters, like parity, number of stop bits etc. should also be the same on both sides.&lt;br /&gt;
&lt;br /&gt;
== Netconsole ==&lt;br /&gt;
&lt;br /&gt;
=== Kernel recompilation ===&lt;br /&gt;
If you use binary kernel from openvz.org, it already has netconsole module compiled in, so just skip to next section.&lt;br /&gt;
&lt;br /&gt;
If you build the kernel yourself, you might need to check if netconsole is compiled. To that effect, change to your kernel source directory and grep your kernel &amp;lt;tt&amp;gt;.config&amp;lt;/tt&amp;gt; for NETCONSOLE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/openvz/linux-2.6.16&lt;br /&gt;
# grep NETCONSOLE .config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see nothing or &amp;quot;# CONFIG_NETCONSOLE is not set&amp;quot; you need to recompile the kernel.&lt;br /&gt;
&lt;br /&gt;
Edit your kernel configuration file &amp;lt;tt&amp;gt;.config&amp;lt;/tt&amp;gt; with a text editor (&amp;lt;tt&amp;gt;nano .config&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;vi .config&amp;lt;/tt&amp;gt;). Set netconsole to Y or M (depending on whether you want it as a module or built into the kernel; I have compiled it as a module):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;CONFIG_NETCONSOLE=m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file, then recompile the kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# make bzImage &amp;amp;&amp;amp; make modules &amp;amp;&amp;amp; make modules_install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Update your bootloader for the new updated kernel. In my case I use LILO so I just type lilo at the prompt.&lt;br /&gt;
&lt;br /&gt;
Reboot into new kernel.&lt;br /&gt;
&lt;br /&gt;
=== Setting up OpenVZ side ===&lt;br /&gt;
&lt;br /&gt;
Next you want your netconsole to send the request to somewhere. Load netconsole module, specifying the remote server parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# modprobe netconsole netconsole=4444@10.0.2.1/eth0,6666@10.0.2.2/00:05:5D:34:11:AF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will load the module with your settings. Replace your local IP address with where &amp;lt;tt&amp;gt;10.0.2.1&amp;lt;/tt&amp;gt; is, &amp;lt;tt&amp;gt;eth0&amp;lt;/tt&amp;gt; with your network interface card device, &amp;lt;tt&amp;gt;6666&amp;lt;/tt&amp;gt; with the remote netconsole port (UDP), and &amp;lt;tt&amp;gt;10.0.2.2&amp;lt;/tt&amp;gt; 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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ping -c 1 10.0.2.2&lt;br /&gt;
# /sbin/arp -n 10.0.2.2&lt;br /&gt;
Address                  HWtype  HWaddress           Flags Mask            Iface&lt;br /&gt;
10.0.2.2                 ether   00:05:5D:34:11:AF   C                     eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the remote netconsole server is outside of local network area, use mac address of default gateway or router on local network area and IP address of remote netconsole server (loging via WAN). Mac address of default gateway or router you can get the same way (ping to gateway/router and see mac address via arp command).&lt;br /&gt;
&lt;br /&gt;
Netconsole documentation is available from &amp;lt;tt&amp;gt;Documentation/networking/netconsole.txt&amp;lt;/tt&amp;gt; file under your kernel source directory.&lt;br /&gt;
&lt;br /&gt;
=== Setting from initrd ===&lt;br /&gt;
&lt;br /&gt;
To durable logging boot process before root filesystem mounting network device driver and netconsole module must be loaded from initd.&lt;br /&gt;
&lt;br /&gt;
RedHat 5/CentOS 5:&lt;br /&gt;
 echo 'MODULES+=&amp;quot;&amp;lt;network-driver-module&amp;gt; netconsole &amp;quot;' &amp;gt; /etc/sysconfig/mkinitrd/netconsole&lt;br /&gt;
 chmod +x /etc/sysconfig/mkinitrd/netconsole&lt;br /&gt;
 echo 'options netconsole netconsole=&amp;lt;sport&amp;gt;@&amp;lt;saddr&amp;gt;/&amp;lt;dev&amp;gt;,&amp;lt;dport&amp;gt;@&amp;lt;daddr&amp;gt;/&amp;lt;dmac&amp;gt;' &amp;gt;&amp;gt; /etc/modprobe.conf&lt;br /&gt;
Debian/Ubuntu:&lt;br /&gt;
 echo '&amp;lt;network-driver-module&amp;gt;' &amp;gt;&amp;gt; /etc/initramfs-tools/modules&lt;br /&gt;
 echo 'netconsole netconsole=&amp;lt;sport&amp;gt;@&amp;lt;saddr&amp;gt;/&amp;lt;dev&amp;gt;,&amp;lt;dport&amp;gt;@&amp;lt;daddr&amp;gt;/&amp;lt;dmac&amp;gt;' &amp;gt;&amp;gt; /etc/initramfs-tools/modules&lt;br /&gt;
&lt;br /&gt;
and rebuild initrd&lt;br /&gt;
&lt;br /&gt;
=== Setting up rsyslogd ===&lt;br /&gt;
&lt;br /&gt;
/etc/rsyslog.d/netconsole.conf&lt;br /&gt;
&lt;br /&gt;
 $template NetconsoleFile,&amp;quot;/var/log/netconsole-%FROMHOST%.log&amp;quot;&lt;br /&gt;
 $template NetconsoleFormat,&amp;quot;%rawmsg%&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 $EscapeControlCharactersOnReceive off&lt;br /&gt;
 $DropTrailingLFOnReception off&lt;br /&gt;
 &lt;br /&gt;
 $RuleSet NetconsoleRuleset&lt;br /&gt;
 *.* ?NetconsoleFile;NetconsoleFormat&lt;br /&gt;
 $RuleSet RSYSLOG_DefaultRuleset&lt;br /&gt;
 &lt;br /&gt;
 $ModLoad imudp&lt;br /&gt;
 $InputUDPServerBindRuleset NetconsoleRuleset&lt;br /&gt;
 $UDPServerRun 6666&lt;br /&gt;
&lt;br /&gt;
=== Setting up remote side === &lt;br /&gt;
&lt;br /&gt;
Setup '''netcat''' ('''nc''' on some Linux distributions) on your console server to listen on port 6666 UDP:&lt;br /&gt;
&amp;lt;pre&amp;gt;netcat -u -l -p6666&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;nc -lu 6666&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;socat  udp-listen:6666,reuseaddr -&amp;lt;/pre&amp;gt;&lt;br /&gt;
When your kernel prints something on the console, the text will be also captured on this netconsole server.&lt;br /&gt;
&lt;br /&gt;
==== Adding to inittab ====&lt;br /&gt;
For automatic care about capturing on console server you can use init respawn feature in this way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;n1:23:respawn:/bin/netcat -u -l -p 6666 &amp;gt;&amp;gt; /var/log/netconsole&amp;quot; &amp;gt;&amp;gt; /etc/inittab&lt;br /&gt;
telinit q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Adding date/time to messages ====&lt;br /&gt;
&lt;br /&gt;
If you want the log to contain date/time of each line, you can use '''awk''' like this:&lt;br /&gt;
&lt;br /&gt;
 netcat -u -l -p6666 | awk '{print strftime(&amp;quot;%d %b %Y %H:%M:%S&amp;quot;), $0; fflush(stdout);}' &amp;gt;&amp;gt; /var/log/netconsole&lt;br /&gt;
&lt;br /&gt;
See man strftime for info about how to tailor strftime() argument to your needs.&lt;br /&gt;
&lt;br /&gt;
Note that if you want to add this to /etc/inittab, it should be done like this:&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;netcat -u -l -p6666 | awk '{print \&lt;br /&gt;
   strftime(&amp;quot;%d %b %Y %H:%M:%S&amp;quot;), \$0; fflush(stdout);}' \&lt;br /&gt;
   &amp;gt;&amp;gt; /var/log/netconsole&amp;quot; &amp;gt; /usr/local/sbin/netconsole&lt;br /&gt;
 chmod a+x /usr/local/sbin/netconsole&lt;br /&gt;
 echo &amp;quot;n1:23:respawn:/usr/local/sbin/netconsole&amp;quot; &amp;gt;&amp;gt; /etc/inittab&lt;br /&gt;
 telinit q&lt;br /&gt;
&lt;br /&gt;
==== Configuring logrotate ====&lt;br /&gt;
&lt;br /&gt;
For long term capturing you would like to do log rotating some way. With logrotate you can do it by creating config file /etc/logrotate.d/netconsole:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/netconsole {&lt;br /&gt;
    weekly&lt;br /&gt;
    rotate 8&lt;br /&gt;
    missingok&lt;br /&gt;
    compress&lt;br /&gt;
    copytruncate&lt;br /&gt;
    notifempty&lt;br /&gt;
    # Need to restart logger after log file move&lt;br /&gt;
    postrotate&lt;br /&gt;
        # Below line assumes netcat will be restarted by init&lt;br /&gt;
        killall -TERM netcat &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 || true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details, see man logrotate.&lt;br /&gt;
&lt;br /&gt;
=== Testing netconsole === &lt;br /&gt;
&lt;br /&gt;
First check log level of console messages on OpenVZ side by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cat /proc/sys/kernel/printk&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First number should be 7 for testing. You can arrange it by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sysctl -w kernel.printk=&amp;quot;7 4 1 7&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After testing you can restore previous setting the same way.&lt;br /&gt;
&lt;br /&gt;
Load '''netconsole''' module (see above) and on the console server run netcat (nc) command. On OpenVZ side provoke any console message, for example connect any USB hardware or try command:&lt;br /&gt;
&lt;br /&gt;
 modprobe tun&lt;br /&gt;
&lt;br /&gt;
If you see any console message on OpenVZ side, you should see message on console server too. If not, something is wrong. When debugging a problem, do not use tcpdump on OpenVZ side — it is not able to show netconsole packets. Instead, use tcpdump on console server. Quite a common source of problems with netconsole are firewalls.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[SysRq debugger]]&lt;br /&gt;
* [[Kernel debug options]]&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Kernel]]&lt;br /&gt;
[[Category:Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Koct9i</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Remote_console_setup&amp;diff=15656</id>
		<title>Remote console setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Remote_console_setup&amp;diff=15656"/>
		<updated>2014-12-15T13:03:10Z</updated>

		<summary type="html">&lt;p&gt;Koct9i: /* Setting up rsyslogd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;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 &amp;lt;tt&amp;gt;syslogd&amp;lt;/tt&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
== Manual/Photo ==&lt;br /&gt;
If kernel backtrace is not long enough there are chances that it can fit into a single screen. In that case, you can just make a photo of the kernel crash screen and attach it to the bug report. If you do not have a camera, you still can carefully write down (using a piece of paper and a pen, that is) what you see on the screen, and later type it into the bug report.&lt;br /&gt;
&lt;br /&gt;
== Serial console ==&lt;br /&gt;
Here is a description of a common routine that is necessary to set up a serial console.&lt;br /&gt;
&lt;br /&gt;
=== Hardware setup ===&lt;br /&gt;
First of all you should make sure that your node has a [[w:Serial port|serial port]]. If there is no such port then&lt;br /&gt;
unfortunately this way is not for you.&lt;br /&gt;
&lt;br /&gt;
Then you need to find a second machine with a serial port on it.&lt;br /&gt;
This machine will be used to collect logs from your primary machine. Further you need to acquire&lt;br /&gt;
so-called [[w:Serial cable|null modem cable (a.k.a. serial cable)]] and it must be long enough to connect these two machines.&lt;br /&gt;
&lt;br /&gt;
=== Software setup ===&lt;br /&gt;
&lt;br /&gt;
==== Sending side ====&lt;br /&gt;
In your boot loader add the following kernel parameters: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
console=ttyS0,115200 console=tty0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Warning|make sure kernel command line does '''not''' contain the word '''&amp;lt;code&amp;gt;quiet&amp;lt;/code&amp;gt;''', otherwise most of the kernel messages will not be printed to console.}}&lt;br /&gt;
&lt;br /&gt;
For example, in GRUB boot loader configuration file &amp;lt;tt&amp;gt;/boot/grub/grub.conf&amp;lt;/tt&amp;gt; it looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
title Fedora Core (2.6.16-026test014.1-smp)&lt;br /&gt;
        root (hd0,0)&lt;br /&gt;
        kernel /vmlinuz-2.6.16-026test014.1-smp ro root=LABEL=/ console=ttyS0,115200 console=tty debug silencelevel=8&lt;br /&gt;
        initrd /initrd-2.6.16-026test014.1-smp.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==== Receiving side ====&lt;br /&gt;
On the second node you should run any software that can log from /dev/ttyS0.&lt;br /&gt;
&lt;br /&gt;
It can be usual&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat /dev/ttyS0 &amp;gt; /var/log/serial.log &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or something more sophisticated: syslogd, watchtty etc.&lt;br /&gt;
&lt;br /&gt;
==== Port setup ====&lt;br /&gt;
One more important thing. 115200 in the example above is the rate of emitting port. Receiving port must also work at the same rate. For example, to tune ttyS0 rate use stty program like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
stty 115200  &amp;lt; /dev/ttyS0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some other serial port parameters, like parity, number of stop bits etc. should also be the same on both sides.&lt;br /&gt;
&lt;br /&gt;
== Netconsole ==&lt;br /&gt;
&lt;br /&gt;
=== Kernel recompilation ===&lt;br /&gt;
If you use binary kernel from openvz.org, it already has netconsole module compiled in, so just skip to next section.&lt;br /&gt;
&lt;br /&gt;
If you build the kernel yourself, you might need to check if netconsole is compiled. To that effect, change to your kernel source directory and grep your kernel &amp;lt;tt&amp;gt;.config&amp;lt;/tt&amp;gt; for NETCONSOLE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/openvz/linux-2.6.16&lt;br /&gt;
# grep NETCONSOLE .config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see nothing or &amp;quot;# CONFIG_NETCONSOLE is not set&amp;quot; you need to recompile the kernel.&lt;br /&gt;
&lt;br /&gt;
Edit your kernel configuration file &amp;lt;tt&amp;gt;.config&amp;lt;/tt&amp;gt; with a text editor (&amp;lt;tt&amp;gt;nano .config&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;vi .config&amp;lt;/tt&amp;gt;). Set netconsole to Y or M (depending on whether you want it as a module or built into the kernel; I have compiled it as a module):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;CONFIG_NETCONSOLE=m&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file, then recompile the kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# make bzImage &amp;amp;&amp;amp; make modules &amp;amp;&amp;amp; make modules_install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Update your bootloader for the new updated kernel. In my case I use LILO so I just type lilo at the prompt.&lt;br /&gt;
&lt;br /&gt;
Reboot into new kernel.&lt;br /&gt;
&lt;br /&gt;
=== Setting up OpenVZ side ===&lt;br /&gt;
&lt;br /&gt;
Next you want your netconsole to send the request to somewhere. Load netconsole module, specifying the remote server parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# modprobe netconsole netconsole=4444@10.0.2.1/eth0,6666@10.0.2.2/00:05:5D:34:11:AF&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will load the module with your settings. Replace your local IP address with where &amp;lt;tt&amp;gt;10.0.2.1&amp;lt;/tt&amp;gt; is, &amp;lt;tt&amp;gt;eth0&amp;lt;/tt&amp;gt; with your network interface card device, &amp;lt;tt&amp;gt;6666&amp;lt;/tt&amp;gt; with the remote netconsole port (UDP), and &amp;lt;tt&amp;gt;10.0.2.2&amp;lt;/tt&amp;gt; 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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ping -c 1 10.0.2.2&lt;br /&gt;
# /sbin/arp -n 10.0.2.2&lt;br /&gt;
Address                  HWtype  HWaddress           Flags Mask            Iface&lt;br /&gt;
10.0.2.2                 ether   00:05:5D:34:11:AF   C                     eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the remote netconsole server is outside of local network area, use mac address of default gateway or router on local network area and IP address of remote netconsole server (loging via WAN). Mac address of default gateway or router you can get the same way (ping to gateway/router and see mac address via arp command).&lt;br /&gt;
&lt;br /&gt;
Netconsole documentation is available from &amp;lt;tt&amp;gt;Documentation/networking/netconsole.txt&amp;lt;/tt&amp;gt; file under your kernel source directory.&lt;br /&gt;
&lt;br /&gt;
=== Setting from initrd ===&lt;br /&gt;
&lt;br /&gt;
To durable logging boot process before root filesystem mounting network device driver and netconsole module must be loaded from initd.&lt;br /&gt;
&lt;br /&gt;
RedHat 5/CentOS 5:&lt;br /&gt;
 echo 'MODULES+=&amp;quot;&amp;lt;network-driver-module&amp;gt; netconsole &amp;quot;' &amp;gt; /etc/sysconfig/mkinitrd/netconsole&lt;br /&gt;
 chmod +x /etc/sysconfig/mkinitrd/netconsole&lt;br /&gt;
 echo 'options netconsole netconsole=&amp;lt;sport&amp;gt;@&amp;lt;saddr&amp;gt;/&amp;lt;dev&amp;gt;,&amp;lt;dport&amp;gt;@&amp;lt;daddr&amp;gt;/&amp;lt;dmac&amp;gt;' &amp;gt;&amp;gt; /etc/modprobe.conf&lt;br /&gt;
Debian/Ubuntu:&lt;br /&gt;
 echo '&amp;lt;network-driver-module&amp;gt;' &amp;gt;&amp;gt; /etc/initramfs-tools/modules&lt;br /&gt;
 echo 'netconsole netconsole=&amp;lt;sport&amp;gt;@&amp;lt;saddr&amp;gt;/&amp;lt;dev&amp;gt;,&amp;lt;dport&amp;gt;@&amp;lt;daddr&amp;gt;/&amp;lt;dmac&amp;gt;' &amp;gt;&amp;gt; /etc/initramfs-tools/modules&lt;br /&gt;
&lt;br /&gt;
and rebuild initrd&lt;br /&gt;
&lt;br /&gt;
=== Setting up rsyslogd ===&lt;br /&gt;
&lt;br /&gt;
/etc/rsyslog.d/netconsole.conf&lt;br /&gt;
&lt;br /&gt;
 $template NetconsoleFile,&amp;quot;/var/log/netconsole-%FROMHOST%.log&amp;quot;&lt;br /&gt;
 $template NetconsoleFormat,&amp;quot;%rawmsg%&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 $EscapeControlCharactersOnReceive off&lt;br /&gt;
 $DropTrailingLFOnReception off&lt;br /&gt;
 &lt;br /&gt;
 $RuleSet NetconsoleRuleset&lt;br /&gt;
 *.* ?NetconsoleFile;NetconsoleFormat&lt;br /&gt;
 $RuleSet RSYSLOG_DefaultRuleset&lt;br /&gt;
 &lt;br /&gt;
 $ModLoad imudp&lt;br /&gt;
 $InputUDPServerBindRuleset NetconsoleRuleset&lt;br /&gt;
 $UDPServerRun 6666&lt;br /&gt;
&lt;br /&gt;
=== Setting up remote side === &lt;br /&gt;
&lt;br /&gt;
Setup '''netcat''' ('''nc''' on some Linux distributions) on your console server to listen on port 6666 UDP:&lt;br /&gt;
&amp;lt;pre&amp;gt;netcat -u -l -p6666&amp;lt;/pre&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;pre&amp;gt;nc -lu 6666&amp;lt;/pre&amp;gt;&lt;br /&gt;
When your kernel prints something on the console, the text will be also captured on this netconsole server.&lt;br /&gt;
&lt;br /&gt;
==== Adding to inittab ====&lt;br /&gt;
For automatic care about capturing on console server you can use init respawn feature in this way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;n1:23:respawn:/bin/netcat -u -l -p 6666 &amp;gt;&amp;gt; /var/log/netconsole&amp;quot; &amp;gt;&amp;gt; /etc/inittab&lt;br /&gt;
telinit q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Adding date/time to messages ====&lt;br /&gt;
&lt;br /&gt;
If you want the log to contain date/time of each line, you can use '''awk''' like this:&lt;br /&gt;
&lt;br /&gt;
 netcat -u -l -p6666 | awk '{print strftime(&amp;quot;%d %b %Y %H:%M:%S&amp;quot;), $0; fflush(stdout);}' &amp;gt;&amp;gt; /var/log/netconsole&lt;br /&gt;
&lt;br /&gt;
See man strftime for info about how to tailor strftime() argument to your needs.&lt;br /&gt;
&lt;br /&gt;
Note that if you want to add this to /etc/inittab, it should be done like this:&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;netcat -u -l -p6666 | awk '{print \&lt;br /&gt;
   strftime(&amp;quot;%d %b %Y %H:%M:%S&amp;quot;), \$0; fflush(stdout);}' \&lt;br /&gt;
   &amp;gt;&amp;gt; /var/log/netconsole&amp;quot; &amp;gt; /usr/local/sbin/netconsole&lt;br /&gt;
 chmod a+x /usr/local/sbin/netconsole&lt;br /&gt;
 echo &amp;quot;n1:23:respawn:/usr/local/sbin/netconsole&amp;quot; &amp;gt;&amp;gt; /etc/inittab&lt;br /&gt;
 telinit q&lt;br /&gt;
&lt;br /&gt;
==== Configuring logrotate ====&lt;br /&gt;
&lt;br /&gt;
For long term capturing you would like to do log rotating some way. With logrotate you can do it by creating config file /etc/logrotate.d/netconsole:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/netconsole {&lt;br /&gt;
    weekly&lt;br /&gt;
    rotate 8&lt;br /&gt;
    missingok&lt;br /&gt;
    compress&lt;br /&gt;
    copytruncate&lt;br /&gt;
    notifempty&lt;br /&gt;
    # Need to restart logger after log file move&lt;br /&gt;
    postrotate&lt;br /&gt;
        # Below line assumes netcat will be restarted by init&lt;br /&gt;
        killall -TERM netcat &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 || true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more details, see man logrotate.&lt;br /&gt;
&lt;br /&gt;
=== Testing netconsole === &lt;br /&gt;
&lt;br /&gt;
First check log level of console messages on OpenVZ side by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cat /proc/sys/kernel/printk&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First number should be 7 for testing. You can arrange it by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sysctl -w kernel.printk=&amp;quot;7 4 1 7&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After testing you can restore previous setting the same way.&lt;br /&gt;
&lt;br /&gt;
Load '''netconsole''' module (see above) and on the console server run netcat (nc) command. On OpenVZ side provoke any console message, for example connect any USB hardware or try command:&lt;br /&gt;
&lt;br /&gt;
 modprobe tun&lt;br /&gt;
&lt;br /&gt;
If you see any console message on OpenVZ side, you should see message on console server too. If not, something is wrong. When debugging a problem, do not use tcpdump on OpenVZ side — it is not able to show netconsole packets. Instead, use tcpdump on console server. Quite a common source of problems with netconsole are firewalls.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[SysRq debugger]]&lt;br /&gt;
* [[Kernel debug options]]&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Kernel]]&lt;br /&gt;
[[Category:Troubleshooting]]&lt;/div&gt;</summary>
		<author><name>Koct9i</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Download/kernel/rhel6/042stab059.7&amp;diff=12851</id>
		<title>Download/kernel/rhel6/042stab059.7</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Download/kernel/rhel6/042stab059.7&amp;diff=12851"/>
		<updated>2012-09-03T13:24:37Z</updated>

		<summary type="html">&lt;p&gt;Koct9i: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Kernel branch rhel6|042stab059.7}}&lt;br /&gt;
== Known BUGS ==&lt;br /&gt;
* nscd eats 100% CPU {{B|2345}}&lt;br /&gt;
&lt;br /&gt;
{{Changelog}}&lt;br /&gt;
== RPMS ==&lt;br /&gt;
&lt;br /&gt;
{{Kernel flavors info rhel6}}&lt;br /&gt;
=== {{i686}} ===&lt;br /&gt;
&lt;br /&gt;
{{Download/Table head}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=vzkernel-2.6.32-042stab059.7.i686.rpm|size=25&amp;amp;nbsp;Mb|date=2012-07-26 19:00:49|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=vzkernel-devel-2.6.32-042stab059.7.i686.rpm|size=7&amp;amp;nbsp;Mb|date=2012-07-26 19:00:58|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=vzkernel-headers-2.6.32-042stab059.7.i686.rpm|size=2&amp;amp;nbsp;Mb|date=2012-07-26 19:00:59|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=vzkernel-firmware-2.6.32-042stab059.7.noarch.rpm|size=10&amp;amp;nbsp;Mb|date=2012-07-26 19:00:59|sig=}}&lt;br /&gt;
{{Download/Table tail}}&lt;br /&gt;
=== {{x86_64}} ===&lt;br /&gt;
&lt;br /&gt;
{{Download/Table head}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=vzkernel-2.6.32-042stab059.7.x86_64.rpm|size=27&amp;amp;nbsp;Mb|date=2012-07-26 19:00:53|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=vzkernel-devel-2.6.32-042stab059.7.x86_64.rpm|size=7&amp;amp;nbsp;Mb|date=2012-07-26 19:00:59|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=vzkernel-headers-2.6.32-042stab059.7.x86_64.rpm|size=2&amp;amp;nbsp;Mb|date=2012-07-26 19:01:00|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=vzkernel-firmware-2.6.32-042stab059.7.noarch.rpm|size=10&amp;amp;nbsp;Mb|date=2012-07-26 19:00:59|sig=}}&lt;br /&gt;
{{Download/Table tail}}&lt;br /&gt;
== Source RPM ==&lt;br /&gt;
&lt;br /&gt;
{{Download/Table head}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=vzkernel-2.6.32-042stab059.7.src.rpm|size=83&amp;amp;nbsp;Mb|date=2012-07-26 19:00:51|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7|file=kernel.spec|size=1&amp;amp;nbsp;Mb|date=2012-07-26 18:57:03|sig=}}&lt;br /&gt;
{{Download/Table tail}}&lt;br /&gt;
&lt;br /&gt;
{{Kernel patch for|2.6.32}}&lt;br /&gt;
&lt;br /&gt;
{{Download/Table head}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7/patches|file=patch-042stab059.7-combined.gz|size=34&amp;amp;nbsp;Mb|date=2012-07-26 18:59:42|sig=patch-042stab059.7-combined.gz.asc}}&lt;br /&gt;
{{Download/Table tail}}&lt;br /&gt;
== Configs ==&lt;br /&gt;
&lt;br /&gt;
Official configs of this OpenVZ kernel used to build binary RPMS.&lt;br /&gt;
&lt;br /&gt;
{{Download/Table head}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7/configs|file=config-2.6.32-042stab059.7.debug.i686|size=105&amp;amp;nbsp;Kb|date=2012-07-26 19:00:31|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7/configs|file=config-2.6.32-042stab059.7.debug.x86_64|size=100&amp;amp;nbsp;Kb|date=2012-07-26 19:00:39|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7/configs|file=config-2.6.32-042stab059.7.i686|size=104&amp;amp;nbsp;Kb|date=2012-07-26 19:00:13|sig=}}&lt;br /&gt;
{{Download/Table row|path=kernel/branches/rhel6-2.6.32/042stab059.7/configs|file=config-2.6.32-042stab059.7.x86_64|size=100&amp;amp;nbsp;Kb|date=2012-07-26 19:00:21|sig=}}&lt;br /&gt;
{{Download/Table tail}}&lt;br /&gt;
&lt;br /&gt;
{{Kernel archives|rhel6}}&lt;/div&gt;</summary>
		<author><name>Koct9i</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Template:B&amp;diff=8918</id>
		<title>Template:B</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Template:B&amp;diff=8918"/>
		<updated>2010-07-17T10:46:25Z</updated>

		<summary type="html">&lt;p&gt;Koct9i: Oh, wow...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[bugzilla:{{{1}}}|#{{{1}}}]]&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Used to insert a short bug link.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;{{B|123}}&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
will give you&lt;br /&gt;
{{B|123}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Template:Bug]]&lt;br /&gt;
&lt;br /&gt;
[[Category: Templates for download pages]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Koct9i</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Debian_versions&amp;diff=8323</id>
		<title>Debian versions</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Debian_versions&amp;diff=8323"/>
		<updated>2010-03-15T09:04:22Z</updated>

		<summary type="html">&lt;p&gt;Koct9i: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Debian people refer to versions of Debian distribution in a few ways: by nicknames, by numberic versions, and by statuses. The following table summarizes the relations between those referrals.&lt;br /&gt;
&lt;br /&gt;
Note that ''status'' is changing over time, e.g. &amp;quot;Squeeze&amp;quot; will become stable some time in future.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
! Name || Version || Status&lt;br /&gt;
|-&lt;br /&gt;
| Sid || n/a || unstable&lt;br /&gt;
|-&lt;br /&gt;
| Squeeze || 6.0 || testing&lt;br /&gt;
|-&lt;br /&gt;
| Lenny || 5.0 || stable&lt;br /&gt;
|-&lt;br /&gt;
| Etch || 4.0 || old stable&lt;br /&gt;
|-&lt;br /&gt;
| Sarge || 3.1 || old stable&lt;br /&gt;
|-&lt;br /&gt;
| Woody || 3.0 || old stable&lt;br /&gt;
|-&lt;br /&gt;
| Potato || 2.2 || old stable&lt;br /&gt;
|-&lt;br /&gt;
| Slink || 2.1 || old stable&lt;br /&gt;
|-&lt;br /&gt;
| Hamm || 2.0 || old stable&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* http://www.debian.org/releases/&lt;br /&gt;
&lt;br /&gt;
[[Category: Debian]]&lt;/div&gt;</summary>
		<author><name>Koct9i</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Install_kernel_from_RPM_on_Debian_6.0&amp;diff=8069</id>
		<title>Install kernel from RPM on Debian 6.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Install_kernel_from_RPM_on_Debian_6.0&amp;diff=8069"/>
		<updated>2010-01-14T14:01:34Z</updated>

		<summary type="html">&lt;p&gt;Koct9i: New page: =install=  apt-get install alien fakeroot  fakeroot alien -k kernel-2.6.27-chistyakov.1.x86_64.rpm  sudo dpkg -i kernel_2.6.27-chistyakov.1_amd64.deb  sudo update-initramfs -c -k 2.6.27-ch...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=install=&lt;br /&gt;
 apt-get install alien fakeroot&lt;br /&gt;
 fakeroot alien -k kernel-2.6.27-chistyakov.1.x86_64.rpm&lt;br /&gt;
 sudo dpkg -i kernel_2.6.27-chistyakov.1_amd64.deb&lt;br /&gt;
 sudo update-initramfs -c -k 2.6.27-chistyakov.1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
=uninstall=&lt;br /&gt;
 sudo dpkg -r kernel&lt;br /&gt;
 sudo rm -fr /lib/modules/2.6.27-chistyakov.1&lt;br /&gt;
 sudo update-initramfs -d -k 2.6.27-chistyakov.1&lt;br /&gt;
 sudo update-grub&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Debian]]&lt;br /&gt;
[[Category: Kernel]]&lt;br /&gt;
[[Category: Installation]]&lt;/div&gt;</summary>
		<author><name>Koct9i</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Ubuntu_Hardy_experimental&amp;diff=6456</id>
		<title>Ubuntu Hardy experimental</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Ubuntu_Hardy_experimental&amp;diff=6456"/>
		<updated>2008-09-18T15:39:30Z</updated>

		<summary type="html">&lt;p&gt;Koct9i: New page:  # echo &amp;quot;deb http://download.openvz.org/ubuntu hardy experimental&amp;quot; &amp;gt;&amp;gt; /etc/apt/sources.list.d/openvz.list  # wget http://openvz.org/download/RPM-GPG-Key-OpenVZ.txt -O - | apt-key add -  # ...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; # echo &amp;quot;deb http://download.openvz.org/ubuntu hardy experimental&amp;quot; &amp;gt;&amp;gt; /etc/apt/sources.list.d/openvz.list&lt;br /&gt;
 # wget http://openvz.org/download/RPM-GPG-Key-OpenVZ.txt -O - | apt-key add -&lt;br /&gt;
 # apt-get update&lt;br /&gt;
 # apt-cache search --names-only linux-image openvz&lt;/div&gt;</summary>
		<author><name>Koct9i</name></author>
		
	</entry>
</feed>