Difference between revisions of "Remote console setup"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Added some formatting to Netconsole)
(Fixed formatting and expanded Netconsole)
Line 9: Line 9:
 
== Netconsole ==
 
== Netconsole ==
  
This assumes you have not yet compiled netconsole as a module or into your kernel.
+
=== Kernel recompilation ===
 +
If you use binary kernel from openvz.org, it already has netconsole module compiled in, so just skip to next section.
  
Edit your kernel configuration file, in my case mine was located at /usr/src/openvz/linux-2.6.16
+
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 <tt>.config</tt> for NETCONSOLE:
edit .config with a text editor (nano .config)
+
<pre>
set netconsole to Y or M (depending on whether you want it as a module or built into the kernel, i installed it as a module)
+
# cd /usr/src/openvz/linux-2.6.16
 +
# grep NETCONSOLE .config
 +
</pre>
 +
 
 +
If you see nothing or "# CONFIG_NETCONSOLE is not set" you need to recompile the kernel.
 +
 
 +
Edit your kernel configuration file <tt>.config</tt> with a text editor (<tt>nano .config</tt> or <tt>vi .config</tt>). 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):
  
 
<pre>CONFIG_NETCONSOLE=m</pre>
 
<pre>CONFIG_NETCONSOLE=m</pre>
  
save then recompile the kernel.
+
Save the file, then recompile the kernel:
cd /usr/src/openvz/linux-2.6.16
+
 
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.
+
# 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.
 +
 
 +
Reboot into new kernel.
 +
 
 +
=== Setting up OpenVZ side ===
 +
 
 +
Next you want your netconsole to send the request to somewhere. Load netconsole module, specifying the remote server parameters:
 +
 
 +
<pre># modprobe netconsole netconsole=4444@10.0.2.1/eth0,6666@10.0.2.2/00:05:5D:34:11:AF</pre>
  
next you want your netconsole to send the request to somewhere.
+
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:
  
<pre>modprobe netconsole netconsole=4444@10.0.2.2/eth0,6666@10.0.2.1/00:05:5D:34:11:AF</pre>
+
<pre>
 +
# ping -c 1 10.0.2.2
 +
# /sbin/arp -i 10.0.2.2
 +
? (10.0.2.2) at 00:05:5D:34:11:AF [ether] on eth2
 +
</pre>
  
this will load the module in with your settings. replace your ip address with where 10.0.2.2 is, eth0 is your network interface card. 6666 is the remote netconsole port (UDP), and replace 10.0.2.1 with your remote netconsole server. also add in the mac address of your netconsole server, which in my case was 00:05:5D:34:11:AF.
+
=== Setting up remote side ===
  
then just setup netcat on your console server to listen on port 6666 UDP.
+
Setup netcat on your console server to listen on port 6666 UDP:
  
 
<pre>netcat -u -l -p6666</pre>
 
<pre>netcat -u -l -p6666</pre>
  
when your openvz kernel performs an OOPS, it will be captured on the netconsole server :)
+
When your kernel prints something on the console, the text will be also captured on this netconsole server.
 
 
enjoy.
 

Revision as of 08:27, 27 May 2006

In case you are experiencing a kernel crash (oops) and have already checked your hardware, you should report what kernel says to the console to Bugzilla. Sometimes kernel crashes so badly that syslogd is not working and what kernel says it never written to a file. If this is the case, you have to catch what kernel says. There are several ways possible.

Manual/Photo

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.

Serial console

FIXME

Netconsole

Kernel recompilation

If you use binary kernel from openvz.org, it already has netconsole module compiled in, so just skip to next section.

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 .config for NETCONSOLE:

# cd /usr/src/openvz/linux-2.6.16
# grep NETCONSOLE .config

If you see nothing or "# CONFIG_NETCONSOLE is not set" you need to recompile the kernel.

Edit your kernel configuration file .config with a text editor (nano .config or vi .config). 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):

CONFIG_NETCONSOLE=m

Save the file, then recompile the kernel:

# make bzImage && make modules && make modules_install

Update your bootloader for the new updated kernel. In my case I use LILO so I just type lilo at the prompt.

Reboot into new kernel.

Setting up OpenVZ side

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

This will load the module with your settings. Replace your local IP address with where 10.0.2.1 is, eth0 with your network interface card device, 6666 with the remote netconsole port (UDP), and 10.0.2.2 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:

# ping -c 1 10.0.2.2
# /sbin/arp -i 10.0.2.2
? (10.0.2.2) at 00:05:5D:34:11:AF [ether] on eth2

Setting up remote side

Setup netcat on your console server to listen on port 6666 UDP:

netcat -u -l -p6666

When your kernel prints something on the console, the text will be also captured on this netconsole server.