ngrep on Cent OS 7

In CategoryGeneral

Tried to install ngrep on Cent OS 7 with yum install ngrep on Cent OS 7 and it returned “No package ngrep available.
Error: Nothing to do
” then tried to install ngrep rpm directly rpm -ivh which is meant for el6 and it returned error like
error: Failed dependencies: is needed by ngrep-1.45-1.el6.rf.x86_64

Then installed latest epel package

rpm -ivh

and then yum install ngrep was happy with that

ngrep.x86_64 0:1.45-17.git20131221.16ba99a.el7


Working with HUAWEI GSM modem on linux

In CategoryGeneral

When I connected the Huawei modem I could see only  3 additional sg0 ,sg1, sdb  entries in   /dev  and there are no USBtty0 ,USBtty1,USBtty2 which supposed to be cerated by Huawei modem .

By default linux will detect HUAWEI modem as usb storage /cd drive . we must switch it to USB serial inorder to use it as modem .

you can do this with usb_modswitch .  If you dont find usb_modswitch in /lib/udev you can install it from here.

/lib/udev/usb_modeswitch –vendor 0x12d1 –product 0x1446 –type option-zerocd

You can create config file in /etc/udev/rule.d/15huawei-1773.rules

SUBSYSTEM==”usb”, SYSFS{idProduct}==”1446″, SYSFS{idVendor}==”12d1″, RUN+=”/lib/udev/usb_modeswitch –vendor 0x12d1 –product 0x1446 –type option-zerocd”

Restart the system and check   lsusb -vvvv | less and note down product id and vendor id information .

You can add this information in /etc/modprobe.d/modprobe.conf.

My /etc/modprobe.d/modprobe.conf  has single line like below

options usbserial vendor=0x12d1 product=0x140c

Now load the usb serial with command  modprobe usbserial


Installing usb_modeswitch to connect usb gsm modems on CentOs

In CategoryGeneral

I have a  huweai e1732 modem which i want to use as simple smsgateway for my personal use and outgoing voice trunk for asterisk .

As soon as I connect it to usb ,linux detects it as external storage and never shows as ttyUSB in /dev list .

To make it work as serial modem i had to install usb_modeswitch

[root@sriba usb_modeswitch.d]# yum install usb_modeswitch
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base:
* epel:
* extras:
* updates:
Setting up Install Process
No package usb_modeswitch available.

This package is in rpm forge

import the dpg key

rpm --import

verify the package download
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm

Instaleld the package
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm

fetchmail with proemial and mutt

In CategoryGeneral

One of My Small Projects Required fetch mail to pull mails on linux system.

1. Need to download mail from remote server using fetchmail on linux

2.fetchmail will be added to crontab and scheduled to pull mail for every 2 minutes

3.each mail will be downloaded to a seperate text file

while configuring fetech mail with mda “/usr/bin/procmail -d %T”  getting syntax error   and i tried with  single  quotes ‘  and without quotes too .

/usr/bin/fetchmail –daemon 0 -v -f /etc/fetchmailrc
fetchmail: WARNING: Running as root is discouraged.
fetchmail:/etc/fetchmailrc:13: syntax error at mda


Though it  is not the solution for this problem ,  i called fetch mail in crontab this way

*/1 * * * * /usr/bin/fetchmail -m “/usr/bin/procmail -d %T”–daemon 0 -v -f /etc/fetchmailrc &> /dev/null

Recovering Mysql database from A Failed RAID disk

In CategoryGeneral

It is always a good idea  to backup mysql database on a production server at regular intervals. Read my post how to  auto schedule a mysql database-backup on windows or linux.

If you are using a RAID 0 drive for mysql and the disk failed to boot  what will you do ?  If you have mysqlbackup It is easy to reinstal mysql and restore database from backup .   But what if you dont have any backup  .. ?

Yeah it happend to me ! . I have used  all the data recovery softwares i found on internet to get the databack . succeeded   Only with TESTDISK and GetMydataback .

As soon as i noticed that my server is no more bootable due to RAID fail , I requetsed datacenter support team to  keep the prsent RAID drive  as secondary driver and add another harddisk   and install OS on it .

I booted off serevr with newly installed OS but i can see the Failed RAID parition  not mounted as it is showing  RAW file system in  diskmanagemnet.


Screen Shot 2013-07-27 at 6.40.24 PM

I used TestDisk and tried to copy mysql InnoDB  file  idbdata1  from failed drive which is around 46 GB  , but Test disk is copying the file in a kind of loop .  Once The file being written completely it starts overwriting it again and again .



Screen Shot 2013-07-27 at 5.17.43 AMScreen Shot 2013-07-27 at 5.17.01 AM