Pages

Unixbhaskar's Blog

Wednesday, February 17, 2010

Compiling custom kernel for different GNU/Linux distributions

Compiling kernel is not for the faint heart's toy. One have to be ready for the pitfall they face when things are not working as they expected from a preconceived notion in their mind.

But having said that I am not trying you to get scared of it or keep you away from to get the best out of your own GNU/Linux distro as per your liking.

In this article I will step you through the process that how can build your own kernel step by step and installed it ..later use it .

I do not issue any guarantee that this will work for you.

I have pick up three distribution for this purpose; the peoples choice comes first as Ubuntu. Then a bit mid way distribution for geek and normal people ;called openSUSE. And finally the my favorite and source based one called Gentoo.

Now a very important point :why would anyone want to compile a kernel??(I have had the experience to hear from newbie administrator and GNU/Linux enthusitst that they want to compile the kernel; because they want to show the world that they know GNU/Linux more then anybody else) ,which is an absolute bogus and rubbish idea ...only expect from those who jump from different stream or just want to be highlighted by saying " I am a Linux guy".

Compiling kernel should be necessary if and only if the below thing one wants:

  • The stock kernel doesn't provide the feature that they want.
  • You should know what you are trying to do with the kernel.
  • If you are an avid kernel developer looking inside the kernel offering.
  • If you want fix some kernel related problem by enabling a debug feature in the kernel.
  • Some specific hardware feature want to activate so the underlying hardware react properly.
  • you should have the capability or knowledge iff something goes wrong after compilation of the kernel can bring back the system in previous pristine mode to function it properly.

Compiling kernel in Ubuntu way( Intrepid, Jaunty, and Karmic)
:

Step 1:

Get the kernel source from the www.kernel.org .Whatever the version you want to compile;stable version would be a better choice.

Step 2:
open a terminal and fire the below command

sudo apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package

Step 3:

The linux-kernel-devel does not exists in intrepid,jaunty and newer version.For that reason to compile the kernel also need to run:

sudo apt-get build-dep linux

Step 4:

You might get the kernel source in ubuntu way like this:( for Hardy,intrepid Ibex,Jaunty)
sudo apt-get build-dep --no-install-recommends --only-source linux

For Kermic Koala:

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
apt-get source linux-image-$(uname -r)

Step 5:

Now you have to modify the source config file of the downloaded kernel..so lets find the that file
Ubuntu store this file /debian/config/ARCH or for newer release it is in debian.master/config/ARCH
You can get a snapshot of that particular dir like this

ls -l debian/config/i386/

total 108
-rw-r--r-- 1 root src 73962 2007-08-13 01:29 config
-rw-r--r-- 1 root root 1369 2007-08-13 01:29 config.386
-rw-r--r-- 1 root root 1330 2007-08-13 01:29 config.generic
-rw-r--r-- 1 root root 1395 2007-08-13 01:29 config.server
-rw-r--r-- 1 root root 1756 2007-08-13 01:29 config.server-bigiron
-rw-r--r-- 1 root root 8 2007-08-13 01:25 lowlatency
-rw-r--r-- 1 root root 194 2007-08-13 01:25 vars.386

If you don't find the file then search in /boot section of tree.


Step 6:

Now change the config file according to your choice ...once done then please do the following
debian/rules updateconfigs

yes that is a command you have to fire once you are done with the config file.That command reside in debian/scripts/misc


Step 7:

Now you have run the below command in the source dir of the downloaded kernel:
You have to take the current configuration file as the basis of the new one. So doing so..

cp /boot/config-`uname -r` ./.config


Step 8:


make menuconfig

It will open up an tui window full of options to choose from.Once you finish the your selective session with that

dialog window( you have manuvaour to with TAB key to move and spacebar to select).
Then go to bottom of that window and select " Load an alternate configuration file" opention and enter
Then press "ok" to save the config file.

Step 9:

Once done the previous steps ..so you have your own custom config file for the kernel. Now time to build the kernel
Do it in the terminal:

$ make-kpkg clean


$ fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers


Now here you need bit of explanation of the "--append-to-version" thing..which can be selected from the

previous step when the window came select it from "general section" (top of the window option) and
it should start with a "-" minus signto separate form the kernel version number.
Now please help yourself to get a cup of coffee and relax..it will take some to compile the kernel to build .deb file for your system.

Step 10:

After the sucessfull build you can find the .deb file in /usr/src
there should be two file ;one for linux-image and another for linux-header..install both of them
dpkg -i linux-image-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb
dpkg -i linux-headers-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb

Step 11:

You have to put an entry in the grub(the bootloader) conf file to get it booted.
You can find more detailed description of it here : http://howtoforge.com/kernel_compilation_ubuntu_p2 and here: https://help.ubuntu.com/community/Kernel/Compile

Compiling the kernel openSUSE way:


Step 1:

Get the kernel source from the www.kernel.org ; whatever the version you want to compile;stable version would be a better choice.

Step 2:

Now get the required package for kernel build
yast -i ncurses-devel
This package will help to get the "make menuconfig" dialog to appear in terminal.

Step 3:

Now you need to get some backup and modify the few tool to get kernel compile properly.Otherwise it
won't allow us to install the kernel rpm in the system.
cp /usr/lib/rpm/find-provides.ksyms /usr/lib/rpm/find-provides.ksyms_orig
cp /usr/lib/rpm/find-requires.ksyms /usr/lib/rpm/find-requires.ksyms_orig
cp /usr/lib/rpm/find-supplements.ksyms /usr/lib/rpm/find-supplements.ksyms_orig
Then we open each of these scripts and replace kernel-*) is_kernel_package=1 ;; with kernel*) is_kernel_package=1 ;;:

Step 4:

Now go to the kernel source dir(where you unpack the kernel source tree) make a symlink to the "linux"
dir with the unpacked kernel source tree.
ln -s linux-2.6.18.2 linux

Step 5:

make mrproper
cp /boot/config-`uname -r` ./.config

step 6:

make menuconfig

Step 7:

Select "Load an alternate configuration file" and save by pressing ok.

Step 8:

It is important to have different version for your custom kernel ..for that you need to the "general setup" option of and select the second entry started as default.
You must start with a "-" with your choice of name and save it when promted.

Step 9:

Now build the rpm for the system:
make rpm
Please be patience ..it will take some time to compile the rpm( mostly about the choice you made)

Step 10:

You can view the source rpms here :
ls -la /usr/src/packages/SRPMS/

Step 11:

For the actual kernel rpm look in here:
ls -al /usr/src/packages/RPMS/i386

Step 12:

Get into the above dir and install the kernel;
rpm -ivh new-customized-kernel.rpm

Step 13:

Now create the initrd image to boot the system for the new kernel. For that
mkinitrd

Step 14:

Now configure the boot loader grub to boot new kernel.
For that edit the /boot/grub/menu.lst and put a stanza like below;
title new-customized-kernel
root (hd0,0) ----> depend where you load the boot loader
kernel path_to_the_kernel_img_file(usually /boot/
initrd path_to_the_initrd_img_file (usually in /boot
Save it and reboot and enjoy the new kernel.

Compiling the kernel in Gentoo way:


Step 1:

You can get he kernel source two ways in Gentoo. First as normal to get the .bzip from the kernel.org
Second is the gentoo way
sudo emerge -av gentoo-sources

Step 2:

Go to the /usr/src/ dir ,where the new kernel reside and make a link to the linux dir with the new
kernel unpacked dir.
ln -s linux-new-source linux

Step 3:

Then as usual
make menuconfig
select the options you need.You can stright way copy the .config file from the previous kernel source tree to the new one.
cp -v old-kernel-dir/.config new-kernel-dir/

Step -4:

You can compile kernel in two different way in Gentoo.
First is the tradition way and elaborate way ;like in above menthod (make menuconfig;make;make module_install, make install) or
Gentoo provide an easy way to hide the scrolling kernle compilation msg on the screen by using a tool called "genkernel",which essentially does the same thing.
For using the genkernel method ..you need to install it first like this:
sudo emerge -av genkernel
once install ... you are ready to use it.

Step 5:

Go to the specified kernel source dir and fire:
genkernel # without any argument
or
genkernel --save-config --install all

Now a bot of explanation of second command: the option "--save-config" saves a kenerl config file in

/etc/kenerl/kernel-version.config ,which you can use later and view.
Next option "--install" instruct the genkernel to install the kernel in the system .
Then option "all"...which define all the steps require to compile the kernel i.e make ,make module_install
make bzImage install make initrd or ramfs images
All will be done in the backgroud..no scrolling out put on the terminal.If you are really curious about the ongoing thing
You can have a look at the /var/log/genkernel.log file for the compilation process.
It will create less noise but it will take long .

Hope this guide will help.


Saturday, February 6, 2010

Installing Nagios made easy

Installing nagios by hand is good but not recommended.Instead use a small script to do the job for you...because being an system admin you have lot of thing to take care...so the time will be crucial factor. But having said I have had no intention to make it a point that you automate whatever you want. Sometime the automation has the adverse effect on system.You do automation when it must require and need.

I do not issue any guarantee that this will work for you.

So the script for installing Nagios and it's plugins from source is below...u can also enhance it if you want...

#!/bin/bash
# This script will install Nagios from source along with the plugins.
dir=/usr/local/nagios
wget -c http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.6.tar.gz
wget -c http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
mkdir -p $dir
grep -i “red hat” /etc/issue>/dev/null2>&1
if [ `echo $? ` = 0 ];then
useradd nagios
else
groupadd nagios
useradd -G nagios nagios
fi
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure –prefix=/usr/local/nagios –enable-redhat-pthread-workaround
make
make install
cd ..
tar xzf nagios-3.0.6.tar.gz
cd nagios-3.0.6
./configure –prefix=/usr/local/nagios
make install
make install-init
make install-config
make install-commandmode
make install-webconf
# make sure xinetd is installed.
echo ” nrpe 5666/tcp #nrpe” >> /etc/services
chown -R nagios.nagios /usr/local/nagios
service xinetd [...]

But one word caution for heaven's sake please investigate manually or put some mechanism within the script to check that everything done as required.

Hope this will help.

Bhaskar Chowdhury
Google Talk: unixbhaskar Skype: unixbhaskar Y! messenger: unixbhaskar
DiggLinkedinWordpressTwitterTechnoratiStumbleuponReddit

Cleanup Firefox clogging by pruning it's database

I have been running firefox for quite sometime now. And sometime it come down to it's knees to make me frustrated . Yes I must confess that I have had a fatty extensions build into it...but still the performance sometime really down.

So I started to investigate what is the actual cause( might be one of the cause to it) . And after some search in the ocean of internet I found a better solution.

I do not issue any guarantee that this will work for you.

It is all about pruning the firefox own database,which is an sqlite one. Because due to huge bookmarks and thousand of page visits everyday make it cache lot of thing in it's database. So it's really important to once in every second day to get it pruned .

I wrote a small and very trivial script(got the inspiration from Mozillazine web site and their developers) to run it in specified time, either by hand or by cron.

Here is the script....one has to change the path of thir own profile, nothing else has to be done.I gave it a name: ff_databse_cleanup..you can give anything you want :)

1 #!/bin/bash
2 profile_dir="/home/bhaskar/.mozilla/firefox/2zbbd86m.default"
3
4 echo " Killing all running swiftfox instances for database clean up..."
5
6 pkill swiftfox-bin
7
8 echo " ... Done"
9
10 echo " getting into the profile dir ..."
11
12 cd $profile_dir
13
14 pwd
15
16 echo " present size of the database is : "
17
18 du -shc $profile_dir/*.sqlite
19
20 echo " Now running the cleanup...."
21
22 find $profile_dir/ \( -name "*.sqlite" \) -exec sqlite3 {} "vacuum" \;
23
24 echo " Now the size of trimed database is :"
25
26 du -shc $profile_dir/*.sqlite
27
28 echo " Kindly start firefox/swiftfox now .....performance will be much improved"

Now a bit of explanation of the script : what it does basically get into you profile dir i.e where firefox keeps it's profile and run a sqlite3 vaccum command to prune the internal database.

If firefox is running it will kill all instances of it then acting upon it.I have had got significant improvement running this script every second or third day to make my browser up on it's toes.

Hope this will help .

Bhaskar Chowdhury
Google Talk: unixbhaskar Skype: unixbhaskar Y! messenger: unixbhaskar
DiggLinkedinWordpressTwitterTechnoratiStumbleuponReddit

Monday, February 1, 2010

Enlisting kernel modules by Name,Description and Depends

I was wondering how to get a glimpse of all kernel module at once with specific information I need.

I do not issue any guarantee that this will work for you.

I know how to use modinfo ,so thought to implement within a small AWK script which will fetch me the required info.

So just wrote a one liner for that like this:

awk '{print $1}' "/proc/modules" | xargs modinfo | awk '/^(filename|desc|depends)/'

That's all I have done.I put it in a file and give it a execution permission.Once you run it you get the info like below,which is very useful:

bhaskar@Bhaskar-laptop_10:02:34_Mon Feb 01:~/bin> sudo list_module
filename: /lib/modules/2.6.31.8-0.1-default/kernel/fs/ext4/ext4.ko
description: Fourth Extended Filesystem
depends: jbd2,crc16
filename: /lib/modules/2.6.31.8-0.1-default/kernel/fs/jbd2/jbd2.ko
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/lib/crc16.ko
description: CRC16 calculations
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/net/ppp_deflate.ko
depends: zlib_deflate,ppp_generic
filename: /lib/modules/2.6.31.8-0.1-default/kernel/lib/zlib_deflate/zlib_deflate.ko
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/net/bsd_comp.ko
depends: ppp_generic
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/net/ppp_async.ko
depends: ppp_generic,crc-ccitt
filename: /lib/modules/2.6.31.8-0.1-default/kernel/lib/crc-ccitt.ko
description: CRC-CCITT calculations
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/net/ppp_generic.ko
depends: slhc
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/net/slhc.ko
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/usb/serial/usbserial.ko
description: USB Serial Driver core
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/packet/af_packet.ko
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/bluetooth/rfcomm/rfcomm.ko
description: Bluetooth RFCOMM ver 1.11
depends: bluetooth,l2cap
filename: /lib/modules/2.6.31.8-0.1-default/updates/vboxnetadp.ko
description: VirtualBox Network Adapter Driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/updates/vboxnetflt.ko
description: VirtualBox Network Filter Driver
depends: vboxdrv
filename: /lib/modules/2.6.31.8-0.1-default/updates/vboxdrv.ko
description: VirtualBox Support Driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/gpu/drm/i915/i915.ko
description: Intel Graphics
depends: drm,i2c-core,video,i2c-algo-bit
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/gpu/drm/drm.ko
description: DRM shared core routines
depends: i2c-core
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/i2c/algos/i2c-algo-bit.ko
description: I2C-Bus bit-banging algorithm
depends: i2c-core
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/bluetooth/sco.ko
description: Bluetooth SCO ver 0.6
depends: bluetooth
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/bridge/bridge.ko
depends: stp,llc
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/802/stp.ko
depends: llc
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/llc/llc.ko
description: LLC IEEE 802.2 core support
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/bluetooth/bnep/bnep.ko
description: Bluetooth BNEP ver 1.3
depends: bluetooth,l2cap
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/core/oss/snd-pcm-oss.ko
description: PCM OSS emulation for ALSA.
depends: snd-pcm,snd,snd-mixer-oss
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/core/oss/snd-mixer-oss.ko
description: Mixer OSS emulation for ALSA.
depends: snd
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/core/seq/snd-seq.ko
description: Advanced Linux Sound Architecture sequencer.
depends: snd,snd-seq-device,snd-timer
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/bluetooth/l2cap.ko
description: Bluetooth L2CAP ver 2.13
depends: bluetooth
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/core/seq/snd-seq-device.ko
description: ALSA sequencer device management
depends: snd
filename: /lib/modules/2.6.31.8-0.1-default/kernel/fs/binfmt_misc.ko
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/ipv6/ipv6.ko
description: IPv6 protocol stack for Linux
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/cpufreq/cpufreq_conservative.ko
description: 'cpufreq_conservative' - A dynamic cpufreq governor for Low Latency Frequency Transition capable processors optimised for use in a battery environment
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/cpufreq/cpufreq_userspace.ko
description: CPUfreq policy governor 'userspace'
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/cpufreq/cpufreq_powersave.ko
description: CPUfreq policy governor 'powersave'
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko
description: ACPI Processor P-States Driver
depends: processor
filename: /lib/modules/2.6.31.8-0.1-default/kernel/arch/x86/kernel/cpu/cpufreq/speedstep-lib.ko
description: Library for Intel SpeedStep 1 or 2 cpufreq drivers.
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/fs/fuse/fuse.ko
description: Filesystem in Userspace
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/block/loop.ko
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/md/dm-mod.ko
description: device-mapper driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/crypto/arc4.ko
description: ARC4 Cipher Algorithm
depends: crypto_algapi
filename: /lib/modules/2.6.31.8-0.1-default/kernel/crypto/ecb.ko
description: ECB block cipher algorithm
depends: crypto_algapi,crypto_blkcipher
filename: /lib/modules/2.6.31.8-0.1-default/kernel/crypto/cryptomgr.ko
description: Crypto Algorithm Manager
depends: crypto_hash,crypto_algapi,crypto_blkcipher,aead,pcompress
filename: /lib/modules/2.6.31.8-0.1-default/kernel/crypto/aead.ko
description: Authenticated Encryption with Associated Data (AEAD)
depends: crypto_algapi
filename: /lib/modules/2.6.31.8-0.1-default/kernel/crypto/pcompress.ko
description: Partial (de)compression type
depends: crypto_algapi
filename: /lib/modules/2.6.31.8-0.1-default/kernel/crypto/crypto_blkcipher.ko
description: Generic block chaining cipher type
depends: crypto_algapi
filename: /lib/modules/2.6.31.8-0.1-default/kernel/crypto/crypto_hash.ko
description: Generic cryptographic hash type
description: Asynchronous cryptographic hash type
description: Synchronous cryptographic hash type
depends: crypto_algapi
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/pci/hda/snd-hda-codec-analog.ko
description: Analog Devices HD-audio codec
depends: snd-hda-codec,snd
filename: /lib/modules/2.6.31.8-0.1-default/kernel/crypto/crypto_algapi.ko
description: Cryptographic algorithms API
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/net/wireless/b43/b43.ko
description: Broadcom B43 wireless driver
depends: pcmcia,mac80211,ssb,led-class,cfg80211,pcmcia_core
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/mac80211/mac80211.ko
description: IEEE 802.11 subsystem
depends: cfg80211
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/media/video/uvc/uvcvideo.ko
description: USB Video Class driver
depends: videodev,v4l1-compat
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/wireless/cfg80211.ko
description: wireless configuration support
depends: rfkill
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/leds/led-class.ko
description: LED Class Interface
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/media/video/videodev.ko
description: Device registrar for Video4Linux drivers v2
depends: i2c-core,v4l1-compat
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/media/video/v4l1-compat.ko
description: v4l(1) compatibility layer for v4l2 drivers.
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/pci/hda/snd-hda-intel.ko
description: Intel HDA driver
depends: snd-pcm,snd,snd-page-alloc,snd-hda-codec
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/scsi/sr_mod.ko
description: SCSI cdrom (sr) driver
depends: cdrom
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/pci/hda/snd-hda-codec.ko
description: HDA codec core
depends: snd-pcm,snd,snd-hwdep
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/scsi/sg.ko
description: SCSI generic (sg) driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/core/snd-hwdep.ko
description: Hardware dependent layer
depends: snd
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/core/snd-pcm.ko
description: Midlevel PCM code for ALSA.
depends: snd,snd-page-alloc,snd-timer
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/core/snd-timer.ko
description: ALSA timer interface
depends: snd
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/core/snd.ko
description: Advanced Linux Sound Architecture driver for soundcards.
description: Jack detection support for ALSA
depends: soundcore
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/soundcore.ko
description: Core sound module
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/cdrom/cdrom.ko
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/i2c/i2c-core.ko
description: I2C-Bus main module
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/input/joydev.ko
description: Joystick device interfaces
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/ssb/ssb.ko
description: Sonics Silicon Backplane driver
depends: pcmcia_core,pcmcia
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/pcmcia/pcmcia.ko
description: PCMCIA Driver Services
depends: pcmcia_core
filename: /lib/modules/2.6.31.8-0.1-default/kernel/sound/core/snd-page-alloc.ko
description: Memory allocator for ALSA system.
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/watchdog/iTCO_wdt.ko
description: Intel TCO WatchDog Timer Driver
depends: iTCO_vendor_support
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/watchdog/iTCO_vendor_support.ko
description: Intel TCO Vendor Specific WatchDog Timer Driver Support
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/input/serio/serio_raw.ko
description: Raw serio driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/input/misc/pcspkr.ko
description: PC Speaker beeper driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/acpi/container.ko
description: ACPI container driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/acpi/video.ko
description: ACPI Video Driver
depends: thermal_sys,output
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/net/tg3.ko
description: Broadcom Tigon3 ethernet driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/bluetooth/btusb.ko
description: Generic Bluetooth USB driver ver 0.5
depends: bluetooth
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/pcmcia/pcmcia_core.ko
description: Linux Kernel Card Services
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/bluetooth/bluetooth.ko
description: Bluetooth Core ver 2.15
depends: rfkill
filename: /lib/modules/2.6.31.8-0.1-default/kernel/net/rfkill/rfkill.ko
description: RF switch support
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/video/output.ko
description: Display Output Switcher Lowlevel Control Abstraction
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/acpi/ac.ko
description: ACPI AC Adapter Driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/char/agp/intel-agp.ko
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/acpi/battery.ko
description: ACPI Battery Driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/platform/x86/wmi.ko
description: ACPI-WMI Mapping Driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/acpi/button.ko
description: ACPI Button Driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/ata/ata_generic.ko
description: low-level driver for generic ATA
depends: libata
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/usb/host/uhci-hcd.ko
description: USB Universal Host Controller Interface driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/rtc/rtc-cmos.ko
description: Driver for PC-style 'CMOS' RTCs
depends: rtc-core
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/rtc/rtc-core.ko
description: RTC class support
depends: rtc-lib
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/rtc/rtc-lib.ko
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/ata/ata_piix.ko
description: SCSI low-level driver for Intel PIIX/ICH ATA controllers
depends: libata
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/usb/host/ehci-hcd.ko
description: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/firmware/edd.ko
description: sysfs interface to BIOS EDD information
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/ata/ahci.ko
description: AHCI SATA low-level driver
depends: libata
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/ata/libata.ko
description: Library module for ATA devices
depends:
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/acpi/fan.ko
description: ACPI Fan Driver
depends: thermal_sys
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/acpi/thermal.ko
description: ACPI Thermal Zone Driver
depends: thermal_sys
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/acpi/processor.ko
description: ACPI Processor Driver
depends: thermal_sys
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/thermal/thermal_sys.ko
description: Generic thermal management sysfs support
depends: hwmon
filename: /lib/modules/2.6.31.8-0.1-default/kernel/drivers/hwmon/hwmon.ko
description: hardware monitoring sysfs/class support
depends:


Hope this will help :)

Bhaskar Chowdhury
Google Talk: unixbhaskar Skype: unixbhaskar Y! messenger: unixbhaskar
DiggLinkedinWordpressTwitterTechnoratiStumbleuponReddit

Friday, October 16, 2009

Checking malware for GNU/Linux system

Besically I am using two very good open source software to check my servers in certain time interval. One is chkrootkit ,and the second one is rkhunter . Both of them are capable of checking trojan and sign of rootkit.

You have to get them from their site as source and build them or install them manually or by some created scripts.Once they are installed ,both the software can be put into the cron to check it after certain interval.

I do not issue any guarantee that this will work for you.

Here is some excerpt from the chkrootkit site for how to use it below. For detail please visit the website:

Usage
--------

chkrootkit must run as root. The simplest way is:

# ./chkrootkit

This will perform all tests. You can also specify only the tests you
want, as shown below:

Usage: ./chkrootkit [options] [testname ...]
Options:
-h show this help and exit
-V show version information and exit
-l show available tests
-d debug
-q quiet mode
-x expert mode
-r dir use dir as the root directory
-p dir1:dir2:dirN path for the external commands used by chkrootkit
-n skip NFS mounted dirs

Where testname stands for one or more from the following list:

aliens asp bindshell lkm rexedcs sniffer w55808 wted scalper slapper
z2 chkutmp amd basename biff chfn chsh cron crontab date du dirname
echo egrep env find fingerd gpm grep hdparm su ifconfig inetd
inetdconf identd init killall ldsopreload login ls lsof mail mingetty
netstat named passwd pidof pop2 pop3 ps pstree rpcinfo rlogind rshd
slogin sendmail sshd syslogd tar tcpd tcpdump top telnetd timed
traceroute vdir w write

For example, the following command checks for trojaned ps and ls
binaries and also checks if the network interface is in promiscuous
mode.

# ./chkrootkit ps ls sniffer

The `-q' option can be used to put chkrootkit in quiet mode -- in
this mode only output messages with `infected' status are shown.

With the `-x' option the user can examine suspicious strings in the
binary programs that may indicate a trojan -- all the analysis is
left to the user.

Lots of data can be seen with:

# ./chkrootkit -x | more

Pathnames inside system commands:

# ./chkrootkit -x | egrep '^/'

chkrootkit uses the following commands to make its tests: awk, cut,
egrep, find, head, id, ls, netstat, ps, strings, sed, uname. It is
possible, with the `-p' option, to supply an alternate path to
chkrootkit so it won't use the system's (possibly) compromised
binaries to make its tests.

To use, for example, binaries in /cdrom/bin:

# ./chkrootkit -p /cdrom/bin

It is possible to add more paths with a `:'

# ./chkrootkit -p /cdrom/bin:/floppy/mybin

Sometimes is a good idea to mount the disk from a compromised machine
on a machine you trust. Just mount the disk and specify a new
rootdir with the `-r' option.

For example, suppose the disk you want to check is mounted under
/mnt, then:

# ./chkrootkit -r /mnt
Now for rkhunter you have to follow these steps to use it and must follow the below paragraph:
      Prior to any incident it is recommended that you have read
"Intruder Detection Checklist". This is available from
http://www.cert.org/tech_tips/intruder_detection_checklist.html
This document will tell you what to check, and makes it easier

which is an excerpt from the site.

We can put the rkhunter in the cron job like below in GNU/Linux system:



The next example is of a cronjob script. For Linux systems this
script could be put in to the /etc/cron.daily directory, so that
it will be automatically run every day.

The script might look like this:

#!/bin/sh

( /usr/local/bin/rkhunter --cronjob --update --rwo && echo "" ) \
| /bin/mail -s "Rkhunter daily run on `uname -n`" root

exit 0
Please read the FAQ regarding those wonderful software to get best out of it. I used to read a lot inside the README/readme file ,which comes along with the source before installing any open source software.

Hope this outline will help you to prevent some owes ,but not everything!!. A system is as secure as you made it.Plus security is an constant process ,which should not be ignored or left behind.

Bhaskar Chowdhury
Chat Google Talk: unixbhaskar Skype: unixbhaskar Y! messenger: unixbhaskar
Contact Me DiggLinkedinWordpressTwitterTechnoratiStumbleuponReddit

Monday, October 12, 2009

The firefox saga on openSUSE

Ahh what a pain!! I have been struggling to get firefox going on OpenSUSE for quite some time. The problem is that it(firefox) eats out 100% cpu and freeze it forever.So it hinders the productivity of mine heavily ,because I spent lot of time in the browser to do lot of day to day activity.At last I am able to figure out and solve the owes regarding that problem.

I do not issue any guarantee that this will work for you.

The Solution:

The first step I took discard firefox and start using "swiftfox", which is specifically optimized to run on GNU/Linux and of course on specific processor!!!. You can have a look at it in the website http://www.getswiftfox.com.

Once it came up ,I create a new profile in it and install my fatty extension(around 57 of them) on it(all firefox extensions are compatible with it) one by one.You can find my extension for firefox in mozilla site by looking at this url : https://addons.mozilla.org/collection/unixbhaskar

Then I have created a small script to restrict the cpu usage of swiftfox by a specific limit with the help of a software called "cpulimit",which can be found here : http://cpulimit.sourceforge.net/ . So the next step to call it when the swiftfox start. So here is small snippet of code will do that:

#!/bin/bash
2
3 if [[ `ps -ef | grep swiftfox-bin` ]]
4 then
5 echo "swiftfox is running."
6 `/usr/local/bin/cpulimit -e swiftfox-bin -l 70`&
7 echo "limiting the cpu usage by 70%"
8
9 fi

So I have restricted swiftfox to 70% of cpu usage.So it will never utilise more then that cpu usage power.

Now it's running fine on OpenSUSE11.1 with latest kernel-2.6.31.3 .

At last some respite :)

Bhaskar Chowdhury
Chat Google Talk: unixbhaskar Skype: unixbhaskar Y! messenger: unixbhaskar
Contact Me DiggLinkedinWordpressTwitterTechnoratiStumbleuponReddit