Friday, 29 April 2016

create and mount ext4 filesystem

Syntax: 

mkfs.ext4  "Device Name"

(or)

mke2fs -t ext4 "Device Name"


Example:
# mkfs.ext4 /dev/sda3

# mkdir /ext4_filesystem

# mount -t ext4 /dev/sda3  /ext4_filesystem

Burn CD or DVD from ISO file (CLI)

Assuming that you already have an ISO file and all you want to create CD based on the ISO 9660 standard. You can burn an ISO using below command,

# cdrecord -v -pad speed=1 dev=0,0,0 daddy-linux.iso
If you are not comfortable with the above mentioned process, follow below method.

First Identify CD ROM letter from /dev/

# ll /dev/ | grep -i cdrom
lrwxrwxrwx  1 root root
3 2010-09-30 15:13 cdrom -> sr0
lrwxrwxrwx  1 root root
3 2010-09-30 15:17 cdrom1 -> sr1

Here, sr0 is our first CD drive and you want to use same drive for burning,

# dd if=/root/Download/daddy-linux.iso of=/dev/sr0 bs=512
Here, if = Source place of an ISO file and of = Destination place or where to write.

Sunday, 24 April 2016

ImportError _psycopg.so: undefined symbol: lo_truncate64




If you are getting above error in psycopg2 , then for sure on loading an older libpq library is used than the one with which the psycopg2 was installed.

To identify which libpq is the psycopg.so is using issue below command, the output of command should point to right libpq.so file which is latest

ldd /path/to/venv/lib/python2.6/site-packages/psycopg2/_psycopg.so | grep libpq
libpq.so.5 => /usr/pgsql-9.4/lib/libpq.so.5 (0x00007f0d6c027000)

if above output is the correct .so file and you are still getting above error then, try to locate libpq.so in default libraries like /usr/lib64 (on centOS), For me it was below under /usr/lib64
 
lrwxrwxrwx.  1 root root       12 Mar 31 10:15 libpq.so.5 -> libpq.so.5.2
-rwxr-xr-x.  1 root root   162760 Feb 25  2014 libpq.so.5.2

As you can see the _psycopg.so for some reason is trying to load above libpq.so.5 which is an older one. So I removed this softlink file libpq.so.5 and created a new one which points to /usr/pgsql-9.4/lib/libpq.so.5 in /usr/lib64, by
issuing below commands
 
cd /usr/lib64
rm libpq.so.5
ln -s /usr/pgsql-9.4/lib/libpq.so.5 libpq.so.5

Above should fix the issue.