Sunday, November 8, 2009

Reliance Netconnect on fedoara 11

Reliance Netconnect coming with dual mode modem, and fedora by default detects it as USB Storage device here are the steps to make it work with fedora 11. As soon as you connect your usb modem check for the kernel message

[apundir@localhost ~]$ sudo tail  /var/log/messages

Nov  8 10:58:38 localhost kernel: usb 5-1: new full speed USB device using uhci_hcd and address 2                          
Nov  8 10:58:38 localhost kernel: usb 5-1: New USB device found, idVendor=19d2, idProduct=fff5                             
Nov  8 10:58:38 localhost kernel: usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3                        
Nov  8 10:58:38 localhost kernel: usb 5-1: Product: USB Storage                                                            
Nov  8 10:58:38 localhost kernel: usb 5-1: Manufacturer: ZTE, Incorporated                                                 
Nov  8 10:58:38 localhost kernel: usb 5-1: SerialNumber: 000000000002                                                      
Nov  8 10:58:38 localhost kernel: usb 5-1: configuration #1 chosen from 1 choice                                           
Nov  8 10:58:38 localhost kernel: scsi3 : SCSI emulation for USB Mass Storage devices

notice the idVendor=19d2, idProduct=fff5 in messages now we need to switch device from usb storage to modem based on this ids. now install usb_modeswitch for this

[apundir@localhost ~]$ sudo yum -y install usb_modeswitch

now you need to look for exact match for target product id in /etc/usb_modeswitch.conf

I have ZTE AC2726 modem here is the configuration i added

[apundir@localhost ~]$ tail -15 /etc/usb_modeswitch.conf

# ZTE AC2726 (EVDO) Reliance Netconnect
# Comments:

DefaultVendor=  0x19d2
DefaultProduct= 0xfff5

TargetVendor=   0x19d2
TargetProduct=  0xfff1


in case you have a different modem make you need to search your configuration and make it enable by commenting the ";" in the usb_modeswitch.conf file. now lets switch the device

[apundir@localhost ~]$sudo usb_modeswitch

here is what i get from my kernel messages

[apundir@localhost ~]$ sudo tail  /var/log/messages

Nov  8 11:00:42 localhost kernel: usb 5-1: usbfs: process 2562 (usb_modeswitch) did not claim interface 0 before use       
Nov  8 11:00:42 localhost kernel: usb 5-1: USB disconnect, address 2                                                       
Nov  8 11:00:43 localhost kernel: usb 5-1: new full speed USB device using uhci_hcd and address 3                          
Nov  8 11:00:44 localhost kernel: usb 5-1: New USB device found, idVendor=19d2, idProduct=fff1                             
Nov  8 11:00:44 localhost kernel: usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0                        
Nov  8 11:00:44 localhost kernel: usb 5-1: Product: ZTE CDMA Tech                                                          
Nov  8 11:00:44 localhost kernel: usb 5-1: Manufacturer: ZTE, Incorporated                                                 
Nov  8 11:00:44 localhost kernel: usb 5-1: configuration #1 chosen from 1 choice

now i got my modem connected to my laptop you can see it added to the list of usb devices on your machine

[apundir@localhost ~]$ lsusb
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 005: ID 413c:8103 Dell Computer Corp. Wireless 350 Bluetooth
Bus 001 Device 002: ID 413c:a005 Dell Computer Corp. Internal 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 003: ID 19d2:fff1 ONDA Communication S.p.A.
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

here ONDA is my modem. modeprobe the new device

[apundir@localhost ~]$  sudo modprobe usbserial vendor=0x19d2 product=0xfff1

after this i have used wvdial to connected to network
installing wvdial is simple with YellowdogUpdateManager

[apundir@localhost ~]$ sudo yum -y install wvdial

now we need to generate a wvdial.conf file for connecting to internet, many blogs say it can be done using  wvdialconf  but i was not able to connect with the conf file i got later after some this and that changes, i got my modem connecting to internet here is my final conf file

[apundir@localhost ~]$ cat /etc/wvdial.conf
[Dialer Defaults]
Modem = /dev/ttyUSB0
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
PPPP Path= /usr/sbin/pppd
New PPPD= 1
Stupid Mode = 1
Tonline = 0

(change username and password in this file. and you may need to change the path of modem for me it got connected to /dev/ttyUSB0)

finally for connecting you need

[apundir@localhost ~]$ sudo wvdial

and output of this will be something like

[apundir@localhost ~]$ sudo wvdial
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Sun Nov  8 11:05:07 2009
--> Pid of pppd: 2719
--> pppd: [18]��
--> Using interface ppp0
--> pppd: [18]��
--> pppd: [18]��
--> pppd: [18]��
--> pppd: [18]��
--> local  IP address
--> pppd: [18]��
--> remote IP address
--> pppd: [18]��
--> primary   DNS address
--> pppd: [18]��
--> secondary DNS address
--> pppd: [18]��

I am not sure now what are these mojibake character, but surely they are due to my terminal settings ..

So first thing i am doing after connecting to internet is writing this blog. hope to see your comment when you get connected

Cheers !

Wednesday, September 2, 2009

Split Screen on vi terminal

Sometimes we need to open multiple files even though we are aware of diff and many other ways of file comparison . We can open two or more files in split windows for comparison.
we will open two files in same terminal window..
open first file normally as we do 
$ vi first.txt
for opening second file in same vi display type 
$ :new second.txt
to navigate in between the windows use
ctrl + w
j     (move to lower window)
ctrl + w
k   (move to upper window)

for expanding a split window to full big screen 
you can also open a new file by just typing 

if file opened by :new is now named , you wont be able to save it with just 
instead u have to give 
:wq nameForNewFile.txt
Keep giving comments .. :)

Friday, August 28, 2009

Sharing internet using iptables

I am explaining how two share internet from one connection to other, here i am using one connection on my ethernet port to share with the wireless add hoc network.

settings at ethernet port (eth0)
IP :
Gateway :

my laptop is configured to get internet from modem connected through LAN port and IP address of Modem is

settings for my Wifi Adaptor(wan0)
IP :
Gateway :

now after this i have created an add hoc network so the systems connecting to my WiFi add hoc network must have following configuration
IP : 192.168.0.[2-254]
Gateway :
DNS  :

Now configuration part is done, next we need to setup sharing, first of all we will enable ip forwarding by issuing following command as root user
sysctl -w net.ipv4.ip_forward=1
To enable it in system startup, edit the file /etc/sysctl.conf and set
net.ipv4.ip_forward = 1
now for sharing do the following commands. this should again be done as root user
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save

I use open DNS for better resolution, you can also tryout same

Sunday, August 23, 2009

Add graphics to fedora 10 boot screen

In order to see the graphical boot, you must enable a mode setting for your video. Most users will find vesafb allows most standard VGA resolutions. Some (older) examples are in Linux Kernel Documentation / fb / vesafb.txt. You must have a proper Kernel mode number. For example I selected: 0x318 for 1024x768x16M resolution on a desktop CRT monitor.

As 'root', edit /boot/grub/grub.conf, and add 'vga=0x318' to the end of the kernel line. For example:

title Fedora (
root (hd0,9)
kernel /boot/vmlinuz- ro root=UUID=bb061789-157b-4cb2-85c8-633026e8df1e rhgb quiet vga=0x318
initrd /boot/initrd-

The graphic modes are NOT in the list which you get if you boot with vga=ask and hit return. The mode you wish to use is derived from the VESA mode number. Here are those VESA mode numbers:

| 640x480 800x600 1024x768 1280x1024
256 | 0x101 0x103 0x105 0x107
32k | 0x110 0x113 0x116 0x119
64k | 0x111 0x114 0x117 0x11A
16M | 0x112 0x115 0x118 0x11B

The video mode number of the Linux kernel is the VESA mode number plus 0x200. Linux_kernel_mode_number = VESA_mode_number + 0x200

So the table for the Kernel mode numbers are:

| 640x480 800x600 1024x768 1280x1024
256 | 0x301 0x303 0x305 0x307
32k | 0x310 0x313 0x316 0x319
64k | 0x311 0x314 0x317 0x31A
16M | 0x312 0x315 0x318 0x31B

installing GRUB

on grub terminal
(in bold are the commands, italics is output to commands)

find /boot/grub/stage1

to find out which partitions in my computer have GRUB installed in them

root (hd0,1)
Filesystem type is ext3fs, partition type 0x83

telling that this root partition contains grub and is to be installed it will give file system type
f I know I have Ubuntu in partition 2 and Debian in partition 4 and I want Ubuntu's GRUB installed to MBR, I set (hd0,1) as GRUB's root device here. If I chose (hd0,3) that would install Debain's GRUB
here i am installing Ubuntu's grub according to the assumption.

setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.
Running "install /boot/grub/stage1 d (hd0) (hd0)1+15 p (hd0,1)/boot/grub/stage
2 /boot/grub/menu.lst"... succeeded

setup (hd0)' is the command to install Grub's stage1 to MBR in the first hard disk.

We have to do some more tricks to install grub to non MBR partition

Various LInux Booting options

Boot time command args:

expert Turns on special features:
- allows partitioning of removable media
- prompts for driver disk

noshell Do not put a shell on tty2 during install.

lowres Force GUI installer to run at 640x480.

resolution= Run installer in mode specified, '1024x768' for example.

nousb Do not load USB support (helps if install hangs early sometimes).

nofb Do not load the VGA16 framebuffer required for doing text-mode installation in some languages.

nofirewire Do not load support for firewire devices

askmethod Do not automatically use the CD-ROM as the install source if we detect a Red Hat Linux CD in your CD-ROM drive.

nousbstorage Do not load usbstorage module in loader. May help with device ordering on SCSI systems.

noparport Do not attempt to load support for parallel ports

noprobe Do not attempt to detect hw, prompts user instead.

nopcmcia Ignore PCMCIA controller in system.

skipddc Skips DDC probe of monitor, may help if its handing system.

graphical Force graphical install. Required to have ftp/http use GUI.

text Force text mode install.

vnc Enable vnc-based installation. You will need to connect to the machine using a vnc client application.

vncpassword= Enable a password for the vnc connection. This will prevent someone from inadvertantly connecting to the vnc-based installation. Requires 'vnc' option to be specified as well.

vncconnect=[:] Once installation is up and running, connect to the vnc client named , and optionally use port . Requires 'vnc' option to be specified as well.

updates Prompt for floppy containing updates (bug fixes).

isa Prompt user

enable root login

Login with default user and type
>>>>>$ sudo su
It will ask for password give password and you are now root user check the shell prompt(#)
Now type
>>>>># passwd
And enter new password for root , confirm it by typing once again
Now your password for root is set
Now open
System > Administration > Login Window
Go for Security tab
Check the box with option Allow system Administrator login
you can do root login

You can play with some more options there like automatic login and Timed login
Enjoy !

Add fonts to linux

one way is to add the fonts to the linux fonts.its a simple procedure.
create a directory for the fonts in /usr/share/fonts/trutype
# cd /usr/share/fonts/truetype
# mkdir newfonts

copy the fonts you want to add to that directory.
Now change the ownership of the fonts as well as make sure they have a right of 644 .
# chown root.root *.ttf
# chmod 644 *.ttf

Now run the command mkfontdir while in the newfonts directory.
# mkfontdir

This will create an index of the fonts in the directory. It will also create two files fonts.dir and fonts.cache-1 .
Now moving to the parent directory, edit the file fonts.cache-1 using your favourate editor and append the following line to it.
#File: /usr/share/fonts/truetype/fonts.cache-1
"newfonts" 0 ".dir"

Lastly run the command fc-cache.
# fc-cache

This command will scan the font directories on the system and build font information cache files for applications using fontconfig for their font handling.
That's it. Now you can have access to the new fonts in all your X applications including firefox and


So many times i thought to post about GRUB here are COMMANDS TO REINSTALL GRUB:

All you need to do is access the terminal using the installation CD/DVD of your GNU/Linux operating system. Ubuntu installation CD is a live CD and so, when it loads, you can run the terminal from there. Fedora installation CD/DVD offers options through which you will have to choose to upgrade the system using commands(rescue mode). Some other like Knopics LIVE etc also have similar options

Once you are at the terminal, you will have to access the ‘grub’ shell to change the grub configuration.So, give this command at the terminal:
$ grub

If it says that you don’t have the permission, in which case you will not have logged in as root(as in Ubuntu), give this command at the terminal:
$ sudo grub

You will get the grub-shell prompt:

Now, you will have to find out in which partition Grub had been installed before, so that you reinstall in that partition only. Give this command at the terminal:
grub> find /boot/grub/stage1

(returns value)
It returns the number of the partition in which Grub i.e your GNU/Linux had been installed.

grub> find /boot/grub/stage1

You can also reinstall Grub in your GNU/Linux partition, only if this GNU/Linux partition is “primary” and you have another boot loader installed at the MBR (in case of more than one GNU/Linux operating systems) through which you can boot this primary partition. To do that, give this command at the terminal:
grub> setup (returned value)

grub> setup (hd0,2)

Recover from kdeinit CRASH

Although there is excellent power backup in lab, what to do if someone switch off the main input to room when he was trying to switch off lab air conditioners ...

Busy Salam was doing some experiment and was installing some rpm in his linux box.. power failure resulted his kde in poor situation. kdeinit was not starting at all. He used gnome to login to box but whole experiment was going on in KDE desktop environment. Here are the steps used to recover KDE environment back.

STEPS:: (login to root through gnome)
  1. cd /var/lib/rpm
  2. rm __db* ( here two _ underscore)
  3. rpm --rebuildbd
  4. reboot (mandatory)
  5. yum -y update
After yum update completed he did a restart and was able to login to kde (voila).what a relief.

Monday, July 27, 2009

Reset Mysql Password in Linux

  1. Stop mysqld and restart it with the --skip-grant-tables --user=root options (Windows users omit the --user=root portion).

  2. Connect to the mysqld server with this command:
    shell> mysql -u root

  3. Issue the following statements in the mysql client:
    mysql> UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
    Replace “newpwd” with the actual root password that you want to use.

  4. You should be able to connect using the new password.

Saturday, June 27, 2009

Access web on Terminal

Internet in hostels was blocked as we were having exams. I never studied from books after my graduation, always preferred content from internet finally i logged into my lab server as ssh was only option allowed to get out of hostel LAN. We can access internet in our lab and i knew that webpages can be opened on terminal also after a short try i got lynx and i was connected to internet out side after that the first thing i did was i searched on other available options ... i opened and searched on various other options ... i got many terminal based browsers .. here is the list i have searched

it has some other variants also ELinks, Links2, Links-hacked

I have spent all my night with browsers on terminal ... got up late at morning and screwed up my exam ... :)