In India, thinking big by thinking small

International Herald Tribune has very nice story. The story is all about rural Indians. One in nine human beings is an Indian villager, and 70 percent of Indian villagers have no bank account, inhabiting a financial parallel universe in which savings are a gold necklace and loans come from pistol-packing moneylenders. Over 700 million people don’t have accounts or savings. This story covers how ICICI bank is going to change all this. Indeed very well written. But more important if we really wanna see growth of all of our Indians then we need to take approach like this one.
Full article here.

Mobile phone for less than $40 (INR. 1800)

Yup. The sub $40 mobile is here. Motorola, in a bid to tap into ultra low cost mobile handset segment in new markets like india, has introduced a phone in the sin-$40 category. Motorola announced C series phone at 3GSM Asia show in Singapore:

  • C118 – Bare bones, focused on battery life and basic functions like SMS
  • C139 – Adds more style with a color screen, increased battery life and enhanced usability
  • C168 – Builds on the feature set of the other two, and adds things like an FM radio
  • C257/261 – Ultra-thin design with a basic feature set similar to the above handsets

It befits both consumer as well as mobile operators as dropping handset prices has always led to an increased subscriber base. All these new phone will be available by April 2006 in India.

Update: Philips to make sub-Rs 1000 ($20) mobile :)

My favorite fruit juices

I like the following three juices very much :D

  • Apple Juice – Gives lots of energy and has tons of vitamin C. Good for my heart too
  • Pineapple Juice – Got digestion problem try out Pineapple juice. Not for people having sugar problem because it has high natural sugar that gives lots of energy
  • Mango Juice – Simply it is deliciosus
  • Pomegranate juice – Not so favorite but packed with vitamin A,C, and E. If you are health conscious then give it try

My Linux Teaching experience

No one is born knowing how to live. Knowledge comes with learning. I’m a teacher and as they said ‘No teacher is without fault’ and there is no such thing as a perfect guru.

Teaching Linux, I have come realise that people are receptive to criticism and advice much more than we believe them to be. As a teacher I need to guide student, and not to shout at him/her or call him/her an idiot when she makes a mistake. I have to always start where he/she is and work from that position. Only then I can create an urge in him to know more. Oh boy, when I see my students moving faster than me and masters the art, it gives me more happiness.

And that is why I share knowledge with others via this tiny site/forum. Freely sharing knowledge with others has two distinct advantages.

* By helping others to improve, I can contribute to the growth of Linux and to the growth of others.
* Shearing knowledge helps me too. To be frank it improves my own understanding as I attempt to teach others and always challenged by their questions.

I hope others can learn something from my experience and contribute back to Linux and your good teaching will helps others.

Exploring Linux Kernel

Your Linux kernel compiled and always installed in /boot directory:

To list of all installed kernel in your system, enter:
$ ls -l /boot/
Outputs:

-rw-r--r-- 1 root root   106172 Mar 23 03:07 config-2.6.32-5-amd64
-rw-r--r-- 1 root root   130657 Feb 11 15:14 config-3.2.0-0.bpo.1-amd64
drwxr-xr-x 3 root root     4096 Mar 28 19:21 grub
-rw-r--r-- 1 root root 10332764 Mar 28 19:21 initrd.img-2.6.32-5-amd64
-rw-r--r-- 1 root root 11650089 Feb 26 03:50 initrd.img-3.2.0-0.bpo.1-amd64
drwxr-xr-x 2 root root    12288 Jan 11 03:19 lost+found
-rw-r--r-- 1 root root   165084 Oct 21  2010 memtest86+.bin
-rw-r--r-- 1 root root   167264 Oct 21  2010 memtest86+_multiboot.bin
-rw-r--r-- 1 root root  1665393 Mar 23 03:07 System.map-2.6.32-5-amd64
-rw-r--r-- 1 root root  1992422 Feb 11 15:14 System.map-3.2.0-0.bpo.1-amd64
-rw-r--r-- 1 root root  2424256 Mar 23 02:58 vmlinuz-2.6.32-5-amd64
-rw-r--r-- 1 root root  2813456 Feb 11 15:11 vmlinuz-3.2.0-0.bpo.1-amd64

Where,

  • config-3.2.0-0.bpo.1-amd64 –> Kernel configuration file generated by make menuconfig/make xconfig/make gconfig.
  • System.map-3.2.0-0.bpo.1-amd64 –> This file has a map of positions of symbols in the kernel. Device driver such as USB pen uses hot plug, which depend upon symbols generated by depmod utility.
  • vmlinuz-3.2.0-0.bpo.1-amd64 — > Your kernel file.
  • initrd.img-3.2.0-0.bpo.1-amd64 –> Contains device drivers which are required to boot and load rest of operating system from disk. Usually SCSI,IDE, software RAID drivers are stored in this file.
  • grub –> It is a directory, which stores grub Boot loader configuration file.

You may also find the following files:

  • config –> Soft link to current kernel configuration file
  • vmlinuz -> Soft link to current running kernel file
  • System.map –> Soft link to current running kernel system map file

Please note that 3.2.0-0.bpo.1-amd64 is kernel version.

Task: Find out version of running Linux kernel

Use any one of the following command:
uname -r
OR
cat /proc/version
Outputs:

Linux version 3.2.0-0.bpo.1-amd64 (Debian 3.2.4-1~bpo60+1) ([email protected]) (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 SMP Sat Feb 11 08:41:32 UTC 2012

Task: Find out where running kernel modules (device drivers) are stored

Use any one of the following command:
ls -l /lib/modules/$(uname -r)
OR
ls -d /lib/modules/$(uname -r)
For 64 bit system, use /lib64 directory:
ls -l /lib64/modules/$(uname -r)
Outputs:

total 2864
lrwxrwxrwx  1 root root     42 Feb 26 03:50 build -> /usr/src/linux-headers-3.2.0-0.bpo.1-amd64
drwxr-xr-x 10 root root   4096 Feb 26 03:49 kernel
-rw-r--r--  1 root root 671461 Feb 26 03:54 modules.alias
-rw-r--r--  1 root root 656721 Feb 26 03:54 modules.alias.bin
-rw-r--r--  1 root root   2732 Feb 11 15:11 modules.builtin
-rw-r--r--  1 root root   3701 Feb 26 03:54 modules.builtin.bin
-rw-r--r--  1 root root 328629 Feb 26 03:54 modules.dep
-rw-r--r--  1 root root 454611 Feb 26 03:54 modules.dep.bin
-rw-r--r--  1 root root    325 Feb 26 03:54 modules.devname
-rw-r--r--  1 root root 108688 Feb 11 15:11 modules.order
-rw-r--r--  1 root root    131 Feb 26 03:54 modules.softdep
-rw-r--r--  1 root root 286127 Feb 26 03:54 modules.symbols
-rw-r--r--  1 root root 362552 Feb 26 03:54 modules.symbols.bin
lrwxrwxrwx  1 root root     43 Feb 26 03:50 source -> /usr/src/linux-headers-3.2.0-0.bpo.1-common
drwxr-xr-x  3 root root   4096 Feb 26 03:50 updates

How do I load kernel modules at boot time?

/etc/modules file contain the names of kernel modules that are to be loaded at boot time, one per line. Lines beginning with “#” are ignored.Parameters can be specified after the module name
$ cat /etc/modules
Sample outputs:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

firewire-sbp2
loop

However, modern Linux distribution uses the following location or configuration directory/file for modprobe kernel device driver:

  • /etc/modprobe.conf file
  • /etc/modprobe.d/ directory

How do I install latest kernel version?

Find out if latest version available or not via following command:
apt-cache search kernel-image| grep VERSION
An example to see if 2.6.xx.xx series new kernel available or not (Debian Linux):
apt-cache search kernel-image| grep 2.6
Compare version with existing running kernel if it is greater than running kernel, run following command to install new kernel (run it as a root user and assuming that 2.6.12.1 is latest the kernel available):
apt-get install linux-image-2.6.12-1-386

Difference between Monolithic and Modular kernel:

Monolithic kernel

  • Single binary file [ directory ls -d /lib/modules/$(uname -r) does NOT exists ]
  • All drivers included in kernel itself

Modular kernel

  • Multiple files for kernel
  • Drivers can be loaded or unloaded into kernel using modprob command, see man page of
    lsmod, modprob etc [directory ls -d /lib/modules/$(uname -r) exists to store drivers]
  • Almost all drivers are build and linked against kernel

How do I build modular kernel?

You can built modular kernel by setting option in kernel configuration option:
Enable loadable module support (CONFIG_MODULES) [Y/n/?]
If you set above option to Y then kernel becomes modular and three possibilities occurs for each and every feature/driver:

  1. m – you can compile driver as module
  2. y – built into kernel itself
  3. n – Don’t include feature/driver

Type the command make menuconfig:
make menuconfig
1) Select Loadable module support and press enter/return key:


Loadable module support
Loadable module support

2) Select Enable Loadable module support option and other options, see following figure:


Loadable module support
Enable Loadable module support

For more information see the followin links:
* Compiling Linux kernel 2.6
* Text books :

This book covers Memory management including file buffering, process swapping, and Direct memory Access (DMA), The Virtual Filesystem and the Second Extended Filesystem, Process creation and scheduling, Signals, interrupts, and the essential interfaces to device drivers, Timing, Interprocess Communication (IPC), Program execution etc. A must read to master kernel concepts
If you wants starting hacking kernel then this perfect book for you. This book can be also use with your CS (college course) to get more indepth information on operating systems – it helps gain a better idea of kernel conepts. Try following book:

How Do I Restart MySQL Server?

Each distribution comes with a shell script (read as service) to restart / stop / start MySQL server. First login as root user and open shell prompt (command prompt).

First login as root user. Now type the following command as per your Linux distro:

A) If you are using mysql on RedHat Linux (Fedora Core/Cent OS) then use following command:

* To start mysql server:

/etc/init.d/mysqld start

* To stop mysql server:

/etc/init.d/mysqld stop

* To restart mysql server

 /etc/init.d/mysqld restart

Tip: Redhat Linux also supports service command, which can be use to start, restart, stop any service:

# service mysqld start
# service mysqld stop
# service mysqld restart

(B) If you are using mysql on Debian / Ubuntu Linux then use following command:

* To start mysql server:

/etc/init.d/mysql start

* To stop mysql server:

/etc/init.d/mysql stop

* To restart mysql server

/etc/init.d/mysql restart

More MySQL articles are here and here.

Squid proxy license

Squid is an open source proxy server. It is full-featured Web proxy cache, designed to run on Unix (linux/BSD/Solaris etc) systems, free and open-source software.
As Linux admin most of the time people ask me about Squid proxy license. Squid is copyrighted by the University of California San Diego. Squid is licensed under the terms of the GNU General Public License.

For more inforamation please visit:
GNU General Public License and GNU project.
Offical squid website

How Do I Remotely Reboot Linux System?

A remote Linux / UNIX server can be rebooted using following methods:

A) Login to remote server using ssh as root user and use any one of the following syntax:

ssh root@remote-server-ip

OR

ssh root@remote-server-name

When prompted for password please supply remote server root password.

B) Type reboot command as follows:

reboot

You can also save time using the following reboot command over ssh session:
ssh [email protected] reboot
ssh [email protected] reboot