Posts

Showing posts from 2014

Resovled: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory after installing HDSentinel:

Image
For: Debian/Ubuntu # apt-get update # apt-get install ia32-libs For: CentOS/RedHat/Fedora/Suse/Mandriva # yum -y install glibc.i686

Nagios: CRITICAL - Could not interpret output from ping command

PING     UNKNOWN /bin/ping -n -U -w 10 -c 5 xx.xx.xx.xx Nagios monitoring page showing above error when configuring in the client host ? 'Set-user-ID-on-execution permission' to fix the issue, # ls -al /bin/ping -rwxr-xr-x. 1 root root 40760 xxx xx  xxxx /bin/ping # chmod u+s /bin/ping  // fix the issue. # ls -la /bin/ping -rwsr-xr-x. 1 root root 40760 xxx xx  xxxx /bin/ping

Nagios: -bash: /usr/local/nagios/libexec/check_nrpe: No such file or directory

To fix "check_nrpe: No such file or directory" # cd # wget http://prdownloads. sourceforge.net/sourceforge/ nagios/nrpe-2.13.tar.gz # tar zxvf nrpe*.tar.gz # cd nrpe* # ./configure --with-nagios-user=nagios --with-nagios-group=nagios # cd ./src/ # make check_nrpe # mv ./check_nrpe /usr/local/nagios/libexec/ Now you can find: /usr/local/nagios/libexec/check_nrpe !!!

STOP :: logging query cache denied to /var/log/messages :: named

How to stop logging query cache denied to /var/log/message and /var/named/data/named.run ? Solved: Adding the following to your /etc/named.conf will stop logging the cache denied messages: category security { null; }; So named.conf will looking like below: ------------------------------------------- logging {     category security { null; };     channel default_debug {             file "data/named.run";             severity dynamic;     }; }; --------------------------------------------

HowTo : Execute BASH Shell Commands over MySQL environment in Linux?

Image
Yes, We can execute shell commands over mysql environment without exit by adding "\! " before commands as like "\! command", mysql> \! uptime  06:52:18 up 36 min,  1 user,  load average: 0.00, 0.00, 0.00 mysql> mysql> \! pwd /root mysql> (or) We can get the shell prompt here by doing, mysql> \! bash (or) mysql> \! sh HowTo: Get current working database information in mysql? Add the below lines in /etc/my.cnf [mysql] prompt=`mysql(\d)>` your  mysql environment will be, `mysql((none))>` To revert this, HowTo: Get hostname in mysql environment? Add the below lines in /etc/my.cnf [mysql] prompt=`mysql(\h)>` Also in /root/.my.cnf should have below, [client] host=valid.hostname.com user="root" pass="password" please make sure the hostname should be valid and added in /etc/hosts If you would like to return default PROMPT of mysql(this time only)

Insert another file's content to current file - VI Editor

Easy way to insert another file's content to current file using VI is, > Open the file # vi myfile.txt :r myanotherfile.txt Here we can use r or read to load myanotherfile.txt on myfile.txt, Now the myanotherfile.txt's contents placed immediately after the current line. If you wish to place the contents in particular line ? Okay, If you wish to place the myanotherfile.txt's contents on myfile.txt at 5th line, > Open the file # vi myfile.txt :4r myanotherfile.txt so that the contents of myanotherfile.txt were placed immediately after the 4th line ( obviously on 5th line as we required). You can do this without opening the myfile.txt: Below command to insert myanotherfile.txt's contents on myfile.txt: # sed -i 'r myanotherfile.txt' myfile.txt now myanotherfile.txt's contents on myfile.txt at second line( I hop we already know why it placed on second line ! ), If you wish to place this on 5th line, then: # sed -i '4r myanotherfile.txt' myfile.txt

Libxml error while compiling dual php - "make: *** [ext/dom/node.lo] Error 1"

Libxml error while compiling dual php - "make: *** [ext/dom/node.lo] Error 1" ext/dom/node.c: In function 'dom_canonicalization': ext/dom/node.c:1953:21: error: dereferencing pointer to incomplete type ext/dom/node.c:1955:5: error: dereferencing pointer to incomplete type make: *** [ext/dom/node.lo] Error 1 This is a PHP error when compile the older version when install libxml2 from bigger version 2.9.0. Fix: Need to update patch. + vi libxml29_compat.patch + copy and paste below code in the file: 'libxml29_compat.patch' ============================== ============================== ============= --- ext/dom/node.c    2012-08-06 17:49:48.826716692 +0800 +++ ext/dom/node.c    2012-08-06 17:52:47.633484660 +0800 @@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA          RETVAL_FALSE;      } else {          if (mode == 0) { +#ifdef LIBXML2_NEW_BUFFER +            ret = xmlOutputBufferGetSize(buf); +#else              ret = buf->buffer->u

Boot Failure after Latest Kernel Update - "warning: selinux targeted policy relabel is required"

warning: selinux targeted policy relabel is required When rebooting the server due to kernel upgrade we may face below error due to "SELinux is in permissive mode, the operation would have been denied but was permitted due to permissive mode." Error: Warning -- SELinux targeted policy relabel is required. Relabeling could take a very long time, depending on file system size and speed of hard drives. Reason: SELinux is preventing access to files with the label, file_t. Fix: We have done below steps to overcome the issue, > Login the server through KVM > Enter into single user mode. > Edit the file: "/etc/selinux/config" as below SELINUX=permissive to SELINUX=disabled > exit from single user mode Now the box will boot-up normally. :) !!!

KVM disk performance: raw vs qcow2 & Steps to Convert raw to qcow2

Image
Disk Format: Raw vs. Qcow2: The libvirt(The virtualization API. libvirt is: A toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes))  snapshots can only be performed on certain type of disk formats. There are several types of VM disk formats, but the most  common are raw and qcow2 (copy-on-write).     * qcow2 [ "QEMU Copy-On-Write" ]     * qcow2 is an updated version of the qcow format, intended to supersede it. The main difference with the original is that qcow2 supports multiple virtual machine snapshots through a new, flexible model for storing snapshots. *   Users can easily convert qcow disk images to the qcow2 format. QEMU and Xen have retained the qcow format for backwards compatibility. How qcow2 works: *   Raw disks are presented as-is to the VM without any disk layering and do not support snapshots, whereas qcow2 disks support a range of special features including snapshots, compression and encrypt

kernel: EXT3-fs warning (device hda3): ext3_dx_add_entry: Directory index full!

kernel: EXT3-fs warning (device hda3): ext3_dx_add_entry: Directory index full! To trace the actual directory limit: find / -type d | ( while read A; do B=`ls -l "$A" | wc -l`; echo $B $A; done) | sort -n It was not a bug, but a limit. Ext3's hash directores are limited to depth of 3 blocks, which normally is not a problem if a 4k blocksize is being used, since each internal node is small; only 8 bytes. So there is a fanout of 508 for each internal node, and two internal nodes gets to over 250,000 4k directory blocks. But with a 1k blocksize, the internal node fanout is only 124, so that only gets a bit more than 15,000 1k directory blocks. The enduser recreated the file system using the default 4k blocksize to avoid this situation. :-)

How to FIX Ownership issues under cPanel based server ?

Here is a simple script to solve the ownership issue under cPanel based server, # echo -e “Checking ownership” for i in `ls /var/cpanel/users/` do if [ "$i" != "root" ]; then chown -R $i:$i /home/$i chown $i:nobody /home/$i/public_html /home/$i/.htpasswds chown $i:mail /home/$i/etc /home/$i/etc/*/shadow /home/$i/etc/*/passwd echo $i fi done Yeah !!!

Swap space calculation | Unix / Linux:

Image
In general, * 2GB swap space for 4GB of RAM or less. * 4GB swap space for 4-16GB of RAM * 8GB swap space for 16-64GB of RAM * 16GB swap space for 64-256GB of RAM * 32GB swap space for 256-512GB of RAM But, Here is some-more detailed information about calculating swap space, Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files. Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB. So, if: M = Amount of RAM in GB, and S = Amount of swap in GB, then Using this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can be especially helpful if you plan to upgrade your RAM at a later time. For systems with really large amounts of RAM (more than 32 GB) you can likely get away w

LINUX - Detailed history of the commands:

Through ' history ' command, We can see what are all the commands used before, Normal 'history' command output: #  history     1  ls     2  cd /     3  cd     4  cd /var/log/     5  cd ..     6  cd /     7  cd     8  history Can we get more / exact details about when the commands were performed ? Yes, we can get more information by usgin " export HISTTIMEFORMAT='%F %T ' " After performing " export HISTTIMEFORMAT='%F %T ' ", the output goes like, # export HISTTIMEFORMAT='%F %T ' # history     1  2014-03-07 07:11:57 ls     2  2014-03-07 07:12:00 cd /     3  2014-03-07 07:12:01 cd     4  2014-03-07 07:12:18 cd /var/log/     5  2014-03-07 07:12:21 cd ..     6  2014-03-07 07:12:24 cd /     7  2014-03-07 07:12:25 cd     8  2014-03-07 07:12:28 history     9  2014-03-07 07:13:31 export HISTTIMEFORMAT='%F %T'    10  2014-03-07 07:13:3 4history Cheers !!!

measuring exact IO wait:LINUX

iostat - Report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions. We can get detailed report from iostat with N for LABEL. # iostat -xN 1 Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util sda               0.00     4.00   51.00    2.00 11640.00    48.00   220.53     0.08    1.49   1.42   7.50 zz_root     0.00     0.00    2.00    6.00    48.00    48.00    12.00     0.00    0.00   0.00   0.00 yyy_swap     0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00 xxxxx_home     0.00     0.00   49.00    0.00 11592.00     0.00   236.57     0.08    1.61   1.53   7.50 fuser : command lists the process numbers of local processes that use the local or remote files specified by the File parameter. -v        verbose output -m        show all processes using the named filesystems # fuser -vm xxxxx_home

su: cannot set user id: Resource temporarily unavailable - Linux

   Restricting direct root login and using Wheel user always make better security, but some cases we may face below error, "su: cannot set user id: Resource temporarily unavailable"   To overcome this issue, we need to add / increase the number of processes value in /etc/security/limits.conf. A quick check about the number of operating system processes. # ps -U wheel-user | wc -l To add / increase the below value in /etc/security/limits.conf # wheel-user soft nproc(maximum number of processes) value admin soft nproc 2048 If this won't work, vi /etc/security/limit.conf # add / change on these line: *          soft   nproc       2047 *         hard   nproc       16384 *         soft   nofile       2048 *         hard   nofile      65536 Now you can try to login once again.. it will works.