Search This Blog

Tuesday, June 26, 2012

error: Failed dependencies: is needed

I actually got this error while trying to install rpm of driver of a network card on RHEL 6.2 64 bit. That error looked something like this:

# rpm -i  myri_dbl-2.  1.0.51076-3636.x86_64.rpm
error: Failed dependencies: is needed by myri_dbl- is needed by myri_dbl- is needed by myri_dbl- is needed by myri_dbl- is needed by myri_dbl- is needed by myri_dbl- is needed by myri_dbl- is needed by myri_dbl- is needed by myri_dbl-

This error occurs because of some 32 dependencies which are required. The solution is to install 32 version of glibc.

# yum install libstdc++-4.4.6-4.el6.i686

This will mostly solve your problem.

Friday, June 22, 2012

To check which application is using a particular port

You give following command to check which application is using a particular port.

# netstat -ltnp | grep portno


# lsof -i :portno

Check whether hyperthreading is enabled or not ?

We can check whether hyper threading is enabled or not without checking in bios by giving following command
# cat /proc/cpuinfo
If the number of siblings and number of cores you see is same then hyper threading is not enabled. If they are not same then its enabled.
If its enabled, then "siblings" give logical cores present and "cpu core" gives actual physical cores.

Total number of cpu's is equal to maximum number of cpu id available in the result + 1.

If you want to find out how many cores are present in a particular cpu and what there numbers are then you can give following command.

#  cat /sys/devices/system/cpu/cpu2/topology/core_siblings_list

CPU affinity using taskset command in linux

In case of a machine having mulitple processor like NUMA processes generally perform better on one processor when compared to other processors. So its necessary to attach process to that particular processor so as to maximize performance. For such reasons, a tool named taskset can be used. The linux scheduler then acts according to processor affinity set by taskset command. But generally scheduler tries to keep process on same CPU as long as it supports natural affinity. So this taskset command may not work in all cases.

Command to check affinity of process with pid
# taskset -p pid
This command tells which cores have been assigned to the process with taht pid.

Command to set affinity of process
# taskset -p mask pid
This command is used to assign process with pid to cores given by that mask.

Mask is defined as follows:
It is a bitmap of processors present in the system. For example if there are 4 cores then 4 bits will be used in bitmap and if there are 8 cores then 8 bits will be used in bitmap.LSB indicates first core and MSB indicates last core. So to assign process with pid 1111 to cores 0,2,4,6 we will give following command
# taskset -p 0X55 1111
To assign it to cores 1,3,5,7 we will give following command
 # taskset -p 0Xaa 1111

Wednesday, June 20, 2012

Lock paged memory when using memcached by using memcached -k option

In case of memcached, paged memory should be locked for following reasons

1) If we reserve some paged memory for memcached then time would be saved in allocating memory for key/value pairs dynamically.
So memcached has memcached -k option to lock paged memory. But generally when you use this option you tend to get following error.

#memcached -u user -k &
warning: -k invalid, mlockall() failed: Cannot allocate memory

This occurs because by default llocked memory is only 64K. You can check this using
# ulimit -l

To change this, open /etc/security/limits.conf and then enter following lines at the end of file.

root   -     memlock   1048576

where root is the user who is going to run the memcached command from command line.

After that logout and login again and then check by using
#ulimit -l

vmap allocation for size=<> failed errror and adding kernel parameter while booting

This error arrises because the virtual memory allocated when operating system boots is limited. In order to solve this problem we have to increase virtual memory by giving external parameter to kernel when its booting.

This can be done in following way.

1)On the splash screen showing grub i.e.where operating system to be booted is shown, press e.

2)Then on the page which appears select that line which starts with the work "kernel". Again press e and go to the end of the line and write vmalloc=

3)After that press enter and boot that operating system. That would  remove that error.

Error inserting module : unknown symbol _udivdi3 undefined

This error occurs on 32 bit operating system. This won't come if you are using 64 bit operating system. If you wan't to avoid this error in 32 bit operating system then you will have to do following thing.

In your code wherever you are doing division by using "/" operator replace it by following
uint32_t do_div(uint64_t dividend, uint32_t divisor)

So a/b would be do_div(a/b).

RHEL Network card not detecting ( Troubleshooting network )

There might be many reasons for network not working as per our requirement. I am going to point out few things which I always do when there is some problem with network. And after working over all theses things for long time, I guess I will be covering most of the reasons for network not working as per our requirement.

Before you start, you can disable firewall using
#service iptables stop

1)You can use following command to configure your network adaptor
After that you can give it IP address, netmask, broadcast address or allow it to take ip from dhcp server. Then you can save and quit and give following command.
#service network restart

2) #ifconfig
This is the command which you should use first to check if the network interfaces are as per your requirement. So this will confirm that network adaptor is enabled.

3)After this you can try connecting i.e. pinging some ip address in your network which is active. If ping does not work then mostly cable is not properly attached. You can use ethtool to figure that out.

#ethtool ethX
If cable is fine then it will show at the bottom "Link detected : yes"
Otherwise it will show "no" instead of "yes". In that case you can try fixing the cable properly.

4) If there is still problem you can check further information about network card and just cross check it with following command.
#ethtool -i ethX
This will show information about network card

5)You can also check whether network card driver has loaded properly by using following command.
#lsmod | grep

Friday, June 15, 2012

Installing Memcached with libevent and benchmarking it with memslap

Memcached is "Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load." Memcached is used by most of the companies today including Facebook, Craiglist, Flickr and Twitter. This is one of the thing which I worked on during my summer intern. I am just going to mention the steps for installing memcached and the problems which I faced doing it.

1) Download libevent from . This is one of the dependency for installing memcached.

2) Extract it

3) Go inside extracted directory and type following things
#./configure --prefix=/usr/local
(If you don't put --prefix then chances are that later on while installing memcached it might give problems.)

# make && make install

4) Download source code of memcached from

5) Extract it

6) Go inside the extracted directory.
#./configure --libevent-with=/usr/local
# make && make install

7) You can check whether memcached is working by giving following command
# memcached -u nobody &
After that you can do 
# ps -el | grep memcached
to see if memcached is started.

8)Now its time to install memslap which is client for memcached. Its used for benchmarking purpose.

9) Download couchbase from

10) Extract it and go inside libmemcached directory present in it.

11) Then build libmemcached.

# ./configure
# make

12) Now go inside clients directory present inside libmemcached and give following command
# ./memslap -s server_ip
to start benchmarking process. After some time (600s) you will get some output. You can vary parameters as per documentation of memslap.

Thursday, June 14, 2012

Installing g++ on rhel and the error " libtool: link: unsupported hardcode properties"

First let me just tell you how generally g++ is installed on RHEL and then the problem which I faced after installing that.

# yum install gcc-c++

After I installed g++ on RHEL , then when I tried installing some tool/utility from its source code, I got following error "libtool: link: unsupported hardcode properties" while building the source code. This is what I did to solve this problem.

#make distclean
# ./configure
# make
# make install

And this solved my problem

No route to host error

This is one of the very common problem and at times it can be really irritating since it can be difficult to figure out the problem if you are not experienced user of linux and especially RHEL. Even after using RHEL for more than 2 years I got stuck over this problem for 4-5 hours trying to do everything possible and later realizing that problem was with firewall. Here are few steps which you can do.

1) First of all give ifconfig and check all interfaces and whether they are according to your requirement.
2) Give command #system-config-network and check network configuration
3) Check firewall rules. Disable it using
# service iptables stop

I guess in most of the cases problem must be with firewall. Remember newly installed RHEL does have firewall enabled by default. So that can cause problem if you are not experienced RHEL user.

Force user to logoff from remote or any terminal

So at times it may happen the a user logs in from remote terminal and forgets to log off. So in order to kill such a session of a remote user, following things can be done.
# who -u
This will give you the pid of the process user is using to log in.
Then you can kill that process using
#kill -9 pid

Tuesday, June 12, 2012

Registering RHEL 6

Initially when you install a new RHEL 6 on your pc and try using even basic utilities like gcc, it will show errors like no package named gcc installed. Even when you do yum install gcc it won't work and will throw errors like:

# sudo yum install gcc 
Updating Red Hat repositories.
Setting up Install Process
Error: Nothing to do
No package gcc available.

If you try
#sudo yum grouplist
Loaded plugins: product-id, subscription-manager Updating Red Hat repositories. No group data available Error: for configured repositories
If you try
#sudo yum repolist
Loaded plugins: product-id, subscription-manager
Updating Red Hat repositories.
repolist: 0

All these problems are mostly because your newly installed RHEL is not registered. You can confirm this by giving following command.
# yum repolist all

If the system is not registered it will give ouptut status as disabled. Now you can register your system with following command and then enter the required details.
# sudo rhn_register

After it has successfully registered, give following command.
#yum update