Categories

Saturday, 28 December 2013

Ion Cube Loader issue after Cpanel Update

Hi,

Two days before, we faced a problem after one of our client updated the apache  and php on a  cpanel server using /scripts/easyapache.

Then the site is showing the below error.

"Failed loading /usr/local/IonCube/ioncube_loader_lin_5.2.so"

It seems that easy apache was unsuccessful or the php modules are not properly updated. Here the error shows that Ioncube was not updated with the current version of php.

The fix for this is to install the php extension module ioncube using the below command

 /scripts/phpextensionmgr install IonCubeLoader

Now the error message has gone and site is working.

How to reduce the system reserved space in linux

Hi All,

 In linux system OS will reserve some space for a partition by default .That is about 5 % of disk space is reserved for the privileged process. So some times after the most of the disk space is used up, the disk space will be shown as full,  though there is some 6-7 Gb of free space.

Use the command df -h to check the current status of disk space.

So most of the process will get stopped, omce disk space is filled up


Especially in the case of large partitions, it is safe to set the reserved space to the minimum, which is one percent or even to 0 percent.

Best way to make the system reserved space to 0 % is by using tune2fs command, because we already partitioned the device and need to change the partition settings.


Suppose you want to make the reserved space to 0 % on /dev/sda1. We can use  the below command

#tune2fs -m 0 /dev/sda1

This will make the reserved space to 0 %

At the time of file system formatting, we can set the system reserved space to desired % by using the below command.

# mkfs.ext4 -m 1 /dev/sda1






Monday, 2 December 2013

undefined symbol: PQescapeLiteral error on running python postgresql import

Hello,

I got an error as follows, on running import pg command on python command line.

import pg

Traceback (most recent call last):


File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pg.py", line 31, in <module>


from _pg import *

ImportError?: /usr/local/lib/python2.7/dist-packages/_pg.so: undefined symbol: PQescapeLiteral

This seems to be some issue with libpq module for postgresql

Below is the steps that I followed to  fix it.

1)I just checked which is the library directory for postgresql

 pg_config --libdir

/usr/lib

2)Then I checked libpq.so module  which is needed for the postgresql commands to work with python is present on the /usr/lib directory.

  ldd /usr/local/lib/python2.7/dist-packages/_pg.so | grep libpq
    libpq.so.5 => /usr/lib/libpq.so.5 (0x00007f0d6b943000)


3)I can see the libpq.so.5 is already on the path /usr/lib.  The issue is that the header module for libpq was not installed for the command to run. So I installed it using the command below.

apt-get install libpq-dev

which fixed the issue and now I am able to run the pg command from python command line.

Regards
Syamkumar.M

Thursday, 21 November 2013

No module named yum

Hi ,


I got an error as below on running the command on a centos 6.3  server.




There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.3 (default, May 15 2012, 17:45:42)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq




Some one installed installed  a new version of python for running eclypse on the machine and the system python package corrupted due to it, thereby corrupting the yum package.



Below is the steps I have done to fix it.


1)I checked the system location of python which is /usr/bin/python which is version 2.6


/usr/bin/python --version


2) I ran the command "rpm -V python" which will verify all the system packages and will report any error happened to them.


I got error as


Missing /usr/lib64/python2.6.6/*


That is all the system folder for python was some how deleted .




I have to recreate that folder for yum to work


3) I checked one of the identical server where /usr/lib64/python2.6.6 exists and then copied that folder to the other machine where folder is missing.  
The above step saved my time. Otherwise I need to reinstall the python 2.6.6 from centos repository



 cd /usr/lib64
 scp -r python2.6/ root@10.11.16.145:/usr/lib64/

But still I got one error as below


AttributeError: 'YumBaseCli' object has no attribute '_not_found_i'

 It seems that some file system atributes is still having issues. So I had to reinstall the current version of yum

First check the version of yum installed on the machine 

rpm -q yum
yum-3.2.29-40.el6.centos.noarch

Now download the same version of yum "yum-3.2.29-40.el6.centos.noarch"


wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm


Then reinstall it using the command  


rpm -ivh --replacepkgs yum-3.2.29-40.el6.centos.noarch.rpm

 
And now yum worked with out any issues .




Cheers
Syamkumar.M

Thursday, 3 October 2013

Change Postgresql Data Directory

Hi,

Currently there was some disk issue on our server in which some script is importing huge amount of data on the postgresql datbases which filled up the disk space on the machine and stopped all the services .

/ had only 20 GB of disk space .

Postgresql is installed in the directory  /var/lib/pgsql/9.3/data for the postgresql version9.3 . The configuration file of postgresql is postgresql.conf, log files and all other important files are located in that directory

As /var is not a seperate partition, the data directory got filled and which inturn filled up the / partition.

So we need to either change the data directory to /attached which had almost 5 TB of disk space.

Changing the data directory of postgresql seems to be tedious task.

One work around for that issue is to move the data directory /var/lib/pgsql/9.3/data to /data and then create a symlink to /attached/data.

Below is the procedure for it

1) First stop the postgresql service
2)move the data directory to /attached by using the command

mv /var/lib/pgsql/9.3/data /attached

3)now create a sym link to /attached/data from /var/lib/pgsql/9.3/

ln -s /attached/data /var/lib/pgsql/9.3/data

So now the postgresql will check the configuration files and datas inside the same folder /var/lib/pgsql/9.3/data , but it is symlinked to /attached/data. So the actual files will store in /attached/data and won't fill  up /.

4)Restart the postgresql service

/etc/init.d/postgresql-9.3 start

5)Test if it is working perfectly.

su - postgres
-bash-4.1$ ll
total 4
drwx------. 3 postgres postgres 4096 Oct  3 04:31 9.3
-bash-4.1$ psql
psql (9.3rc1)
Type "help" for help.

postgres=# show data_directory ;
     data_directory    
-------------------------
 /var/lib/pgsql/9.3/data
(1 row)

postgres=#



Cheers
Syamkumar.M


Tuesday, 1 October 2013

MTS Data Card Installation in ubuntu 12.04

Hi,

For configuring the MTS Mblaze Datacard on ubuntu, Please do the following steps.

1)First install the service wvdial.

sudo apt-get install wvdial


2) Then create a configuration file /etc/wvdial.conf and add the following configurations on it.

[Dialer mts]
Stupid Mode = 1 
Inherits = Modem0 
Password = mts 
Username = internet@internet.mtsindia.in 
Phone = #777 
[Modem0] 
Init1 = ATZ 
SetVolume = 0 
Modem = /dev/ttyUSB0 
Baud = 115200 
FlowControl = Hardware (CRTSCTS) 
Dial Command = ATDT 
  
3) After this just plugin the the MTS data card on the ubuntu machine. The data card will be automatically detected on the ubuntu machine.

After this run the following command

  sudo wvdial mts


 --> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT 3100000
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Tue Oct  1 21:21:48 2013
--> Pid of pppd: 8718
--> Using interface ppp0
--> local  IP address 116.202.128.90
--> remote IP address 10.228.138.3
--> primary   DNS address 10.228.129.113
--> secondary DNS address 10.228.129.114








Now you will be able to connect to the machine.



Also you can configure it on the Network Manager. For this do the following steps.

1)Click on the Connections Tab on the right side of your desktop.
2)Click on Edit Connections on the bottom
3)Go to the Mobile Broad Band Tab
4)Click on Add connections and give the necessary details 
5)Select the provider as MTS Mblaze and then add
6)Give any connection name

Then on the Mobile Broad Band settings Add the following

Number - #777
username - internet@internet.mtsindia.in
password - mts

Save it and then connect it after you plugged in the Data Card





.

Unable to connect to remote host: No route to host for postgresql

Hi,

When trying to connect to an postgresql database from outside, you may get the error as below " Unable to connect to remote host: No route to host for postgresql"

Here Iam using the postgresql version 9.3
Steps to check

1) First check the iptables rules on the server. If there is any unusual logs then flush it or try after stopping the iptables service using the command

/etc/init.d/iptables stop

2)Even after this if you are still unable to connect to the postgresql server, then do check the following

The postgresql default data directory in linux is   /var/lib/pgsql/9.3/data/

The configuration file for the service is postgresql.conf.

Open that file and search for the option  listen_addresses and make it to listen on all of the interfaces or IPs on that machine as below.

 listen_addresses = '*'

Now exit the configuration file after saving it.

3)Then go the configuration file  pg_hba.conf in the data directory /var/lib/pgsql/9.3/data/

This file controls the connection information of postgresql.

Open that file  and edit the configuration options as below

# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
host    all             all             192.168.0.0/16            trust
# IPv6 local connections:

Above configuration will make the postgresql to listen on all hosts with the subnet range 192.168.0.0/16 . So add it based on your requirement.

Now save the file and then restart the postgresql database using the below command.

/etc/init.d/postgresql restart

Now try to connect to the database.

Also check for any startup errors on the log file /var/lib/pgsql/9.3/pgstartup.log


Regards
Syamkumar.M




Ad