Tuesday, September 8, 2009

Kernel Panic and system hang senarios

Kernel Panic and system hang senarios
=====================================

If you are using 64 bit AMD/Intel EM64T based kerne. Then, many servers have problem to boot 64bit SMP servers so boot into single UP mode server. Type following two parameters at Grub prompt

Code:

nosmp maxcpu=1

In addition, boot system into single UP mode then update your kernel and try it out again.


You need to enter nosmp and maxcpus parameter at Grub or Lilo boot prompt. For example if you are using Grub as a boot loader, at Grub prompt press 'e' to edit command before booting.

1) Select second line
2) Again, press 'e' to edit selected command
3) Go to end of line and type two parameters

nosmp maxcpu=1

4) Press enter twice and b to boot system
5) This will prevent the kernel panic and system hang scenario.

Once your system is up using single CPU then you can run diagnostic commands such as:

Get all boot message:

dmesg | less

Find out problem with PCI cards

lspci

Find out what device drivers loaded (if something is missing then your driver will not get loaded)

lsmod

Get memory info (is memory detected correctly?)

free
cat /proc/meminfo

Get CPU info (see if your CPU hit by any bug):

top
cat /proc/cpuinfo

Find out kernel version

uname -a

JAVA OUT OF MEMORY ERROR

:::JAVA OUT OF MEMORY ERROR::::
==========================================================================================



05:35:34,193 ERROR [[/embarqcc].[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.OutOfMemoryError


This issue seems not related to the OS and it related to setting up Java VM pool settings. In your JBoss file, you need to specify the Java VM memory allocation pool parameters as per your requirement. Please recheck them once.



Go to your JBOSS run.bat or run.sh file,

check for JAVA_OPTS, you find this


rem Sun JVM memory allocation pool parameters. Modify as appropriate.
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m

here Xms128m is the minimum java memory allocated and it go up to max 512m and you can increase this value if your hardware supports according to java specs

Install Mysql Server on Windows

Install Mysql Server on Windows:


when you receive following error while installing mysql on windows:

"Cannot Create Windows Service for MySQL. Error:0"

What you need to do is to open command line (Start -> Run -> cmd) and type the following:

sc delete mysql

You should receive a message like this:

[SC] DeleteService SUCCESS

Then uninstall MySQL completely using "Add or Remove Programs". After it has been uninstalled, install it again using installation wizard. When it ends, don't choose to configure MySQL right away, instead just uncheck the box and click OK.

Open command line (Start -> Run -> cmd) and type this:

C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt.exe --install MySQL50 --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\bin\my.ini"


Note: 'MySQL50' is the name of the MySQL service and it needs to be different than 'MySQL'.

Hit enter and restart your Mysql service by going to Admin tools --> services. MySQL should be running fine now.

To work mysql, go to cmd and type:

mysql -u root -p
password: just hit enter

To make mysql binary to your path do this,

Right click on My computer >> Properties >> Advanced >> Environment Variables >> click on path and edit >> add the path

C:\Program Files\MySQL\MySQL Server 5.0\bin

or

under system variables >> click on new

mysql
C:\Program Files\MySQL\MySQL Server 5.0\bin


click ok...

Installing Perl Modules using CPAN

There are several ways to get Perl modules from CPAN installed on your unix-based system. Keep in mind that there is always more than one way to do it with Perl, and this is no different. Before embarking upon any installation, it's a good idea to download the module, unzip it and check out the documentation. In general, though, most modules are installed in the same method.
The simplest way to get Perl modules installed is to use the CPAN module itself. If you are the system administrator and want to install the module system-wide, you'll need to switch to your root user. To fire up the CPAN module, just get to your command line and run this:

perl -MCPAN -e shell

If this is the first time you've run CPAN, it's going to ask you a series of questions - in most cases the default answer is fine. Once you find yourself staring at the cpan> command prompt, installing a module is as easy as install MODULE::NAME - for example, to install the HTML::Template module you'd type:

cpan> install HTML::Template

CPAN should take it from there and you'll wind up with the module installed into your Perl library.
Let's say you're on your system command line and you just want to install a module as quickly as possible - you can run the Perl CPAN module via command line perl and get it installed in a single line:

perl -MCPAN -e 'install HTML::Template'

As I mentioned earlier, it's always advisable to download a module yourself, especially if you're having problems installing with CPAN. If you're on the command line, you can use something like wget to grab the file. Next you'll want to unzip it with something like:

tar -zxvf HTML-Template-2.8.tar.gz

This will unzip the module into a directory, then you can move in and poke around - look for the README or INSTALL files. In most cases, installing a module by hand is still pretty easy, though (although not as easy as CPAN). Once you've switched into the base directory for the module, you should be able to get it installed by typing:

perl Makefile.PL
make
make test
make install

Installing a BASH shell on HP-UX - PA-RISC 11.23

Installing a BASH shell on HP-UX - PA-RISC 11.23

Please go to this site and download the BASH shell and it's dependencies,

http://hpux.cs.utah.edu/hppd/cgi-bin/search?package=on&description=on&term=bash&Search=Search
http://hpux.cs.utah.edu/hppd/cgi-bin/redirect?hpux/Shells/bash-3.2/bash-3.2-hppa-11.23.depot.gz

Depedencies,

libiconv:
http://hpux.cs.utah.edu/hppd/cgi-bin/redirect?hpux/Development/Libraries/libiconv-1.12/libiconv-1.12-hppa-11.23.depot.gz

gettext:
http://hpux.cs.utah.edu/hppd/cgi-bin/redirect?hpux/Gnu/gettext-0.17/gettext-0.17-hppa-11.23.depot.gz

termcap:
http://hpux.cs.utah.edu/hppd/cgi-bin/redirect?hpux/Development/Libraries/termcap-1.3.1/termcap-1.3.1-hppa-11.23.depot.gz

under /:

first install all dependencies,

gunzip libiconv-1.12-hppa-11.23.depot.gz
swinstall -s /libiconv-1.12-hppa-11.23.depot

In the window, select the package and then go to Actions --> Install. Do the same for all dependencies

Now, install bash

gunzip bash-3.2-hppa-11.23.depot.gz
swinstall -s /bash-3.2-hppa-11.23.depot


Once installed, appened to the path

find / -name bash

PATH=$PATH:/usr/local/bin
export PATH

that's all !!!!!!

How to install GRUB on MBR

To install GRUB on MBR :

(First of all, enter your BIOS setup and in BOOT Sequence window choose to boot with CDROM first.)

1) Boot with your Fedora Core Installation CD 1 (or your Redhat Distro).

2) Type "linux rescue" at the prompt.

3) Answer the questions about keyboard and language.

4) Tell the rescue mode to use your proper partition to mount (the one that you want to get booted into)

5) When you come to the console prompt type: chroot /mnt/sysimage

6) Type grub

7) Set the GRUB's root device to the partition containing the boot directory like this:

grub> root (hd0,0)

Filesystem type is ext2fs, partition type 0x83

I have Windows 98 in hd0,0 ; Windows XP in hd0,1, Fedora Core /boot partition in hd0,2 and Mandrake /boot partition in hd0,6. So in my case the command should be: > root (hd0,2)

If you are not sure which partition actually holds this directory, use the command 'find' like this:

grub> find /boot/grub/stage1

This will search for the file name '/boot/grub/stage1' and show the devices which contain the file.
Once you've set the root device correctly, run the command 'setup'.

8) Then, run the command setup

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists....... no
Checking if "/grub/stage1" exists....... yes
Checking if "/grub/stage2" exists....... yes
Checking if "/grub/e2fs_stage1_5" exists....... yes
Running "embed /grub/e2fs_stage1_5 (hd0)"....... 15 sectors are embedded
succeded
Running "install /grub/stage1 (hd0) (hd0) 1+15 p (hd0,2)/grub/stage2 /grub/grub.conf....... succeded
Done

This command will install GRUB boot loader on the Master Boot Record (MBR) of the first drive.

9) Type quit

grub> quit

GRUB is now in the MBR.

10) Finally, you'll have to edit your /boot/grub/grub.conf, for example whith nano:

> nano /boot/grub/grub.conf

(/etc/grub.conf or /boot/grub/grub.conf or /boot/grub/menu.lst, they are the same file) This file has the boot partitions of the disk/s.

11) Restart your PC without the Fedora Core CD 1 Installation. (or your Redhat Distro)
Reply With Quote

OR ALSO

you can also use this command

grub-install --recheck /dev/hda or /dev/sda.. it will correct the entries in grub.conf..

How to increase file descriptors max limit on Linux

How to increase file descriptors max limit on Linux
===================================================

How do I increase the maximum number of open files under CentOS Linux? How do I open more file descriptors under Linux?

ulimit command provides control over the resources available to the shell and to processes started by it, on systems that allow such control. The maximum number of open file descriptors displayed with following command (login as the root)

cat /proc/sys/fs/file-max

output: 101703

The number of maximum files was reached, how do I fix this problem?

Increase file descriptor limit under Linux to prevent java.net.SocketException: Too many open files

Many application such as Oracle database server needs this range quite higher. So you can increase the maximum number of open files by setting new value in kernel variable /proc/sys/fs/file-max as follows (login as the root):

sysctl -w fs.file-max=200000

Above command forces the limit to 200000 files. You need to edit /etc/sysctl.conf file and put following line so that after reboot the setting will remain as it is:

vi /etc/sysctl.conf

and Append a config directive as follows:

fs.file-max = 200000

Save and close the file. Users need to log out and log back in again to changes take effect or just type command:

sysctl -p ( sysctl -p /etc/sysctl.conf)

Verify your settings with command:

cat /proc/sys/fs/file-max

or

sysctl fs.file-max

View how many files are open. The number returned might defer as 1 file descriptor can have multiple open files attached to it.

lsof | wc -l

Increase the limit:

Edit /etc/security/limits.conf

username hard nofile 32768

Detailed:


Max Processes per user limit , check this ulimit -a ( check the value next to max user processes )

max user processes (-u) 7168

To increase this value, go in to /root/.bashrc and type

ulimit -u unlimited

ou must exit and re-login from your terminal for the change to take effect.

check again, ulimit -a

max user processes unlimited

The above procedure will apply for all users since you edited root's bashrc file. If you want limit for a single user, then go in users bashrc file and change the limit as you want

You may also do ulimit -u unlimited at the command prompt instead of adding it to the /root/.bashrc file


II) Increases the system limit on open files for instance a process. Means, a process on a system can open at least 10000 file descriptors.

To see the number of open files per process, ulimit -a

open files (-n) 1024

To apply, go to /root/.bashrc and type

ulimit -n 5120

check the limit, ulimit -a



first I add the line
fs.file-max = 65536
into /etc/sysctl.conf and I reload with sysctl -p
then I add into /etc/security/limits the lines
* soft nofile 1024
* hard nofile 65535

third I add in /etc/pam.d/login the line

session required /lib/security/pam_limits.so

fourth I do

echo 65535 > /proc/sys/fs/file-max