Showing posts from 2009

Compiling Linux 2.6 kernel from source

In my last post , we had seen how to upgrade the Linux kernel  using YUM . We had seen how cool it is to upgrade the kernel by executing only one step, if we use YUM . In this article , we will see how to upgrade the Linux kernel by compiling the kernel from source . As said earlier , upgrading the Linux Kernel by compiling from source is always a difficult task if we are doing for the first time . But if we follow the steps carefully and select the proper options , then we can successfully compile the kernel and it is always a geeky feeling after that . Lets now start with the task .

Before we start with the compilation ,we first need to download the source . Get the latest stable kernel source from As of writing , the latest stable kernel version is 

Compiling  Linux Kernel 2.6 

1.  sudo tar jxvf linux-  -C /usr/src/kernels/

Initially extract the kernel package under /usr/src/kernels/  directory .  This directory contains the various kernels  t…

How to update Linux kernel using YUM

Upgrading a kernel is always a difficult task . If anything goes wrong during the upgrade, the system may become unusable. If you are upgrading the kernel from source , then it needs lots of time and presence of mind while doing the upgrade .  But after yum has come into the picture of package management, upgrading a kernel has become quite easy and that's also in one step .

Using YUM to update the Linux kernel:

Upgrading the Linux kernel using yum is quite easy. yum is intelligent enough in not upgrading the current kernel. Yum installs a newer kernel without upgrading the existing kernel . So , if the new kernel fails to boot up , then you can still use your system by booting from your old kernel . During the upgrade , it also takes care to make entry of the new kernel in /boot/grub/grub.conf  without making any changes to the old entires . So , upgrade your kernel and test it out. Before going with the upgrade , keep a backup of your grub configuration file. The following are t…

YUM Tutorial : Package installer/remover for rpm systems

Evolution of YUM

yum is command line package management utility for Redhat like systems or more specifically Linux distributions which are based on RPM . Before RHEL 5 , rpm used to be package manager in Redhat like systems . But as Linux is becoming popular and more applications are coming in and also more and more people started using it , RPM started showing some limitations . One big issue is that RPM installation fails if the dependencies for a particular package are not installed on the system . Below is an example snippet of installing a package in Linux using RPM.

$ rpm -ivh Download/mplayer-1.0-71_snap20091017.fc11_92.i686.rpm
   warning: Download/mplayer-1.0-71_snap20091017.fc11_92.i686.rpm: Header  

   V4 DSA signature: NOKEY, key ID 66534c2b
    error: Failed dependencies: is needed by mplayer-4:1.0-71_snap20091017.fc11_92.i686 is needed by mplayer-4:1.0-71_snap20091017.fc11_92.i686

We can see that the package is dependent on some library …

Using find command in Linux/Unix

find is one of the unix power tools that searches for files within a directory hiererchy . It is a delight for Sys Admin and provides lots of options to refine our search.

Using find command :

Simple executing find in the current directory will give  a full listing of all files in the current directory and all subdirectories including hidden files:


The syntax of find is as follows

find   [path...]   [expression]

path:            the directory under which search is performed
expression:  expression is made of options , tests based on which find will perform its search operation. We can also perform some action based on the results of our search

Some of the useful options are:

-name:      To find based on file name
-perm:      To find based on file permission . We can also add [+|-] sign with -perm mode to refine our    search more . If the perm option is preceded by a `-(minus)` sign, then it searches for files wherein  atleast  all of the bits in the mode are set in the file's mo…

How to check whether a CPU is 64 bit or 32 bit in Unix

Determine whether a CPU has 64 bit capability or not .

We know about uname command . Using it ,we can get similiar information, but that information is for the running version of the kernel . We need to know the 64 bit capability of the CPU  . This can be determined by either reading the /proc/cpuinfo file or by using the dmidecode command. Let's see how we can use those commands .

Using /proc/cpuinfo

This virtual file gives information regarding the processors in computer . Among the information it provides are CPU vendor , speed and No of CPUs and many flags giving various features of the CPU.  Let's consider the following output of /proc/cpuinfo taken from my host.

zaman@personal-desk ~]$ cat /proc/cpuinfo 
processor: 0
vendor_id: GenuineIntel
cpu family: 6
model: 7
model name: Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
stepping: 6
cpu MHz: 2992.520
cache size: 6144 KB
physical id: 0
siblings: 2
core id: 0
cpu cores: 2
fdiv_bug: no
hlt_bug: no
f00f_bug: no
coma_bug: no
fpu: yes

Using lsof to identify deleted files:


Today's post is on another interesting problem which we had seen last week on our production servers . These servers are mainly responsible for reading data from some group of server hosts and transfers the same data to another batch of hosts. We are receiving disk space alerts for /home partition getting filled up for some of these servers.On checking these hosts ,we can see that df is reporting more than 90% utilisation for /home.We considered using du to identify which files and directories are consuming the space. And we are surprised with the results of du. du is only reporting around 40% disk utilisation for /home. So , is df is lying or du is lying . We will see in the next section , how we tracked the issue and was able to identify where the rest of disk space has gone.
The following are the disk usage results.

$ df -h /home/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sys-home 137G 117G 14G 90% /home
$ sudo du -sh /home/

Using Dmidecode : Getting BIOS information and other hardware information

Using Dmidecode

How to get the BIOS information . Earlier , myself and probably many people used to go BIOS to get the BIOS version and retrieving information regarding hardware :). What if the machine is a production host . We cannot shutdown the host to get the BIOS information . In such type of a situation, the dmidecode tool comes handy. It is a command line tool and can be freely used as it is released under General Public Licence (GPL).

About Dmidecode:

Dmidecode will report  information regarding your system's hardware as described in the system's BIOS . It will give information like your BIOS version, BIOS vendor , CPU information , System Board information and other hardware information. Please note that we cannot always reliably believe in the results of dmidecode as dmidecode does not scan your hardware and simply collects the information from the BIOS.

Using Dmidecode:

Like various other unix tools , dmidecode is also a command-line utility.It has few…

Using ipmitool: rc.shutdown: 30 second watchdog timeout expired. Shutdown terminated.


In this post , we will try to diagnose a production host which frequently goes to unresponsive/hung state . The host needs to be rebooted to get it back online. No information can be found in system logs regarding the sudden unresponsiveness, no trace of hacker attack can be seen. Hardware looks to be fine also. Finally, came across the ipmitool utility and Phew!, after so much of investigation, we finally were able to identify the root cause for this behaviour .

About IMPItool:

IPMItool is a command line utility for managing and configuring devices that supports  Intelligent Platform Management Interface (IPMI) . IPMI is an open standard for monitoring, logging, recovery, inventory, and control of hardware that is implemented independent of the main CPU, BIOS, and OS. The service processor (or Baseboard Management Controller, BMC) is the brain behind platform management and its primary purpose is to handle the autonomous sensor monitoring and event logging features.


Passphrase-less Authentication and using ssh-agent


Passphraseless Authentication is logging onto a remote system without supplying the passphrase or password.The disadvantage with password authentication is that if transmitted in plaintext, then there is  a possibility that is can  sniffed by someone over the network and read it since it is in plaintext , can be logged by keystroke logger , can be seen over the shoulders as you type and also susceptible to brute-force attacks . OpenSSH allows public key authentication as an alternative to password authentication.Public key Authentication uses a key-pair for authentication. The private key is stored securely on the local host while the public key is copied to the remote SSH server.We can use these keys for passphraseless authentication  either by using
1)  ssh-agent or
2)  protecting the private key with a blank password which is not recommened

Key Generation:

ssh-keygen is a utility that can be used to generate authentication keys. It can be used to create RSA keys for us…