Sunday, November 16, 2008

Finding where GRUB stages are installed

Hi all,

The following command when entered in GRUB prompt will list out the drive in which GRUB stage 1 is intalled:

grub> find /boot/grub/stage1

for me it resulted in:
(hd0,5) ------> internal 80 GB SATA
(hd1,0) --------->External USB Western Digital passport

This was because earlier I had grub on internal hard disk which I erased from MBR. And second was for the USB Western Digital passport drive.

One other command that is helpful is:

grub-install --recheck /dev/sdb
This installs grub on the selected drive, WD in my case.

But for a fool proof method use root and setup commands from inside grub prompt to install grub.


Installing Fedora Core 9 on Western Digital Passport

Hi all,

Here was the scenario: I have an 80 GB SATA hard drive. I have Windows XP installed on it. Now my idea was to keep my current hard disk configuration unchanged and install a flavour of Linux on an external drive (which is generally a USB interface). With this intention I bought a 160 GB Western Digital Passport USB drive (an excellent drive I must say). I decided to install latest version of fedora FEDORA CORE 9. When I plug in my external disk the resultant device identities are:

/dev/sda -------> 80 GB SATA
/dev/sdb -------> 160 GB WESTERN DIGITAL PASSPORT

1. Now I started out the installation of fedora, choose "linux expert" by typing in at the boot prompt when you boot from fedora CD. But I just followed the normal install routine
2. Did a fresh install, and selected my Western digital drive for installation. Then I did a custom partition of the drive. For every partition I also gave the drive on which to partition i.e /dev/sdb
3. Now I selected the External drive to install GRUB.
4. The installation went perfect and everything was done. Then I did a reboot and through the fedora CD went into the rescue mode by typing "linux rescue" at boot prompt.
5. Select No for Network service when ask and skip the next dialogue box that comes up, you will now be taken up to the shell promp sh.3.2#
6. In my case my boot partition was /dev/sdb1 and root partition was /dev/sdb2. Enter the following set of commands:
mkdir /mnt/source
mkdir /mnt/source/boot
mount /dev/sdb2 /mnt/source
mount /dev/sdb1 /mnt/source/boot
chroot /mnt/source

Remember to execute boot commands in that order. The chroot is to use paths relative to the root directory.
7. Now we will create the initrd image to include modules for USB so that we can boot from our external drive. For this enter the following command:

mkinitrd --with-usb --preload ehci-hcd --preload usb-storage --preload scsi_mod --preload sd_mod
/boot/initrd_usb.gz 2.6.25-14.fc9.i686

The last part of the command is the kernel version. Substitute for the kernel version that you are installing.
8. This with create an initrd image by the name "initrd_usb.gz"
Now you have to replace the intird- entry from the grub.conf file in /boot/grub directory with the "initrd_usb.gz" that we have just created. Also remember to remove the initrd image present in /boot directory before going for a reboot.
9. Now enter the following set of commands:
exit -------> this will exit the chroot
umount /mnt/source/boot
umount /mnt/source
exit --------> to reboot

10. Enter in the bios on reboot and make you boot drive to point to External Drive, in my case Western Digital passport from the First boot device options. Make Sure first that your BIOS supports booting from external drives. Now my PC was bought in 2005 so you have a benchmark as to your BIOS will boot from the USB drive or not.


But I followed the above procedure in 2 scenarios.

1. Initially, in my first attempt, I also had fedora installed on the internal SATA disk. And I followed the above procedure to intsall FEDORA 9 on my WD drive but the booting stopped after diplaying GRUB at startup and nothing happend not even the stage 1. Then using an UBUNTU LIVE CD fiesty fawn I did a "grub-install /dev/sdb". And now I was fucked because I had tinkered the GRUB on my internal hard disk. I wasn't able to boot into windows also. This is a common occurrence to almost any individual that tinkers with GRUB. But there is nothing to worry here if you have Windows 98 CD. Just boot from it and at the command prompt use the command:
fdisk /mbr
This will fix remove GRUB from your mbr and you will atleast boot into your windows partition.
But this was only a part of the story. Now if I boot up using USB I would get to GRUB STAGE 1.5 and Error 17 would come up and bump, nothing happend.
2. Then I again installed FEDORA 9.Though this time I didn't have GRUB Installed in my internal drive. I followed the install procedure and installed grub from the UBUNTU LIVE CD FIESTY FAWN, by typing "grub" to get into the grub command line
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

Voila!! I had set up grub on my external drive explicitly.
Did a reboot and bingo I got to the stage where I got the splash screen displaying boot options, but when I selected fedora it again gave me Error 17: unknown file system type 0x7 Press an key to continue.......... and on key press it again return to menu.
I edited the menu option by pressing "e" and changed the root (hd1,0) to root (hd0,0) pressed enter and then "b" to boot with selected option and then HURRRRRRRRRRAHHHHHHHHHHH, my 4 days of hand banging into every blog concerning GRUB finally paid of. From here one can figure out that when you boot from a disk which has GRUB on it, GRUB assumes that the drive is hd0 though when you install it can see multiple drives and gives it some other number i.e hd1 or hd2 etc. Thus when you boot up remember to change it to hd0 as it did at the grub command edit feature. To make this permanent, boot into the drive and changed the grub.conf entry and you're done.

Fellas this has been an exhausting exercise and I had been working for close to 35+ hours on getting my drive to boot up. I am now adept at handling any of your queries in this regard. Feel free to comment and/or query. I will be more than happy to every problem of yours.
And lastly, thanks to all the linux community forums, its members and other netizens whose little pieces of information I have gathered to get things to work. But I must admit that there was no single place where I could get all of it. So clubbed everything together here, for every individual to refer to. I hope this helps, and apologies for any typos. I have rechecked all commands here. They have been practically implemented in process and so they work 100%.


Thursday, September 11, 2008

Saturday, August 23, 2008

Checking size of a file or directory in Megabytes in Linux

Hi all,

just a small thing but if you want to find the size of a file or directory in Linux, use the following command:

root@gaurav$>du -H file/directory name

Replace the file/direcotry name with the file or directory name you want to know the size of or don't include it if you want to know the size of every file and/or directory in the current directory

Hope that helped. 


Wednesday, August 6, 2008

LINUX CBT IPV6 rapidshare links

Hi all,

these are the rapidshare links for linux cbt IP Version 6.0


HI all,
enjoy these links for linux cbt rhel 5

Password:  4U_bySettler

Rapidshare links for LINUX CBT FOR AWK AND SED

Hi all, these are the links for linux cbt for awk and sed

Password: Hello

Monday, July 7, 2008

Writing, compiling and executing a Qt program on Windows XP

Hi all,

To compile a qt program first make a folder and make a cpp file in this folder and add the appropriate code. For your reference I created a C:\Qt\First and then added a main.cpp with the following contents:

int main(int argc, char* argv[])
QApplication app(argc,argv);
QPushButton button;
button.setText("FIRST BUTTON");;
return app.exec();

Then execute the following standard commands one by one:
qmake -projects
This will create 3 make files namely Makefile, Makefile.Debug, Makefile.Release.
To create an executable: type the command: make -f Makefile.Release
This creates a release folder. The executable is in this release folder. Change to this folder and execute the exe.
Remember that every time you change your code, compile your program with the above command to recreate the release which reflects the changes that you have made.
That's it you are on your way to bigger things in Qt

For any queries leave your comments and I will get back to you soon.




Hi all,

This is the trickiest installation I have done. The trick is to have the right information and it is that on a Windows machine only the commercial release is compatible with Microsoft Visual Studio so if you are stuck with strange errors creeping up when you try to install open source edition with msvc option you know where is the problem. Thus, for Qt open source edition install a mingw compiler on your system. The mingw homepage ( sucks, the download links have nothing to download, it is the worst website of all open source projects. The work around for this is to download Bloodshed Dev C++. This will install everything that you need to start your installation for Qt. Do remember that if you have microsoft visual studio installed clear the environment variables MSYS, LIB and INCLUDE (NOTE:-To check all the environment variables that are set on your machine, type the following command: set on a windows console.). This is done using "set" command from the console as follows
  1. set LIB=
  2. set INCLUDE=

This clears any entries for visual studio from LIB and INCLUDE. Now comes the steps that you need to take to install qt. I am using Qt-4.3.3 open source edition.
  1. Unzip the Qt folder to C: drive so you have a qt source folder in C:\
  2. I have Bloodshed Dev C++ installed in C:\Dev-Cpp. Add the bin and library sub folder of this folder to your PATH variable using PATH=%PATH%;C:\Dev-Cpp\bin;C:\Dev-Cpp\lib. This would relieve you all the hassles of finding and installing a mingw compiler as Bloodshed Dev C++ automatically installs them for you. Also change your LIB and INCLUDE environment variables (after clearing the visual studio entries) to point to Dev-Cpp and Qt lib and include folder. I made the following changes on the console: set LIB=%LIB%C:\Dev-Cpp\lib;C:\qt-win-opensource-src-4.3.4\lib( I unzipped Qt folder to C:\ drive, if you choose some other path then change it accordingly). set INCLUDE=%INCLUDE%:C:\Dev-Cpp\include;C:\qt-win-opensource-src-4.3.4\include.
  3. Then switch to the qt folder i.e where you have unzipped the qt source folder. In my case it is C:\qt-win-opensource-src-4.3.4. From there type the command: configure -platform win32-g++ to configure Qt for your system. The command will only fail if you haven't set the path for the mingw based compiler correctly other wise in a matter of 5-10 minutes your version of qt will be ready to be built.
  4. When qt is configured run the following command to build qt for your system: mingw32-make. If you face any errors during this step it is most likely that you have visual studio installed and environment variables like LIB, INCLUDE AND MSYS set to point to exe's needed by visual studio. Clearing these variables and setting them as I have explained above will relieve you of your hassles.
  5. Finally add Qt bin directory's path to your PATH variable as PATH=%PATH%;C:\qt-win-opensource-src-4.3.4\bin (in my case).

I hope this does the trick for all of you geeks who were hitting a dead end while installing Qt on your windows machines. For any further queries you can send a comment and I will try to answer them to the best of my abilities.


Thursday, March 27, 2008

Travel Advisory To India


Well for all the foreign nationals visiting India there are few points that you must strictly adhere to if you do not want to turn your Indian picnic into a nightmare. Women travelers should be extra cautious while visiting India. Crime against women is a norm in India.
  1. Never ever fall into a trap if some one tries desperately to befriend you.
  2. Stay clear of secluded spots.
  3. Do not travel or party late nights. Call of a night at max 11:00 pm. It is always better to be safe than sorry.
  4. Most guides and travel agents will try to rip off so cross check with your fellow Indian travelers with the correct fares and prices of commodities.
  5. Be extra cautious about your baggage and guard against even children, as in the garb of their innocent looks they will make do with your booty.
  6. Stay away from cheap accommodation. In the past 3-4 years there have been many instances of rape by the staffers of these cheap hotels (or motels as they are called in the US).
  7. For female travelers, it is better if they have a male company otherwise it is very dangerous to tour India. Also for the female travelers, despite the hot weather it is always advisable to wear clothes that cover most of your body as it eliminate any unwarranted attention from some (in fact most) Indian men with hight testosterone drives.
  8. Drink only bottled water. Some good one are BISLERI, AQUAFINA, KINGFISHER etc. Insist on these two as other ones are cheap duplicates that compromise both on your money and health.
  9. Do not try the street food because only Indian people have the digestive system to filter this stuff.
  10. Lastly if you are traveling with your teen aged children (especially girls), make a point that they are with you all the time. The case in point is the molestation of British girls by some Keralite hooligans on the new years night 2008 and the more recent Scarlette Keeling murder case.
Being an Indian citizen it is my responsibility that whoever visits my country has a pleasant and happy time. It absolutely disgust me to see violent crimes being committed against tourist especially women. The above 10 points are to be kept in mind by any traveler visiting India and believe me it will nullify at least 70 percent chance of the tourist getting into trouble. I think Women travelers should strictly follow the above 10 points to ward off any unnecessary hiccups in their visit to India. The rest is up to the destiny of the individual travelers.
Lastly and most importantly, follow your intuition and gut feeling because even the airports are not safe in India. This is proven by the fact that cases of molestation are common place at the IGI airport New Delhi.

Happy touring India

Wednesday, March 26, 2008

Most Indian Men Are Lechers

Hi all, being an Indian male gives you a free hand in giving the females a tough time. Having observed the psyche of Indian men especially over a period of time I find them chauvinist, lecherous towards the fairer sex. In market places I quite often see men and boys ogling at women (don't ask me places where they focus there eyes on). At crowded places they never miss any opportunity to get there hands on a women's assets, testimony to it are the famous incidents of eve teasing in Mumbai during the last 2 new year revelries. Today as well while buying fruits I could see a group of boys ogling and passing obscene comments on two foreigner girls. Seriously there has to be done something about it. It is happening all too often and the audacity of these people is scaling new proportions day by day.
I find these men and boys very weak from inside that is the reason they want to show there manly side by resorting to such petty things. It would rather do there future some good if they could spend this time on some constructive endeavors. I always believe that harassing a female or abusing her body is the worst sin that anyone could commit but the same is being committed with such impunity that it has become a norm rather than an exception. If a stand is not taken against these crimes then GOD save Indian women.
All the talk about our culture is sheer nonsense and bullshit. In the garb of our cultural heritage all the wrong that could be committed against women is committed. How many of us realize and accept rape within marriage? These are just some of the issues about which I am really concerned and would soon file a public interest litigation to do my bit. Till then if any of you feel the same as me, your comments are always welcome.

Saturday, January 5, 2008

Installing Qt on linux

Download Qt's latest version from, I downloaded the source in tar.gz form and compiled it on my machine. It took 1+ hours (Intel 2.4 Ghz. 256Mb RAM running RedHat). It'll jetset on latest machines.
  1. Switch to the directory containing the source and type the following command: tar -zxvf .tar.gz
  2. It will create a directory with extracted contents and tar.gz removed. Change to this directory.
  3. Type the following command: ./configure This checks for the dependencies(i.e other softwares if any, required to install qt).
  4. Then type: gmake. This compiles your qt source code.
  5. Then type: gmake install. This installs qt on your machine.
  6. Note that if you have qt installed on your machine already then to use its latest version you have to set the path of your qt bin file, which you can do by typing the following commands:
export PATH 

For example on my machine after step 5 qt version 4.3.2 was installed in
/usr/local/Trolltech/Qt. Thus I used the following command:
PATH = /usr/local/Trolltech/Qt/bin:$PATH
export PATH
You can also set the PATH variable in your .bash_profile file, but the above method saves you the hassles of editing the file. So take your pick and get on the Qt bandwagon. For any queries regarding installation on the linux box especially redhat contact me on this blog.