Thursday, January 21, 2010

Simulating a Linux Kernel panic

I was once asked a question "How can you simulate Kernel Panic" by someone. Not sure why you would want to do it, probably to test if your monitoring tools report things properly.
Anyways after LOT of googling around I found a link which suggested the way, here's how you can do it (as super user)

echo c > /proc/sysrq-trigger

As soon as you hit the above command, the machine freezes. To check if machine really froze because of a kernel panic check /var/log/messages

Jan 21 17:23:17 chrhel4 kernel: SysRq : Crashing the kernel by request
Jan 21 17:23:17 chrhel4 kernel: Unable to handle kernel NULL pointer dereference at virtual address 00000000
Jan 21 17:23:17 chrhel4 kernel: printing eip:
Jan 21 17:23:17 chrhel4 kernel: c0211ea4
Jan 21 17:23:17 chrhel4 kernel: *pde = 0a578001
Jan 21 17:23:17 chrhel4 kernel: Oops: 0002 [#1]
Jan 21 17:23:17 chrhel4 kernel: SMP
Jan 21 17:23:17 chrhel4 kernel: Modules linked in: parport_pc lp parport autofs4 i2c_dev i2c_core sunrpc cpufreq_powersave ib_srp ib_sdp ib_ipoib md5 ipv6 rdma_ ucm rdma_cm iw_cm ib_addr ib_umad ib_ucm ib_uverbs ib_cm ib_sa ib_mad ib_core dm _mirror dm_mod button battery ac uhci_hcd ehci_hcd snd_ens1371 snd_rawmidi snd_s eq_device snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc snd_ac97_co dec snd soundcore pcnet32 mii floppy ext3 jbd ata_piix libata mptscsih mptsas mp tspi mptscsi mptbase sd_mod scsi_mod
Jan 21 17:23:17 chrhel4 kernel: CPU: 0
Jan 21 17:23:17 chrhel4 kernel: EIP: 0060:[] Not tainted VLI
Jan 21 17:23:17 chrhel4 kernel: EFLAGS: 00010046 (2.6.9-78.ELsmp)
Jan 21 17:23:17 chrhel4 kernel: EIP is at sysrq_handle_crash+0x0/0x8
Jan 21 17:23:17 chrhel4 kernel: eax: 00000063 ebx: c034d754 ecx: 00000000 edx: 00000000
Jan 21 17:23:17 chrhel4 kernel: esi: 00000063 edi: 00000000 ebp: 00000000 esp: c99e2f5c
Jan 21 17:23:17 chrhel4 kernel: ds: 007b es: 007b ss: 0068
Jan 21 17:23:17 chrhel4 kernel: Process bash (pid: 11979, threadinfo=c99e2000 ta sk=dbf592f0)
Jan 21 17:23:17 chrhel4 kernel: Stack: c021203c c0301e91 c03032a2 00000246 00000 006 00000002 e6985880 00000002
Jan 21 17:23:17 chrhel4 kernel: c99e2fac c018e504 c033f4c0 c015c88f c99e2 fac b7ce8000 e6985880 fffffff7
Jan 21 17:23:17 chrhel4 kernel: b7ce8000 c99e2000 c015c959 c99e2fac 00000 000 00000000 00000000 00000001
Jan 21 17:23:17 chrhel4 kernel: Call Trace:
Jan 21 17:23:17 chrhel4 kernel: [] __handle_sysrq+0x62/0xd9
Jan 21 17:23:17 chrhel4 kernel: [] write_sysrq_trigger+0x23/0x29
Jan 21 17:23:17 chrhel4 kernel: [] vfs_write+0xb6/0xe2
Jan 21 17:23:17 chrhel4 kernel: [] sys_write+0x3c/0x62
Jan 21 17:23:17 chrhel4 kernel: [] syscall_call+0x7/0xb
Jan 21 17:23:17 chrhel4 kernel: Code: 11 c0 c7 05 10 6d 46 c0 00 00 00 00 c7 05 38 6d 46 c0 00 00 00 00 c7 05 2c 6d 46 c0 6e ad 87 4b 89 15 28 6d 46 c0 e9 a4 f9 f1 ff 05 00 00 00 00 00 c3 e9 a2 bc f4 ff e9 6b 07 f5 ff 85 d2 89
Jan 21 17:23:17 chrhel4 kernel: <0>Fatal exception: panic in 5 seconds

Labels: ,

Upgrading WebSphere 6.1.0.0

Upgrading WebSphere 6.1.0.0 to 6.1.0.29


I was trying to upgrade my WebSphere installation from 6.1.0.0 to the latest one (6.1.0.29 at the time of writing this article), however, updateInstaller just wont install the new .pak files.


The steps below is the right procedure

    1. Install WebSphere Application Server 6.1 GM

    2. Install Web Services Feature Pack GM (This will raise WebSphere Application Server level to 6.1.0.9 because Web Services Feature Pack installation requires WebSphere Application Server to be at minimum 6.1.0.9 level)

    3. Use Update Installer to install mandatory Interim Fix PK53084

    4. Use Update Installer to install WebSphere Application Server Fix Pack 6.1.0.13 & Web Services Feature Pack Fix Pack 6.1.0.13 together

    5. Install EJB 3.0 Feature Pack GM (This will also raise WebSphere Application Server level to 6.1.0.13 if still below that level; EJB 3.0 Feature Pack installation requires WebSphere Application Server to be minimum at 6.1.0.13 level)

    6. Use Update Installer to install WebSphere Application Server Fix Pack 6.1.0.29, Web Services Feature Pack Fix Pack 6.1.0.29 & EJB 3.0 Feature Pack Fix Pack 6.1.0.29 all together

Thursday, January 14, 2010

Moving a physical machine to qemu-kvm (work in progress)

The base OS on which qemu-kvm is used needs to have vmx or svm flag (CPU support for hardware virtualization). Without this feature kvm WON'T work.

cat /proc/cpuinfo | grep flags

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arc h_perfmon pebs bts pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm la hf_lm tpr_shadow vnmi flexpriority


An excellent article on setting up QEMU on Fedora is given here:




Steps to move from Hardware OS to QEMU-KVM based OS.

++ Create a image

qemu-img create rhel5.img -f qcow2 6G

++ Ensure nbd module is loaded.

modprobe nbd max_part=8

++ Connect to this image using nbd-client (using socket)

qemu-nbd --connect=/dev/nbd0 --socket=/var/lock/qemu-nbd0 /home/user/rhel5.img

++ Create partitions on /dev/nbd0 using fdisk

Say 2 partitions nbd0p1 (/boot) and nbd0p2 (/)

++ Mount the partitons so that data can be copied

mkdir nbd0p1
mkdir nbd0p2

mount /dev/nbd0p1 nbd0p1
mount /dev/nbd0p2 nbd0p2

++ Copy /boot

cd nbd0p1
ssh 'dump -0 -f - /boot' | restore -r -f -

++ Copy /

cd nbd0p2
ssh 'dump -0 -f - /' | restore -r -f -


The above two copies failed for me with weird error messages. I read somewhere that dump/restore tend to fail after 3GB of data transfer.

I need to figure out a way to copy the entire remote filesystem.

Labels: , ,